我有两个不同的ARM模板,它们创建两个不同的资源组和相应的.ps1文件。我想将两个模板合并到一个ARM模板中,并从单个.ps1文件部署资源组。 我怎样才能实现这种情况? 谢谢
答案 0 :(得分:1)
您需要使用cross-resource group deployments。
在模板内部使用此代码段部署到另一个资源组:
{
"apiVersion": "2017-05-10",
"name": "nestedTemplate",
"type": "Microsoft.Resources/deployments",
"resourceGroup": "crossResourceGroupDeployment",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"name": "[parameters('StorageAccountName2')]",
"apiVersion": "2015-06-15",
"location": "West US",
"properties": {
"accountType": "Standard_LRS"
}
}
]
},
"parameters": {}
}
}