我正在尝试创建一个模板,该模板在Azure中执行多个虚拟机,然后对磁盘进行加密,我设法使其在大约3小时前与2个虚拟机一起工作,但是当我在循环中执行三个以上虚拟机时我收到以下错误:
"code": "DeploymentFailed",
"message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug for usage details.",
"details": [
{
"code": "Conflict",
"message": "{\r\n \"error\": {\r\n \"code\": \"DeploymentActive\",\r\n \"message\": \"Unable to edit or replace deployment 'updatevm': previous deployment
from '12/29/2018 1:11:34 AM' is still active (expiration time is '1/5/2019 1:11:34 AM'). Please see https://aka.ms/arm-deploy for usage details.\"\r\n }\r\n}"
}
]
}
]
有没有一种方法可以暂停一下,使其等待updatevm
扩展名完成?
我用于加密的代码部分是:
{
"name": "[concat(parameters('VMNames'),copyIndex(),'UpdateEncryptionSettings')]",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', parameters('VMNames'),copyIndex(1))]"
],
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[concat(parameters('_artifactsLocation'),'/nestedtemplates/encryptVm.json',parameters('_artifactsLocationSasToken'))]",
"contentVersion": "1.0.0.0"
},
"parameters": {
"vmName": {
"value": "[concat(parameters('VMNames'), copyIndex(1))]"
},
"aadClientID": {
"value": "[parameters('aadClientID')]"
},
"aadClientSecret": {
"value": "[parameters('aadClientSecret')]"
},
"keyVaultName": {
"value": "[parameters('keyVaultName')]"
},
"keyVaultResourceGroup": {
"value": "[parameters('keyVaultResourceGroup')]"
},
"useExistingKek": {
"value": "[parameters('useExistingKek')]"
},
"keyEncryptionKeyURL": {
"value": "[parameters('keyEncryptionKeyURL')]"
},
"_artifactsLocation": {
"value": "[parameters('_artifactsLocation')]"
},
"_artifactsLocationSasToken": {
"value": "[parameters('_artifactsLocationSasToken')]"
}
}
}
},
答案 0 :(得分:1)
使其不依赖于先前的扩展名,因为您没有提供确切的代码,例如:
"dependsOn": [
"updatevm"
}
由于模板的结构原因,这不能完全起作用,答案是使用串行复制模式一次只能创建一个副本。
"copy": {
"name": "storagecopy",
"count": 4,
"mode": "serial",
"batchSize": 1
}