2017-07-03 94 views
1

我有兩個不同的ARM模板,它們創建兩個不同的資源組和相應的.ps1文件。我想將這兩個模板合併到一個ARM模板中,並從單個.ps1文件部署資源組。 我如何實現這種情況? 謝謝合併多個ARM模板

回答

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": {} 
    } 
} 
+0

謝謝!我不知道這件事。很明顯,我的回答是不正確的。只要OP不接受我的回答,我會刪除它。 –

+1

構建了很多公告,難以遵循所有這些@GauravMantri – 4c74356b41