Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure arm模板验证_Azure_Azure Resource Manager_Arm Template_Azure Template - Fatal编程技术网

Azure arm模板验证

Azure arm模板验证,azure,azure-resource-manager,arm-template,azure-template,Azure,Azure Resource Manager,Arm Template,Azure Template,我的ARM模板代码失败,出现以下验证错误。 域加入应等待自定义脚本扩展完成。请看下面的代码。我无法理解资源和子资源依赖关系如何工作以及如何命名资源。如果你能指导我读一篇文章,我将不胜感激 { "type": "Microsoft.Compute/virtualMachines/extensions", "name": "[concat(variables('varnodeNamePrefix'),copyindex(1),'/cse')]", "apiVersio

我的ARM模板代码失败,出现以下验证错误。

域加入应等待自定义脚本扩展完成。请看下面的代码。我无法理解资源和子资源依赖关系如何工作以及如何命名资源。如果你能指导我读一篇文章,我将不胜感激

   {
    "type": "Microsoft.Compute/virtualMachines/extensions",
    "name": "[concat(variables('varnodeNamePrefix'),copyindex(1),'/cse')]",
    "apiVersion": "2017-03-30",
    "location": "[variables('varlocation')]",
    "dependsOn": [
      "[concat(variables('varnodeNamePrefix'),copyindex(1))]"
    ],
    "properties": {
      "publisher": "Microsoft.Compute",
      "type": "CustomScriptExtension",
      "typeHandlerVersion": "1.8",
      "autoUpgradeMinorVersion": true,
      "settings": {
        "fileUris": [
          "https://XXXXXXXXXXX.blob.core.windows.net/powershelscripts/sqlcluster/InstallAdditionalModules.ps1"
        ]
      },
      "protectedSettings": {
        "commandToExecute": "powershell.exe -ExecutionPolicy Unrestricted ./sqlcluster/InstallAdditionalModules.ps1",
        "storageAccountName": "sdfsdfsdfsdf",
        "storageAccountKey": "sdsdfsdf/BH9C+fdgdfgdfgdfg+fgdfgdfg=="
      }
    },
    "copy": {
      "name": "WinFeatures",
      "count":"[variables('varvmCount')]"
    }
 },

 {
  "apiVersion": "2015-06-15",
  "type": "Microsoft.Compute/virtualMachines/extensions",
  "name": "[concat(variables('varnodeNamePrefix'),copyindex(1),'/joindomain')]",
  "location": "[resourceGroup().location]",
  "dependsOn": ["[concat(variables('varnodeNamePrefix'),copyindex(1),'/cse')]"            
               ],
  "properties": {
    "publisher": "Microsoft.Compute",
    "type": "JsonADDomainExtension",
    "typeHandlerVersion": "1.3",
    "autoUpgradeMinorVersion": true,
    "settings": {
      "Name": "[variables('vardomainToJoin')]",
      "User": "[concat(variables('vardomainToJoin'), '\\', variables('vardomainUsername'))]",
      "Restart": "true",
      "Options": "[variables('vardomainJoinOptions')]"
    },
    "protectedSettings": {
      "Password": "[variables('vardomainPassword')]"
    }
  },
  "copy": {
    "name": "joindomain",
    "count":"[variables('varvmCount')]"
  }

resourceId错误,应为:

"[resourceId('Microsoft.Compute/virtualMachines/extensions',concat(variables('varnodeNamePrefix'),copyindex(1)),'extensions')]"
或者简单地说:

concat(variables('varnodeNamePrefix'),copyindex(1),'/extensions')
错误告诉您的是什么-这里有3个部分:
Microsoft.Compute/virtualMachines/extensions
,但之后只有1个:
concat(变量('varnodeNamePrefix')、copyindex(1)、'/extensions')

但它应该有两个部分,因为它试图这样做:

Microsoft.Compute/virtualMachines/{segment1}/extensions/{segment2}
工作报告:

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {},
    "variables": {
        "varnodeNamePrefix": "testing"
    },
    "resources": [
        {
            "type": "Microsoft.Compute/virtualMachines/extensions",
            "name": "[concat(variables('varnodeNamePrefix'),copyindex(1),'/cse')]",
            "apiVersion": "2017-03-30",
            "location": "[resourceGroup().location]",
            "properties": {
                "publisher": "Microsoft.Compute",
                "type": "CustomScriptExtension",
                "typeHandlerVersion": "1.8",
                "autoUpgradeMinorVersion": true,
                "settings": {
                    "fileUris": [
                        "https://XXXXXXXXXXX.blob.core.windows.net/powershelscripts/sqlcluster/InstallAdditionalModules.ps1"
                    ]
                },
                "protectedSettings": {
                    "commandToExecute": "powershell.exe -ExecutionPolicy Unrestricted ./sqlcluster/InstallAdditionalModules.ps1",
                    "storageAccountName": "sdfsdfsdfsdf",
                    "storageAccountKey": "sdsdfsdf/BH9C+fdgdfgdfgdfg+fgdfgdfg=="
                }
            },
            "copy": {
                "name": "WinFeatures",
                "count": 3
            }
        },
        {
            "apiVersion": "2015-06-15",
            "type": "Microsoft.Compute/virtualMachines/extensions",
            "name": "[concat(variables('varnodeNamePrefix'),copyindex(1),'/joindomain')]",
            "location": "[resourceGroup().location]",
            "dependsOn": [
                "[resourceId('Microsoft.Compute/virtualMachines/extensions',concat(variables('varnodeNamePrefix'),copyindex(1)),'cse')]"
            ],
            "properties": {
                "publisher": "Microsoft.Compute",
                "type": "JsonADDomainExtension",
                "typeHandlerVersion": "1.3",
                "autoUpgradeMinorVersion": true,
                "settings": {
                    "Name": "yyy.zzz",
                    "User": "[concat('xxx', '\\', 'xxx')]",
                    "Restart": "true"
                },
                "protectedSettings": {
                    "Password": "xxx"
                }
            },
            "copy": {
                "name": "joindomain",
                "count": 3
            }
        }
    ]
}

完整的工作示例:(基本上与上面写的相同)

谢谢。。这就是我所困惑的。。我将自定义扩展名命名为concat(variables('varnodeNamePrefix')、copyindex(1)、'/joindomain')。我的理解(您知道这是错误的)是主资源名称是我们应该在依赖资源中使用的名称。。什么是段,我在哪里可以了解更多。好吧,段=介于
/
之间的任何内容,您的资源名称很好,它应该是这样的。错误在depends-depen参数中,就像我指定的sorry一样。我还是不明白你的意思。新azResourceGroupDeployment:10:27:37-错误:Code=InvalidTemplate;Message=部署模板验证失败:“模板中未定义资源”Microsoft.Compute/virtualMachines/XX-XXX-UKW-XXX/extensions/extensions”。有关用法的详细信息,请参阅。“。新azResourceGroupDeployment:10:51:49-错误:Code=InvalidTemplate;Message=部署模板验证失败:“第439行和第9列的模板资源“DI-DEV-XXX-DB1/joindomain”无效:资源标识符“DI-XXX-UKW-DB1/extensions”格式不正确。有关用法的详细信息,请参阅。。有关用法的详细信息,请参见“.”dependsOn“:[“[concat(variables('varnodeNamePrefix'),copyindex(1),'/extensions')]”,