Quantcast
Channel: Azure Virtual Machines forum
Viewing all articles
Browse latest Browse all 12545

VM Extension CustomScriptExtension runs powershell script from Azure Portal but fails from Azure Powershell

$
0
0

I want to automate the launch of Azure VMs from CLI. 

I’m attempting to run VM Extension CustomScriptExtension to run a powershell script to configure the box rather than having a user login to the newly launched Windows VM.

As you know automation from CLI will help with many use cases such as Continuous Integration or developer self-service.

 

The CustomScriptExtension works great from the Azure portal.  I just click on the checkbox to enable it, and specify the powershell script located on the Azure storage container and it will run on the VM after it boots up.   It succeeds with exit code of 0.

 

 

What I need help on is calling the CustomScriptExtension from command line via the Azure Powershell.   I’m using azure-xplat-cli to create an Azure Windows VM from the CLI, and everything works (from VM launch encompassing cloud service creation and role creation, to endpoint creation, endpoint ACL creation, enabling CustomScriptExtension on the VM).  When I then try to use Azure Powershell to run CustomScriptExtension it fails.

 

It appears CustomScriptExtension works, the script is downloaded, but it fails with exit code 1.

However, if I run the same script manually on the command line, it succeeds. 

 


Viewing all articles
Browse latest Browse all 12545

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>