iteong
iteong

Reputation: 735

Problems deploying DSC Extension for Azure Resource Manager template

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”
    }

  }
} 

Upvotes: 1

Views: 1090

Answers (2)

mrptsai
mrptsai

Reputation: 125

When using the VM Extension to apply a DSC Configuration via ARM Templates, the Node parameter must always be localhost.

When pulling DSC configuration from Azure Automation, this is when you can using variables and do some fancy work to determine what Node receives what configuration.

Upvotes: 4

CtrlDot
CtrlDot

Reputation: 2513

After a chat with various parties, we ended up removing the

      "configurationArguments": {
    "nodeName": "[variables('vmNameSQL')]"
  }

From the ARM template and removed the

param ([string[]]$NodeName = 'localhost')

From the DSC configuration. We also set the Node to "localhost".

@iteong was able to test this new configuration and it worked.

Another point to add is the full error message was different than what was shown above:

[ERROR] A parameter cannot be found that matches parameter name 'nodeName'.\n\nAnother common error is to specify parameters of type PSCredential without an explicit type.

Upvotes: 5

Related Questions