2つのネストされたテンプレートを持つテンプレートを作成しました。Azureネストされたテンプレート間のARMの依存関係
{
"name": "[concat(parameters('sqlServerName'), '/', 'Admin')]",
"type": "Microsoft.Sql/servers/databases",
"location": "[resourceGroup().location]",
"apiVersion": "2014-04-01-preview",
"dependsOn": [],
"tags": {
"displayName": "AdminApiDb"
},
"properties": {
"collation": "[parameters('AdminApiDbCollation')]",
"edition": "[parameters('AdminApiDbEdition')]",
"maxSizeBytes": "1073741824",
"requestedServiceObjectiveName": "[parameters('AdminApiDbRequestedServiceObjectiveName')]"
}
}
そして、私の親テンプレートは以下のようになります:
{
"name": "[variables('sqlServerName')]",
"type": "Microsoft.Sql/servers",
"location": "[resourceGroup().location]",
"apiVersion": "2014-04-01-preview",
"dependsOn": [],
"tags": {
"displayName": "SqlServer"
},
"properties": {
"administratorLogin": "[parameters('sqlAdministratorLogin')]",
"administratorLoginPassword": "[parameters('adminLoginPassword')]"
},
"resources": [
{
"name": "AllowAllWindowsAzureIps",
"type": "firewallrules",
"location": "[resourceGroup().location]",
"apiVersion": "2014-04-01-preview",
"dependsOn": [
"[resourceId('Microsoft.Sql/servers', variables('sqlServerName'))]"
],
"properties": {
"startIpAddress": "0.0.0.0",
"endIpAddress": "0.0.0.0"
}
}
]
}
と第二ネストされたテンプレートは、上記のサーバー上でホストされたデータベースを定義します。最初のネストされたテンプレートは、とSQLサーバーを定義し
{
"name": "Shared",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2016-09-01",
"dependsOn": [],
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[concat(parameters('_artifactsLocation'), '/', variables('SharedTemplateFolder'), '/', variables('SharedTemplateFileName'), parameters('_artifactsLocationSasToken'))]",
"contentVersion": "1.0.0.0"
}
},
{
"name": "Admin",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2016-09-01",
"dependsOn": [
"[concat('Microsoft.Resources/deployments/', 'Shared')]"
],
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[concat(parameters('_artifactsLocation'), '/', variables('AdminTemplateFolder'), '/', variables('AdminTemplateFileName'), parameters('_artifactsLocationSasToken'))]",
"contentVersion": "1.0.0.0"
}
}
しかし、で、このことの誤りを展開しようとしている:
リソース 'Microsoft.Sql/servers/mysqlserver'はテンプレートに定義されていません。
兄弟テンプレートのSQLサーバーを表示するには、データベースにどのように取得できますか? SQL Serverは正しい名前でデプロイされるため、名前の問題ではありません。
おかげ
APIバージョンなしで参照機能を使用することができます他のネストされたテンプレート(SQLサーバー、サービスバスなど)しかし、代わりに親テンプレートで定義できると思います – ADringer
ネストされたテンプレートを作成する必要はありません(なぜ複雑なのですか?)**回避策が必要な場合** ARMテンプレートの制限事項**。 – 4c74356b41
私は作成するリソースが非常に多いので、論理エリア別に別々のテンプレートに分割していました。 – ADringer