Working With Microsoft's Azure Cloud Shell

Introduction

This write-up is about Azure Cloud Shell (Preview) which Microsoft has come up recently with a big blast of using CLI on the Azure portal itself.

Cloud Shell

Azure Cloud Shell is basically an admin machine on Azure Datacenter. This will help us in getting connected with Azure by giving access to the commands which is same like that we have on PowerShell. You can also continue using your files across the Azure Storage of file which you have.

Azure Cloud Shell is added to the Azure portal for everyone and you can find the same at the top right corner, as shown below.

Azure

Click on the Cloud Shell to get access of it.

Once you click on the Cloud Shell, you will be getting a Terminal window which is displayed at the down pane of your Azure portal.

Azure

Now, here is the Bash window of the same which has a welcome screen displaying "Welcome to Azure Cloud Shell". You have an option called Azure CLI Documentation which helps you in learning about the CLI commands that can help you in accessing any services of Azure.

Azure

Let's type az (or) azure in the Bash Terminal to get connected with Azure CLI 2.0

Azure

As Azure CLI gets loaded, we have the base commands of Azure as shown above. Let's try listing out the Azure commands to display the details of Azure account in the Bash terminal.

az account

Azure
 
Log into the Azure account now.

az login

Azure

Open a new browser and go for www.aka.ms/devicelogin. Then, enter the code given in the terminal.

Once the code is given, click on "Continue" as shown below.

Azure

Now, sign in with your Microsoft account on the login. Logging into your Microsoft account will acknowledge the bash terminal with the Azure account which you have authenticated.

Further, enter the Azure account ID and password to continue.

Command

az login –u [email protected] –p Work4@zure

Azure

You can now logout from the Bash terminal using the below command.

Command

az logout [ --username ]

You can also try working with few other Azure CLI commands on the Azure CLI same as your PowerShell. Microsoft has also promised that we will be getting PowerShell on the Azure portal shortly!!