Upload And Run PowerShell Script from Azure Cloud Shell

In this blog post, I will show you how to upload and run PowerShell scripts from Microsoft Azure Cloud Shell.

Cloud Shell

Azure Cloud Shell gives us great flexibility because we can store our scripts and run them from a cloud location.

Cloud Shell does not depend on the local machine, which is excellent for saving scripts and run them from anywhere.

In my case, I am going to upload a basic PowerShell script to Cloud Shell and show you how to run it.

Upload Script

To upload a script to Cloud Shell, I will use the upload button from the Cloud Shell menu.

You can also notice that I have the option to Upload and Download files.

To upload a file, I will click on Upload and select the PS1 script from my local machine.

When the upload is completed, I will see the complete message below.

Run Script from Azure Cloud Shell

Running uploaded scripts from Azure Cloud Shell can only be done from the $HOME folder.

To access the $HOME I type the following command.

cd ~

I can also use the command below:


Once in the home drive, I can run my PowerShell script using.


AZURE CLI and Other Scripts

This process will work with any scripting language that Azure Cloud Shell supports.