Did you know the Azure Cloud Shell includes support for Python? You can write Python scripts, save then, upload, and run them directly within the Azure Cloud Shell. This offers the ability to do more than just Bash or PowerShell scripting in the Cloud Shell, but also utilize the full power of the Python programming language directly in the Azure Cloud Shell.

Python Scripting in the Azure Cloud Shell 1
Screenshot: Python within Azure Cloud Shell

There are a couple ways to open the Azure Cloud Shell, and either way can be used to start Python scripting within a web browser on any machine:

  1. Open the Azure Portal (at https://portal.azure.com), then click the “Cloud Shell” icon in the top-right of the UI.
  2. Open the Azure Cloud Shell directly at https://shell.azure.com
  3. Using the Azure Portal Mobile App on your Android or iOS smartphone. (Yes, that’s correct, Cloud Shell scripting can be done on your smartphone too!)

The Azure Cloud shell includes several built-in tools all ready for you to begin using. Among these tools includes Python. You can simply call the python executable and begin executing your Python scripts directly within the Azure Cloud Shell. Sure, you can always install and use Python locally, however the Azure Cloud Shell offers an environment that can be used from any machine regardless of local installation of tooling.

It’s worth mentioning that if you have an Azure Subscription, the Azure Cloud Shell is completely Free to use. You do not incur any charges for using it, and you do not need to spin up any VMs, Containers, or other compute resources to use it. Microsoft hosts an Ubuntu Server Docker Container within Azure for you on-demand that is used to power the Azure Cloud Shell which includes several tools (like Python, Terraform, Azure CLI, and more!) waiting for you to use for your scripting needs.

Happy Python scripting in the Microsoft Azure cloud!

Microsoft MVP

Chris Pietschmann is a Microsoft MVP, HashiCorp Ambassador, and Microsoft Certified Trainer (MCT) with 20+ years of experience designing and building Cloud & Enterprise systems. He has worked with companies of all sizes from startups to large enterprises. He has a passion for technology and sharing what he learns with others to help enable them to learn faster and be more productive.
HashiCorp Ambassador Microsoft Certified Trainer (MCT) Microsoft Certified: Azure Solutions Architect