我想通過密鑰保管庫密鑰替換密碼來自動部署可變數量的虛擬機(通過複製部署)。我想爲不同的虛擬機使用不同的祕密(例如VM1的secret1,VM2的secret2)。根據文檔,我需要引用一個祕密與動態編號https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-keyvault-parameter#reference-a-secret-with-dynamic-id 我調整了文檔示例來利用副本部署我的虛擬機,但我努力將secretName更改爲secretName1,secretName2每次調用嵌套模板時。我怎樣才能做到這一點?Azure RM模板。使用密鑰保管庫密碼部署複製虛擬機
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vaultName": {
"type": "string"
},
"secretName": {
"type": "string"
}
},
"resources": [
{
"apiVersion": "2015-01-01",
"name": "[concat('nestedTemplate-', copyIndex())]",
"type": "Microsoft.Resources/deployments",
"copy": {
"name": "nestedTemplateLoop",
"count": "[parameters('numberOfVMs')]"
},
"properties": {
"mode": "incremental",
"templateLink": {
"uri": "https://www.contoso.com/AzureTemplates/newVM.json",
"contentVersion": "1.0.0.0"
},
"parameters": {
"adminPassword": {
"reference": {
"keyVault": {
"id": "[concat(resourceGroup().id, '/providers/Microsoft.KeyVault/vaults/', parameters('vaultName'))]"
},
"secretName": "[parameters('secretName')]"
}
}
}
}
}],
"outputs": {}
}
怎樣的不同?例? – 4c74356b41
我甚至不知道如何在簡單的虛擬機上執行此操作。如果您碰巧看到一個很好的例子,請分享它。 – Max
https://github.com/Azure/azure-quickstart-templates/blob/master/101-vm-secure-password/azuredeploy.json – 4c74356b41