ARM部署失败,DSC扩展模板错误

时间:2017-02-17 13:05:53

标签: azure deployment

我有ARM部署模板,其中包含具有DSC扩展名的VM资源

"resources": [
        {
          "name": "Microsoft.Powershell.DSC",
          "type": "extensions",
          "location": "[resourceGroup().location]",
          "apiVersion": "2015-06-15",
          "dependsOn": [
            "[resourceId('Microsoft.Compute/virtualMachines', parameters('appVMName'))]"
          ],
          "tags": {
            "displayName": "appDSC"
          },
          "properties": {
            "publisher": "Microsoft.Powershell",
            "type": "DSC",
            "typeHandlerVersion": "2.9",
            "autoUpgradeMinorVersion": true,
            "forceUpdateTag": "[parameters('appDSCUpdateTagVersion')]",
                    "settings": {
                        "configuration": {
                            "url": "[parameters('dscArchiveUrl')]",
                            "script": "appDSC.ps1",
                            "function": "Main"
                        },
                    "configurationArguments": {
                        "nodeName": "[parameters('appVMName')]",
                        "webDeployPackage": "[parameters('appWebPackage')]",
                        "backgroundServicePackage": "[parameters('backgroundServicePackage')]"
                    }
            }
          }
        }
      ]

我第一次执行它时设法完成了这项工作,但现在它响应错误:

15:37:17 - Resource Microsoft.Compute/virtualMachines 'Unique-InApp' failed with message '{
  "status": "Failed",
  "error": {
    "code": "ResourceDeploymentFailure",
    "message": "The resource operation completed with terminal provisioning state 'Failed'.",
    "details": [
      {
        "code": "VMExtensionProvisioningError",
        "message": "VM has reported a failure when processing extension 'Microsoft.Powershell.DSC'. Error message: \"The
 DSC Extension received an incorrect input: Configuration.url requires that configuration.script is specified.\nPlease c
orrect the input and retry executing the extension.\"."
      }
    ]
  }
}'

如您所见,我显然将script置于configuration,但由于某种原因,ARM部署脚本无法识别它。 我想,这只是错误的错误信息,我有不同的问题,但没有适当的诊断信息,我无法理解它。 那么问题是什么以及如何解决它?

1 个答案:

答案 0 :(得分:0)

查看this示例和schema似乎您做错了。

我没有看到DSC扩展的scriptfunction属性,而是看到configurationFunction属性,它应该采用与此类似的值:

ContosoWebsite.ps1\\ContosoWebsite

第二个斜杠用于转义第一个斜杠;)