我想使用ARM模板进行跨区域部署。
示例1:
我有两个资源组的A&B、 资源组有一个存储帐户。我想在B的资源组服务中访问A的存储帐户。
示例2:
我有两个资源组的A&B、 资源组有一个application insight服务。我想在B的ApiApp服务中访问A的application insight,并在ApiApp“appsettings”中添加插入键。
我尝试在ARMTemplate中添加以下代码段:
{
"apiVersion": "2017-05-10",
"name": "nestedTemplate",
"type": "Microsoft.Resources/deployments",
"resourceGroup": "testresgrp01",
"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.Insights/components",
"name": "[parameters('appinsightname')]",
"apiVersion": "2015-06-15",
"location": "South Central US",
"properties": {
}
}
]
},
"parameters": {}
}
},
{
"type": "Microsoft.Insights/components",
"name": "[parameters('appinsightname')]",
"apiVersion": "2015-06-15",
"location": "South Central US",
"properties": {
}
}
但本节在部署时出错,并给出以下错误:
New-AzureRmResourceGroupDeployment : - Error: Code=InvalidTemplate; Message=Deployment template validation failed: 'The
template resource 'nestedTemplate' at line '224' and column '10' is invalid. The api-version '2016-07-01' used to deploy the
template does not support 'ResourceGroup' property. Please use api-version '2017-05-10' or later to deploy the template.
如果我删除
“resourceGroup”:“testresgrp01”,
第节,资源部署在resourcegroup中创建一个新服务。
如何解决这个问题?