Azure Cloud Shell: run Ubuntu Linux commands and apps

Decorative title image of

All product names, logos, and brands used in this post are property of their respective owners.

Looking for a free, secure, on-demand Linux VPS? Look no further than Azure Cloud Shell! Sort of.

When I think of Azure and PowerShell, the Windows operating system typically comes to mind. That is an old habit - Microsoft has made great strides over the past decade to ensure their technologies are more open and cross-platform compatible. With a cloud-native mindset (trying to reduce my dependence on local hardware and software), I began experimenting with executing my various processes and workloads using Azure Cloud Shell. I erroneously assumed the shell was delivered using a form of Windows, but it is not!

Azure Cloud Shell is powered by Ubuntu Linux 16.04 LTS (at time of writing):

Screenshot of Azure Cloud Shell output of the “uname -a” and “arch” commands - “Linux 5.4.0-1055-azure #57~18.04.1-Ubuntu SMP x86_64 GNU/Linux” and “x86_64” respectively

A second look at the tools and commands available in Azure Cloud Shell confirm this - all of these tools are either Linux-native or have ports that run on Linux (.NET Core, PowerShell Core, etc.).

I found that you can further extend Azure Cloud Shell’s functionality by adding your own pre-compiled Linux binaries. That transforms the service into an (almost) free, on-demand Linux VPS (virtual private server) of sorts. I have successfully “installed” and tested the following 3rd party applications in the cloud shell:

Screenshot of Azure Cloud Shell output of the “hugo version”, “ffmpeg -version”, and “aws –version” commands showing these 3rd party binaries installed in cloud shell

“Installing” is a matter of downloading the binary, copying it somewhere in your cloud shell home directory, and either adding the directory to $PATH OR using aliases in PowerShell - Set-Alias aws "/home/<username>/apps/aws-cli/v2/current/bin/aws"

Not all Linux applications will work in this way, but this opens up many possibilities nonetheless. For example, I have started to use Azure Cloud Shell for editing and publishing this blog. That process uses Hugo for content management and the AWS CLI to sync published content to Amazon S3 buckets. My entire blog and web maintenance workflow is now 100% cloud-based. Pretty slick!

Also worth noting, you can install additional PowerShell modules into the cloud shell, assuming they work with PowerShell Core (example: Pester - Install-Module -Name Pester -Force -SkipPublisherCheck).

If you skip your research, erroneously assuming cloud shell is powered by Windows (like me), and attempt to run a Windows binary (exe) in Azure Cloud Shell (or are missing the executable “x” permission on a Linux binary), you will receive error messages like the following:

ResourceUnavailable: Program '.exe' failed to run:
Exec format error
At line:1 char:1
ResourceUnavailable: Program '.exe' failed to run:
No such file or directory
At line:1 char:1

I just wanted to share and pass this along. Are you doing something similar with Azure Cloud Shell? Please comment - I am always interested in other’s processes and insights.