New-AzureRmResourceGroupDeployment Command not recognizing the JSON paramaters file - powershell

I have a JSON parameters file that looks like this.
"parameters": {
"field_1": {
"value": "abc"
},
"field_2": {
"value": 123
},
and I am using the below command to create resources in Azure
New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateFile $templateFilePath -TemplateParameterFile $parametersFilePath
when I run it, for some reason it's not recognizing the parameters that are in the parameters file. It asks me to enter the parameters individually in powershell and then after I enter all of them I get the below error:
New-AzureRmResourceGroupDeployment : 4:07:58 PM - Error: Code=InvalidDeploymentParameterValue; Message=The value of deployment parameter 'parameters' is null. Please specify the value or use the parameter reference. See
https://aka.ms/arm-deploy/#parameter-file for details.
At line:52 char:4
+ New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGro ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet
I am not sure what I am doing wrong. Any help would be greatly appreciated.

Well, it should not recognize it, if you look at the Azure Quickstart templates repository, most of those have parameter files, all of them have a proper structure, while yours don't, here's how a proper parameter file looks like:
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"adminUsername": {
"value": "ghuser"
},
"adminPassword": {
"value": "GEN-PASSWORD"
},
"dnsLabelPrefix": {
"value": "GEN-UNIQUE"
}
}
}
Reference: https://github.com/Azure/azure-quickstart-templates

Related

update/create TFS Server variable group using REST API with powershell gives object reference not set

Allright i have been fiddling with this for a few hours now and i can't seem to find any resources online or solve the issue.
Looking at the api documentation at https://learn.microsoft.com/en-us/rest/api/azure/devops/distributedtask/variablegroups/get?view=azure-devops-rest-6.0
I can get info regarding the variable group that i created as a test:
$invRestMethParams = #{
Uri = "https://xxx.xxx.nl/tfs/DefaultCollection/$($project)/_apis/distributedtask/variablegroups/242/?api-version=6.0-preview.2"
Method = 'GET'
ContentType = 'application/json'
}
Invoke-RestMethod #invRestMethParams -UseDefaultCredentials
I then convert the result to json to get the required values for the PUT or POST to update or create:
{
"variables": {
"check": {
"value": "value"
}
},
"id": 242,
"type": "Vsts",
"name": "TestUpdate",
"description": "",
"isShared": false,
"variableGroupProjectReferences": [
{
"projectReference": "#{id=0add8cd8-0fc8-4aca-8eb4-164cd8d09c9d; name=AutoUpdateVariableGroups}",
"name": "TestUpdate",
"description": ""
}
]
}
The documentation states the update url is:
PUT https://{instance}/{collection}/_apis/distributedtask/variablegroups/{groupId}?api-version=6.0-preview.2
With request body having the above json values (without the ID as this is in the URI). So my update json becomes:
$body = #"
{
"variables": {
"checkupdated": {
"value": "valueupdated"
}
},
"type": "Vsts",
"name": "TestUpdate",
"description": "",
"isShared": false,
"variableGroupProjectReferences": [
{
"projectReference": "#{id=0add8cd8-0fc8-4aca-8eb4-164cd8d09c9d; name=AutoUpdateVariableGroups}",
"name": "TestUpdate",
"description": ""
}
]
}
"#
i convert it from json to see if its valid (no errors).
and use it in my PUT request:
$invRestMethParams = #{
Uri = "https://xxx.xxx.nl/tfs/DefaultCollection/_apis/distributedtask/variablegroups/242/?&api-version=6.0-preview.2"
Method = 'PUT'
ContentType = 'application/json'
Body = $body
}
Invoke-RestMethod #invRestMethParams -UseDefaultCredentials
The error i receive is:
Invoke-RestMethod : {"$id":"1","innerException":null,"message":"Object reference not set to an instance of an object.","typeName":"System.NullReferenceException, mscorlib","typeKey":"NullReferenceException","errorCode":0,"eventId":0}
At line:32 char:1
+ Invoke-RestMethod #invRestMethParams -UseDefaultCredentials
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
Not sure how to troubleshoot this, does anyone know how to fix this issue? seems i am forgetting a value but im kinda lost as to what is the issue here.
From your script, it seems that it has issue with your request body.
In projectReference field, you need to use , to replace the ; and you need to modify the format.
"projectReference": {"id":"projectID", "name":"projectname"},
Refer to my sample:
$JSON = #"
{
"variables": {
"checkupdate": {
"value": "vaslueupdate"
}
},
"type": "Vsts",
"name": "AA",
"description": "",
"isShared": false,
"variableGroupProjectReferences": [
{
"projectReference": {"id":"108e4d7c-0bf3-4940-80da-4793f83def92", "name":"kevin1012"},
"name": "AA",
"description": ""
}
]
}
"#

Cannot pass an array type parameter in ARM template via Powershell

I have an ARM Template with the following parameters:
"parameters": {
"projectName": {
"type": "string",
"metadata": {
"description": "Name of the project"
}
},
"environmentName": {
"type": "string",
"defaultValue": "testing",
"metadata": {
"description": "Name/Type of the environment"
}
},
"vmResourceGroupName": {
"type": "string",
"metadata": {
"description": "Resource Group in which VMs wil be deployed"
}
},
"vmName": {
"type": "string",
"metadata": {
"description": "Name of the Virtual Machine"
}
},
"vmIPAddress": {
"type": "string",
"metadata": {
"description": "IP Address of the Virtual Machine"
}
},
"osDiskVhdUri": {
"type": "string",
"metadata": {
"description": "Uri of the existing VHD in ARM standard or premium storage"
}
},
"dataDiskVhdUri": {
"type": "array",
"metadata": {
"description": "Uri of the existing VHD in ARM standard or premium storage"
}
},
"vmSize": {
"type": "string",
"metadata": {
"description": "Size of the Virtual Machine"
}
},
"osType": {
"type": "string",
"allowedValues": [
"Windows",
"Linux"
],
"metadata": {
"description": "OS of the VM - Typically Windows or Linux"
}
},
"ManagedDisk": {
"type": "string",
"allowedValues": [
"Yes",
"No"
],
"metadata": {
"description": "Yes for Managed Disks, No for VHDs"
}
}
As evident, $dataDiskVHDURI is of type:array and I am trying to deploy the template using -TemplateParameterObject with New-AzureRMresourceGroupDeployment cmdlet in Powershell using the following code:
{
$vmWithDDTemplate = 'azuredeploy.json'
$vmWithoutDDTemplate = 'azuredeploy-withoutdd.json'
$dataDiskVhdUri = New-Object -TypeName System.Collections.ArrayList
$dataDiskVhdUri.Add("$VM.dataDiskVhduri")
#Creating VM param object
$VMTemplateObject = #{"projectname" = $projectName; `
"environmentname" = $environmentName; `
"vmResourceGroupName" = $vmResourceGroupName; `
"vmName" = $VM.vmName; `
"vmIPAddress" = $VM.vmIPAddress; `
"osDiskVhdUri" = $VM.osDiskVhdUri; `
"dataDiskVhdUri" = ,$dataDiskVhdUri; `
"vmSize" = $VM.vmSize; `
"osType" = $VM.osType; `
"ManagedDisk" = $VM.ManagedDisk
}
#$VMTemplateObject
# Checking if VM contains a data disk
if($VM.dataDiskVhdUri -ne $null)
{
Write Output "$VM contains data disk"
New-AzureRmResourceGroupDeployment -Name ('vmwithdd' + '-' + ((Get-Date).ToUniversalTime()).ToString('MMdd-HHmm')) `
-ResourceGroupName $ResourceGroupName `
-TemplateParameterObject $VMTemplateObject `
-TemplateFile $vmWithDDTemplate `
-Force -Verbose -ErrorVariable ErrorMessages `
-ErrorAction Stop -DefaultProfile $azureCred
}
else
{
Write-output '$VM does not contain data disk'
}
}
However, I get the following error every time:
Microsoft.PowerShell.Utility\Write-Error : 4:46:14 PM - Error:
Code=InvalidTemplate; Message=Deployment template validation failed:
'The provided value for the template parameter 'dataDiskVhdUri' at
line '44' and column '27' is not valid.'. At Create-Environment:73
char:73
+
+ CategoryInfo : NotSpecified: (:) [Write-Error], RemoteException
+ FullyQualifiedErrorId : System.Management.Automation.RemoteException,Microsoft.PowerShell.Commands.WriteErrorCommand
+ PSComputerName : [localhost]
Does anyone know how to resolve this?
Not sure, but maybe feeding it with an ArrayList object wrapped in an array by use of the preceeding , is not what it wants. If i lookup examples, i see only single values added there like "dataDiskVhdUri" = $VM.dataDiskVhduri;
Try this:
$OptionalParameters = New-Object -TypeName Hashtable
$OptionalParameters.Add("aParam", #(1,2,3))
New-AzureRmResourceGroupDeployment -ResourceGroupName $ResourceGroupName `
-TemplateFile azuredeply.json `
#OptionalParameters
With:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"aParam": {
"type": "array"
}
},
"variables": { },
"resources": [ ],
"outputs": {
"dump": {
"type": "array",
"value": "[parameters('aParam')]"
}
}
}

Override template parameter in the script

I am deploying VMs using a template and parameter file. I would like to override the parameter files virtualMachineName, so I can dynamically name each VM without needing 10 different parameter files. What is the correct syntax to do so?
Currently I have:
New-AzureRmResourceGroupDeployment -ResourceGroupName "myRSG" -TemplateFile $server1TmpFile -TemplateParameterFile $serverParamFile -virtualMachineName "AS1FTW12" -networkInterfaceName "AS1FTW12NIC" -networkSecurityGroupName "MyNSGName"
This will produce an error:
New-AzureRmResourceGroupDeployment : A parameter cannot be found that matches parameter name 'virtualMachineName'
I am authoring the script using PowerShell Tools for Visual Studio 2017. My installed PowerShell AzureRM version is 5.1.1 according to Get-Module AzureRM.
This Works with AzureRM 5.1.1, you can test with the following setup:
template:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"paramTest": {
"type": "string"
}
},
"resources": [],
"outputs": {
"result": {
"type": "string",
"value": "[parameters('paramTest')]"
}
}
}
parameters:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"paramTest": {
"value": "GEN-UNIQUE"
}
}
}
Powershell:
New-AzureRmResourceGroupDeployment -ResourceGroupName rg -TemplateFile template.json -TemplateParameterFile param.json -paramTest somevalue
results in output value equal to the one passed from powershell
Your error indicates that the parameter name is wrong, doublé check it

Azure nested template deployment: Using template element (not templateLink) with PowerShell

In an attempt to make life easier (in the long run), I'm trying to use properties.template, as opposed to the well documented properties.templateLink. The former has very little documentation by passing the contents of child.json template file into the parent.json template, as a template' parameter.
From the MS documentation for Microsoft.Resources/deployments:
The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a JObject or well-formed JSON string. Use either the templateLink property or the template property, but not both.
In my parent template, I am declaring the parameter childTemplates and referencing it in properties.template:
"parameters": {
"childTemplates": {
"type": "object",
"metadata": {
"description": "Child template"
}
}
}
other stuff...
"resources": [
{
"name": "[concat('linkedTemplate-VM-Net-',copyIndex(1))]",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2017-06-01",
"dependsOn": [],
"copy": {
"name": "interate",
"count": "[parameters('vmQty')]"
},
"properties": {
"mode": "Incremental",
"template": "[parameters('childTemplates')]",
"parameters": {
"sharedVariables": { "value": "[variables('sharedVariables')]" },
"sharedTemplate": { "value": "[variables('sharedTemplate')]" },
"artifactsLocationSasToken": { "value": "[parameters('artifactsLocationSasToken')]" },
"adminPassword": { "value": "[parameters('adminPassword')]" },
"copyIndexValue": { "value": "[copyIndex(1)]" }
},
"debugSetting": {
"detailLevel": "both"
}
}
}
],
I then pass the child template to New-AzureRmResourceGroupDeployment -TemplateParameterObject to deploy the parent template:
$TemplateFileLocation = "C:\Temp\templates\parent.json"
$JsonChildTemplate = Get-Content -Raw (Join-Path ($TemplateFileLocation | Split-Path -Parent) "nestedtemplates\child.json") | ConvertFrom-Json
$TemplateParameters = #{
childTemplates = $JsonChildTemplate
...Other parameters...
}
New-AzureRmResourceGroupDeployment -TemplateParameterObject $TemplateParameters
This produces the following error:
Code : InvalidTemplate
Message : The nested deployment 'linkedTemplate-VM-Net-1' failed validation: 'Required property '$schema' not found in JSON. Path 'properties.template'.'.
Target :
Details :
If I look at $JsonChildTemplate, it gives me:
$schema : https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#
contentVersion : 1.0.0.0
parameters : #{sharedVariables=; sharedTemplate=; vhdStorageAccountName=; artifactsLocationSasToken=; adminPassword=; copyIndexValue=}
variables : #{seqNo=[padleft(add(parameters('copyIndexValue'),3),3,'0')]; nicName=[concat('NIC-',parameters('sharedVariables').role,'-', variables('seqNo'),'-01')];
subnetRef=[parameters('sharedVariables').network.subnetRef]; ipConfigName=[concat('ipconfig-', variables('seqNo'))]}
resources : {#{apiVersion=2016-03-30; type=Microsoft.Network/networkInterfaces; name=[variables('nicName')]; location=[resourceGroup().location]; tags=; dependsOn=System.Object[];
properties=}}
outputs : #{nicObject=; vmPrivateIp=; vmNameSuffix=; vmPrivateIpArray=}
To me, it looks like the $schema is there.
I have also tried removing | ConvertFrom-Json with the same error.
Above, I am showing the latest API version, but I have tried with others such as 2016-09-01, just in case there's a bug.
In my search for a solution, I found this issue on GitHub. The recomendation is to remove $schema and contentVersion, although this flies in the face of the error. I tried this with the following:
Function Get-ChildTemplate
{
$TemplateFileLocation = "C:\Temp\templates\nestedtemplates\child.json"
$json = Get-Content -Raw -Path $TemplateFileLocation | ConvertFrom-Json
$NewJson = #()
$NewJson += $json.parameters
$NewJson += $json.variables
$NewJson += $json.resources
$NewJson += $json.outputs
Return $NewJson | ConvertTo-Json
}
$JsonChildTemplate = Get-ChildTemplate
$TemplateParameters = #{
childTemplates = $JsonChildTemplate
...Other parameters...
}
$JsonChildTemplate returns:
[
{
"sharedVariables": {
"type": "object",
"metadata": "#{description=Object of variables from master template}"
}...
My guess is that I have done something wrong passing child.json's contents to New-AzureRmResourceGroupDeployment. That or it's not actually possible to do what I'm trying to do.
P.S.
get-command New-AzureRmResourceGroupDeployment
CommandType Name Version Source
----------- ---- ------- ------
Cmdlet New-AzureRmResourceGroupDeployment 4.1.0 AzureRM.Resources
First of all, what you are doing makes 0 sense what so ever, that being said, lets try to help you.
Try splatting. so do New-AzureRmResourceGroupDeployment ... #TemplateParameters instead of what you are doing. (no idea, but somehow it works better in my experience)
If that doesn't work directly try simplifying you nested template to the bare minimum and see if it works if it does, check if your nested template is fine.
Try creating a deployment with -Debug switch and see where that goes.
Try the same deployment using Azure Cli (maybe it converts json to input object in a proper way)
Skip items 1-4 and do it the proper way. I would advice never do preprocessing\in flight generation of ARM Templates. They have enough of features already to accomplish anything if you are smart hacky enough. I have no idea what you are trying to achieve but I can bet my life on it you don't need that monstrosity you are trying to create
small template example:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"resources": []
}
EDIT: I dug a bit more and found a solution. one way to do it would be using the json() function of the arm template that accepts a string and converts to valid json.
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"inp": {
"type": "string"
}
},
"resources": [
{
"name": "NestedDeployment1",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"properties": {
"mode": "Incremental",
"template": "[json(parameters('inp'))]",
"parameters": {}
}
}
]
}
To deploy use something like this:
New-AzureRmResourceGroupDeployment ... -inp ((get-content path\to.json -raw) -replace '\s','')
# we minify the string so it gets properly converted to json
This is a bit of a hack, but the problem lies with how powershell converts your input to what it passes to the template, and you cannot really control that.
Another way to do that: (if you need output you can add another parameter)
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"input-param": {
"type": "object"
},
"input-resource": {
"type": "array"
}
},
"resources": [
{
"name": "NestedDeployment1",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": "[parameters('input-param')]",
"resource": "[parameters('input-resource')]"
},
"parameters": {}
}
}
]
}
and deploying like so:
New-AzureRmResourceGroupDeployment -ResourceGroupName zzz -TemplateFile path\to.json -input-param #{...} -input-resource #(...)
ps. don't mind walter, each time he says something can't be done or is impossible it actually is possible.

Failure when processing extension 'Microsoft.Powershell.DSC'

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')]"
}
}
}
}
]
}
It could be some network glitch. Have you tried deploying the template again?