AZ-900-EN

【AZ-900】What is Azure Cloud Shell? Beginner’s Guide to Getting Started

【AZ-900】What is Azure Cloud Shell_ Beginner's Guide to Getting Started

Hi, I’m Makoto, a freelance engineer.

In this article, I’ll be explaining about Azure Cloud Shell.

While AWS also has Cloud Shell, Azure was the first to offer it. The first time I used Azure Cloud Shell, I was amazed:

How convenient this is!

It’s still one of the services I use the most.

What’s so convenient about it? To answer such questions, I’ll give you an overview of the Azure Cloud Shell. Please read to the end.

Let’s get started!

What is Azure Cloud Shell?

Azure Cloud Shell is a browser-based command execution environment (shell tool) that allows you to instantly use an environment with commonly used command line tools and languages installed.

You can access it from the icon in the upper right corner of the Azure Portal or directly at shell.azure.com.

Cloushell icon

Key Points:

Because it’s browser-based, you can use it on PCs, tablets, and smartphones, regardless of operating system.

How to Use Azure Cloud Shell

When you start Azure Cloud Shell, you see a welcome screen that lets you choose your shell environment. You can choose between Bash and PowerShell. (Bash is a common command execution environment on Linux.)

Welcom to Azure Cloud Shell

Select whether or not to mount a storage account (file share), depending on whether or not you need to store data in the Azure Cloud Shell environment.

  • No storage account required
    • When you do not need to store data
    • You can start using it as soon as you move on to the next step
  • Mount storage account
    • When you need to store data
    • Select a subscription and continue

Getting started - Mount storage account When you select “Mount storage account”, you can either select an existing storage account or create a new one.

  • Select existing storage account
    • On the next screen, select an existing storage account name and file share
  • We will create a storage account for you
    • Storage accounts and file share are created automatically.
  • I want to create a storage account
    • On the next screen, enter the storage account name, resource group, file share, and region.
Select storage account

Reference:

If you select “We will create a storage account for you”, three resources including a storage account will be created automatically.

  • Resource group: cloud-shell-storage-<region>
  • Storage account: cs<uniqueGuid>
  • File share: cs-<user>-<domain>-com-<uniqueGuid>

Reference:

Around spring 2024, the “ephemeral session” feature was added, allowing use without a storage account. This is useful in scenarios where you don’t need to save files, such as when you just want to run commands quickly.

No storage account requiredSource: Get started with Azure Cloud Shell ephemeral sessions

The Azure Cloud Shell itself is free to use, but there is a small storage fee when you mount a storage account. For more information about storage accounts, see this article.

【AZ-900】What is Azure Storage_ Complete Guide to Data Services and Redundancy Options
【AZ-900】What is Azure Storage? Complete Guide to Data Services and Redundancy OptionsHi, I'm Makoto, a freelance engineer. In this article, I'll expla...

When Azure Cloud Shell starts, you’ll see a screen like this. In this example, it’s started with Bash.

There is a toolbar at the top of the screen, and you can switch between the Bash and PowerShell shell environments by clicking the button in the upper left corner.

Switch to Powershell

This is what it looks like when switched to PowerShell.

Power Shell environment

A virtual machine is running in the background, but you can immediately launch the command execution environment without even noticing the existence of the server.

It’s convenient because it’s easy to launch and start using right away.

Tools Available in Azure Cloud Shell

Azure Cloud Shell comes pre-installed with tools for managing Azure through command operations, such as Azure CLI and Azure PowerShell.

For more information about these two Azure tools, see this article.

【AZ-900】Azure CLI vs Azure PowerShell_ Understanding the Differences
【AZ-900】Azure CLI vs Azure PowerShell: Understanding the DifferencesHi, I'm Makoto, a freelance engineer. While Azure allows you to m...

In addition to Azure CLI and Azure PowerShell, commonly used tools, editors, and languages are also installed. It’s really convenient to be able to use them right out of the box from any device without any installation.

  • git
  • Docker
  • Terraform
  • Java
  • Python etc…

For details about the installed tools and languages, see the official documentation.

Storage Persistence Mechanism

Now, I’m going to add some information about the storage that is mounted on the Azure Cloud Shell, even though I don’t think it will be asked on the AZ-900 exam.

Azure Cloud Shell times out and disconnects the session after 20 minutes of inactivity. You can reconnect to start a new session and continue using it, but you might be wondering:

Will the files I save in Azure Cloud Shell disappear?

The answer is “No“.

In Azure Cloud Shell, a file share is mounted as the data storage destination, so data stored in the following locations is persisted (see the official documentation for details):

  • /home/<User> ($HOME)
  • /home/<User>/clouddrive
Storage Persistence Mechanism

The home directory (/home/<User>) mounts an img file created in the file share, and you can store up to 5GB of data.

Azure Cloud Shell img file

If you want to upload files from outside or take them out, save them in the “clouddrive” directory. This is linked to the file share directory (cs-<User>-xxx).

Let’s try creating an empty file called “testfile.txt” in the clouddrive directory.

Create a testfile

If you look at the contents of the file share in the storage account in the Azure portal, you can see that “testfile.txt” has been created.

File share - Browse

Summary

In this article, we’ve explained the overview of the Azure Cloud Shell. Here are the key points to prepare for the AZ-900 exam:

  • Can be used from a browser regardless of OS
  • You need a storage account to store data.
  • Shell environment can be selected between Bash and PowerShell
  • Tools such as Azure CLI and Azure PowerShell are pre-installed

Azure Cloud Shell lets you quickly run commands from a browser without setting up a local environment, which is great for quick checks and tasks.

Give it a try!