0
votes

I am attempting to deploy a Azure Resource Template to a brand new Windows Server VM on Azure which includes a Microsoft.Powershell.DSC resource to the VM.

The DSC configuration file has been pushed to public accessible Azure Storage Blob container which I have verified can be downloaded from a browser accessing the URL.

After successfully deploying a new VM I added an extension sub-resource to execute the DSC configuration file stored in the Azure blob container mentioned above.

I cannot figure out why it is failing.

I execute the deployment using this command:

New-AzureRmResourceGroupDeployment `
    -Name $resourceDeploymentName `
    -ResourceGroupName $rscrcGrpName `
    -TemplateFile $templatePath `
    -TemplateParameterFile $parameterPath `
    -Verbose

Here is the error:

New-AzureRmResourceGroupDeployment : 3:56:46 PM - Resource Microsoft.Compute/virtualMachines 'DC1' 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 failed to install: 
Error unpacking 'DomainController-DSC.ps1'; verify this is a valid ZIP package.\nError details: Exception calling \"ExtractToDirectory\" with \"2\" 
argument(s): \"End of Central Directory record could not be found.\".\r\nMore information about the failure can be found in the logs located under 
'C:\\WindowsAzure\\Logs\\Plugins\\Microsoft.Powershell.DSC\\2.20.0.0' on the VM.\r\nTo retry install, please remove the extension from the VM first. \"."
      }
    ]
  }
}'
At line:1 char:1
+ New-AzureRmResourceGroupDeployment `
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet

New-AzureRmResourceGroupDeployment : 3:56:46 PM - VM has reported a failure when processing extension 'Microsoft.Powershell.DSC'. Error message: "The DSC 
Extension failed to install: Error unpacking 'DomainController-DSC.ps1'; verify this is a valid ZIP package.
Error details: Exception calling "ExtractToDirectory" with "2" argument(s): "End of Central Directory record could not be found.".
More information about the failure can be found in the logs located under 'C:\WindowsAzure\Logs\Plugins\Microsoft.Powershell.DSC\2.20.0.0' on the VM.
To retry install, please remove the extension from the VM first. ".
At line:1 char:1
+ New-AzureRmResourceGroupDeployment `
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet

New-AzureRmResourceGroupDeployment : 3:56:46 PM - Template output evaluation skipped: at least one resource deployment operation failed. Please list 
deployment operations for details. Please see https://aka.ms/arm-debug for usage details.
At line:1 char:1
+ New-AzureRmResourceGroupDeployment `
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet

New-AzureRmResourceGroupDeployment : 3:56:46 PM - Template output evaluation skipped: at least one resource deployment operation failed. Please list 
deployment operations for details. Please see https://aka.ms/arm-debug for usage details.
At line:1 char:1
+ New-AzureRmResourceGroupDeployment `
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet

Here is the VM Resource definition:

{
      "name": "[parameters('virtualMachineName')]",
      "type": "Microsoft.Compute/virtualMachines",
      "apiVersion": "2015-06-15",
      "location": "[parameters('location')]",
      "tags": {
        "displayName": "vm-DC1"
      },
      "dependsOn": [
        "[concat('Microsoft.Network/networkInterfaces/', parameters('networkInterfaceName'))]",
        "[concat('Microsoft.Storage/storageAccounts/', parameters('storageAccountName'))]",
        "[concat('Microsoft.Storage/storageAccounts/', parameters('diagnosticsStorageAccountName'))]"
      ],
      "properties": {
        "osProfile": {
          "computerName": "[parameters('virtualMachineName')]",
          "adminUsername": "[parameters('vmAdminUsername')]",
          "adminPassword": "[parameters('vmAdminPassword')]",
          "windowsConfiguration": {
            "provisionVmAgent": "true"
          }
        },
        "hardwareProfile": {
          "vmSize": "[parameters('virtualMachineSize')]"
        },
        "storageProfile": {
          "imageReference": {
            "publisher": "MicrosoftWindowsServer",
            "offer": "WindowsServer",
            "sku": "2012-R2-Datacenter",
            "version": "latest"
          },
          "osDisk": {
            "name": "[parameters('virtualMachineName')]",
            "vhd": {
              "uri": "[concat(concat(reference(resourceId(resourceGroup().name, 'Microsoft.Storage/storageAccounts', parameters('storageAccountName')), '2015-06-15').primaryEndpoints['blob'], 'vhds/'), parameters('virtualMachineName'), '2016812162929.vhd')]"
            },
            "createOption": "fromImage"
          },
          "dataDisks": [ ]
        },
        "networkProfile": {
          "networkInterfaces": [
            {
              "id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaceName'))]"
            }
          ]
        },
        "diagnosticsProfile": {
          "bootDiagnostics": {
            "enabled": true,
            "storageUri": "[reference(resourceId(resourceGroup().name, 'Microsoft.Storage/storageAccounts', parameters('diagnosticsStorageAccountName')), '2015-06-15').primaryEndpoints['blob']]"
          }
        }
      },
      "resources": [
        {
          "name": "Microsoft.Powershell.DSC",
          "type": "extensions",
          "location": "[parameters('location')]",
          "apiVersion": "2015-06-15",
          "dependsOn": [
            "[concat('Microsoft.Compute/virtualMachines/', parameters('virtualMachineName'))]"
          ],
          "tags": {
            "displayName": "dsc-DomainController"
          },
          "properties": {
            "publisher": "Microsoft.Powershell",
            "type": "DSC",
            "typeHandlerVersion": "2.9",
            "autoUpgradeMinorVersion": true,
            "forceUpdateTag": "1.0",
            "settings": {
              "configuration": {
                "url": "https://armstore0.blob.core.windows.net/dsc/DomainController-DSC.ps1.zip",
                "script": "DomainController-DSC.ps1",
                "function": "FileResourceDemo"
              },
              "configurationArguments": {
                "nodeName": "[parameters('virtualMachineName')]"
              }

            }
          }
        }
      ]
    }
1
Not sure this is related but your template passes in a configArg that is not accepted by the script. Try removing that and see if it helps. Also, there is a "hello world" sample here that might help: github.com/bmoore-msft/AzureRM-Samples/tree/master/…bmoore-msft

1 Answers

0
votes

It could be some network glitch. Have you tried deploying the template again?