Set Up and Access the Azure CLI

Hands-On Lab


Photo of ThomasK


Training Architect





In this Learning Activity, we will be working with file shares within the provisioned storage account in the Azure Portal in preparation for the use of the Azure CLI.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Set Up and Access the Azure CLI

In this Learning Activity, we will be working with fileshares within the provisioned storage account in the Azure Portal, in preparation for the use of the Azure CLI.

We are supporting the web development team in our class at Star Fleet Academy. They have recently started onboarding some new cadets. These people need access to a virtual machine they can use for either Bash or PowerShell scripting access through the Azure CLI.

The command team has provisioned a virtual instance that the CLI can be installed against by the cadets in our class. There was a storage account provisioned, but the necessary storage and fileshare does not exist. We will need to set up the appropriate fileshare and name it myCLI. Once that is set up, verify that we can access both the Bash and PowerShell CLI in the environment. Once we verify that the commands can run, then we can turn the system over for their use.

Before we start, though, we need to use the information provided to log in to the Azure Portal.

Once we're logged in, we'll land in the Azure Dashboard.

Create the Azure Fileshare

From here, we can get started by clicking on the Cloud Shell button, which looks like >_. This will open up the Cloud Shell which has Bash and PowerShell.

Enable Bash Prompts

Let's get started with Bash. In the Cloud Shell, Select Bash. Then select Show advanced settings. In here, select Create new for the File share, and name it mycli. Leave the rest as the defaults. Select Create Storage.

Cloud Shell will set us in a Bash shell.

Run the dir command to show which drive we are in. We will appear in the clouddrive.

If we use the command ls -alrt, we will be able to see that clouddrive is actually a link to /usr/queeniegoodvin/clouddrive.

We can also use the top command to see more about what's going on in our system. We're not really doing much though, so there's not much information to look at.

Enable PowerShell Prompts

To create a PowerShell prompt, select the Bash dropdown at the top of the Cloud Shell window, and change it to PowerShell. Select Confirm when prompted.

Run the dir command to show which directory we are in. Powershell tells us we're in Azure, then outputs some more information about the Mode, SubscriptionName, SubscriptionID, TenantID, and the State.

For more information, let's use the following command:

Get-AzureRmVM -Status

This returns information about our ResourceGroupName, Name, Location, VmSize, OsType, NIC, Provisioning, Zone, PowerState, and MaintenanceAllowed.

After we successfully run these commands, we can close the lab and turn the system over to Star Fleet.


Now that we've completed this lab, we know how to enable both Bash and PowerShell via the Azure Cloud Shell. Congratulations!