Get Started With Azure Cloud Shell

Azure Cloud Shell is a command line interface to work with Azure resources for different administrative tasks. If you are not an administrator, a developer or don’t like to work with scripting or commands then this tool is not for you. You still can continue to work the Azure portal UI interface.

It works within the browser itself. You can open it from your already authenticated Azure session itself simply by clicking on the icon as highlighted below in the snapshot –

…or you can navigate to to authenticate separately to the shell session.

In either case, this will ask you whether you want to work with Bash commands or PowerShell commands

Before we proceed further, let’s take a pause and understand what it does when you start a session and how much does it cost –

Anything that runs on Azure is eventually running on some compute behind the scenes and this is true for this cloud shell as well. However, the compute where this runs is fully managed by Microsoft and is completely hidden from you. There is NO cost for this compute. It is free of cost.

As soon as you select your preferred environment (Bash or PowerShell), you may see the following pop-up

Tip: Though it seems like a text box for Subscription but it behaves like a drop-down. You can click inside the text box and select another subscription.

Further, you can go to advanced settings to select the region, resource group and storage account.

Storage account and in fact file storage is needed to persist your scripting files across the sessions i.e. when you log out and come back later, you don’t lose your scripts.

As soon as storage account gets created, your cloud shell session also gets started –

You can also check which storage account is currently mounted to your session as –

You can see that I started with PowerShell but you can switch it to Bash too as shown in the terminal menu. Let us switch to Bash for a moment and see how it looks like –

df is an alternate to PowerShell’s Get-CloudDrive command in Bash to check currently mounted file storage system.

If you are familiar with Azure CLI commands, you can use them here as well irrespective of the environment. They work in both Bash and PowerShell environments. e.g.

Also, it suggests you if you type in a wrong command e.g.

We are not going into the depth of commands in this post but the whole purpose of this article was to share that Azure Cloud Shell gives you a good platform to manage/interact with your Azure account/resources on cloud terminal itself without needing you to setup a command line interface on your desktop. Moreover, compute is free though storage cost is what you have to borne.

So, it’s one of the fastest ways to get started with the commands within the browser itself.

Just before to conclude the post, it is worth to highlight that since you are not charged for the compute so you can not continue to hold the session if you are not actively working with it. Your session gets timed out if you are idle for 20 minutes

Note that only shell session has timed out. If you were logged into the Azure portal, that session is not impacted by this.

Many thanks for reading!

Leave a Reply