1

I am working on developing post-deployment Pester validation script for my project. I need to push pester scripts into the VM as custom script extension using Azure CLI.

Following is the command I executed:

az vm extension set --resource-group SomeRG--vm-name SimpleVM --name 
customScript --publisher Microsoft.Azure.Extensions --settings '{"fileUris": 
["https://github.com/myname/DSCConfig/blob/master/pester.ps1"], 
"commandToExecute":"powershell -ExecutionPolicy Unrestricted -File 
pester.ps1"}'  --version 2.0

and I got the below error in the Linux interface after executing above command:

Deployment failed. Correlation ID: 8ba16fc0-fea6-4650-bb0a-2b73c9613dfe. Handler 'Microsoft.Azure.Extensions.customScript' has reported failure for VM Extension 'customScript' with terminal error code '1007' and error message: 'Install failed for the plugin (name: Microsoft.Azure.Extensions.customScript, version 2.0.6) with exception The specified executable is not a valid application for this OS platform.'

And while checking the extension on VM saw the status as "Transitioning " and details as Install failed for the plugin (name: Microsoft.Azure.Extensions.customScript, version 2.0.6) with exception The specified executable is not a valid application for this OS platform)

Alternatively I tried with other publishers: Microsoft.Compute and Microsoft.OSTCExtensions

Unfortunately, none of them worked. I have been stuck at this step for past two days. Any help is much appreciated.

2
  • The error seems to suggest that your target VM is not a Windows machine, but rather some other OS where Windows PowerShell is not supported. If this is the case there is now PowerShell Core that is cross-platform but I don't personally know if you can use it via custom script extensions yet. Commented Jul 18, 2018 at 8:26
  • Thanks for your input Mark. But the VM I am trying to access is a simple VM configured on windows OS. I have used Microsoft.Azure.Extensions which is throwing the error " 'Install failed for the plugin (name: Microsoft.Azure.Extensions.customScript, version 2.0.6) with exception The specified executable is not a valid application for this OS platform.'" Commented Jul 19, 2018 at 8:59

1 Answer 1

2

I think you might be using the wrong custom script extension (the one you are using I believe is for Linux VMs). I think you should be using the one named "CustomScriptExtension" with a publisher of "Microsoft.Compute" and version set to "1.9" as documented here.

Specifically, try this command instead:

az vm extension set --resource-group SomeRG--vm-name SimpleVM --name CustomScriptExtension --publisher Microsoft.Compute --settings '{"fileUris": ["https://github.com/myname/DSCConfig/blob/master/pester.ps1"], "commandToExecute":"powershell -ExecutionPolicy Unrestricted -File pester.ps1"}' --version 1.9
Sign up to request clarification or add additional context in comments.

1 Comment

Awesome, I got the fix for the error now. As you rightly mentioned I tried publisher as micosoft.compute with name as CustomScriptExtension and it worked like a charm. Thankslot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.