I am trying to deploy Virtual Machine Scale Set to Azure using ARM Template and Desired State Configuration (DSC). I have created DSC configuraiton and validated it on a separate VM that it is working. In ARM template I have following definition of DSC extension:
{
"name": "Microsoft.Powershell.DSC",
"properties": {
"publisher": "Microsoft.Powershell",
"type": "DSC",
"typeHandlerVersion": "2.9",
"autoUpgradeMinorVersion": true,
"settings": {
"configuration": {
"url": "publicstoragebloburi/DSC/DSC.zip",
"script": "Main.ps1",
"function": "Main"
},
"configurationArguments": {
"MachineName": "localhost",
"WebDeployPackagePath": PublicStorageBlobPath_App.zip",
"UserName": "[parameters('adminUsername')]",
"Password": "[parameters('adminPassword')]",
"AppName": "FileScanApp",
"AppPath": "C:\\inetpub\\dev\\MyWebApp"
}
}
Main.ps1 file and also Configratuion with name Main do exist. Main.ps1 is located in the root directory of the ZIP Archive. When the extension is running on the VM, it is trying to locate Main.ps1 file in following directory: C:\Packages\Plugins\Microsoft.Powershell.DSC\2.71.1.0\bin..\DSCWork\DSC.1\Main.ps1 , but when I remoted to the machine the Main.ps1 is not present in the folder and I am getting following error:
{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug for usage details.","details":[{"code":"Conflict","message":"{\r\n \"status\": \"Failed\",\r\n \"error\": {\r\n \"code\": \"ResourceDeploymentFailure\",\r\n \"message\": \"The resource operation completed with terminal provisioning state 'Failed'.\",\r\n \"details\": [\r\n {\r\n \"code\": \"VMExtensionProvisioningError\",\r\n \"message\": \"VM has reported a failure when processing extension 'Microsoft.Powershell.DSC'. Error message: \\"The DSC Extension received an incorrect input: An error occurred while executing script or module 'Main.ps1': The term 'C:\\Packages\\Plugins\\Microsoft.Powershell.DSC\\2.71.1.0\\bin\\..\\DSCWork\\DSC.1\\Main.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again..\nPlease correct the input and retry executing the extension.\\".\"\r\n }\r\n ]\r\n }\r\n}"}]}
Please can somebody tell me, what am I doing wrong? I was following the way, this is implemented within the official sample ARM templates available on github. Thank you!