Azure / azure-quickstart-templates

Azure Quickstart Templates
https://aka.ms/azqst
MIT License
14.09k stars 16.14k forks source link

Problems deploying DSC Extension for Azure Resource Manager template #3605

Open iteong opened 7 years ago

iteong commented 7 years ago

I'm trying to deploy the Azure Resource Manager template for Windows Virtual Machines' provisioning.

Currently, I'm bootstrapping the IIS Powershell script to the DSC Module to set up IIS for a Windows virtual machine provisioned through ARM.

I keep getting this error related to WinRM:

New-AzureRmResourceGroupDeployment : 5:04:53 PM - Resource Microsoft.Compute/virtualMachines/extensions 'vmSVX-TESTAU-SQL1/dscExtension' 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 'dscExtension'. Error message: \"DSC Configuration 'vmDSC' completed with error(s). 
Following are the first few: The WinRM client cannot process the request. If the authentication scheme is different from Kerberos, or if the client computer is not joined to a domain, then HTTPS transport must be used or the destination machine must be added to the TrustedHosts configuration setting. Use winrm.cmd to 
configure TrustedHosts. Note that computers in the TrustedHosts list might not be authenticated. You can get more information about that by running the following command: winrm help config.\"."
      }
    ]
  }
}'

The ARM Template related to the provisioning of this VM:

{
  "apiVersion": "2016-03-30",
  "type": "Microsoft.Compute/virtualMachines/extensions",
  "name": "[concat(variables('vmNameSQL'), '/', 'dscExtension')]",
  "location": "[variables('location')]",
  "dependsOn": [
    "[concat('Microsoft.Compute/virtualMachines/', variables('vmNameSQL'))]"
  ],
  "properties": {
    "publisher": "Microsoft.Powershell",
    "type": "DSC",
    "typeHandlerVersion": "2.9",
    "autoUpgradeMinorVersion": true,
    "settings": {
      "configuration": {
        "url": "[variables('dscModulesUrl')]",
        "script": "[concat(variables('dscFunction'),'.ps1')]",
        "function": "[variables('dscFunction')]"
      },
      "configurationArguments": {
        "nodeName": "[variables('vmNameSQL')]"
      }
    },
    "protectedSettings": {
      "configurationUrlSasToken": "[parameters('_artifactsLocationSasToken')]"
    }
  }
}

As for the IIS powershell script that has been bootstrapped:

Configuration WindowsFeatures
{
  param ([string[]]$NodeName = 'localhost')

  Node $NodeName
  {
    #Install the IIS Role
    WindowsFeature IIS
    {
      Ensure = “Present”
      Name = “Web-Server”
    }

  }
} 
ashleywb commented 7 years ago

Hi, did you ever resolve this? I've started to get the same error. Thanks