Skip to content

Latest commit

 

History

History
96 lines (74 loc) · 3.35 KB

quickstart.md

File metadata and controls

96 lines (74 loc) · 3.35 KB
title description author manager tags ms.service ms.workload ms.tgt_pltfrm ms.topic ms.date ms.author
Azure Cloud Shell Quickstart - Bash
Learn how to use the Bash command line in your browser with Azure Cloud Shell.
maertendMSFT
timlt
azure-resource-manager
azure
infrastructure-services
vm-linux
article
03/12/2018
damaerte

Quickstart for Bash in Azure Cloud Shell

This document details how to use Bash in Azure Cloud Shell in the Azure portal.

Note

A PowerShell in Azure Cloud Shell Quickstart is also available.

Start Cloud Shell

  1. Launch Cloud Shell from the top navigation of the Azure portal.
    Screenshot showing how to start Azure Cloud Shell in the Azure portal.

  2. Select a subscription to create a storage account and Microsoft Azure Files share.

  3. Select "Create storage"

Tip

You are automatically authenticated for Azure CLI in every session.

Select the Bash environment

Check that the environment drop-down from the left-hand side of shell window says Bash.
Screenshot showing how to select the Bash environment for the Azure Cloud Shell.

Set your subscription

  1. List subscriptions you have access to.

    az account list
    
  2. Set your preferred subscription:

    az account set --subscription 'my-subscription-name'
    

Tip

Your subscription will be remembered for future sessions using /home/<user>/.azure/azureProfile.json.

Create a resource group

Create a new resource group in WestUS named "MyRG".

az group create --location westus --name MyRG

Create a Linux VM

Create an Ubuntu VM in your new resource group. The Azure CLI will create SSH keys and set up the VM with them.

az vm create -n myVM -g MyRG --image UbuntuLTS --generate-ssh-keys

Note

Using --generate-ssh-keys instructs Azure CLI to create and set up public and private keys in your VM and $Home directory. By default keys are placed in Cloud Shell at /home/<user>/.ssh/id_rsa and /home/<user>/.ssh/id_rsa.pub. Your .ssh folder is persisted in your attached file share's 5-GB image used to persist $Home.

Your username on this VM will be your username used in Cloud Shell ($User@Azure:).

SSH into your Linux VM

  1. Search for your VM name in the Azure portal search bar.

  2. Click "Connect" to get your VM name and public IP address.
    Screenshot showing how to connect to a Linux V M using S S H.

  3. SSH into your VM with the ssh cmd.

    ssh username@ipaddress
    

Upon establishing the SSH connection, you should see the Ubuntu welcome prompt.
Screenshot showing the Ubuntu initialization and welcome prompt after you establish an S S H connection.

Cleaning up

  1. Exit your ssh session.

    exit
    
  2. Delete your resource group and any resources within it.

    az group delete -n MyRG
    

Next steps

Learn about persisting files for Bash in Cloud Shell
Learn about Azure CLI
Learn about Azure Files storage