title | description | services | documentationcenter | author | manager | tags | ms.assetid | ms.service | ms.workload | ms.tgt_pltfrm | ms.devlang | ms.topic | ms.date | ms.author |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Bash in Azure Cloud Shell Quickstart | Microsoft Docs |
Quickstart for Bash in Cloud Shell |
jluk |
timlt |
azure-resource-manager |
azure |
infrastructure-services |
vm-linux |
na |
article |
09/25/2017 |
juluk |
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.
- Launch Cloud Shell from the top navigation of the Azure portal
- Select a subscription to create a storage account and Microsoft Azure Files share
- Select "Create storage"
Tip
You are automatically authenticated for Azure CLI 2.0 in every sesssion.
- List subscriptions you have access to:
az account list
- 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 new resource group in WestUS named "MyRG":
az group create -l westus -n MyRG
Create an Ubuntu VM in your new resource group. The Azure CLI 2.0 will create SSH keys and setup the VM with them.
az vm create -n my_vm_name -g MyRG --image UbuntuLTS --generate-ssh-keys
Note
The public and private keys used to authenticate your VM are placed in /User/.ssh/id_rsa
and /User/.ssh/id_rsa.pub
by Azure CLI 2.0 by default. Your .ssh folder is persisted in your attached Azure Files share's 5-GB image.
Your username on this VM will be your username used in Cloud Shell ($User@Azure:).
- Search for your VM name in the Azure portal search bar
- Click "Connect" and run:
ssh username@ipaddress
Upon establishing the SSH connection, you should see the Ubuntu welcome prompt.
Delete your resource group and any resources within it:
Run az group delete -n MyRG
Learn about persisting files for Bash in Cloud Shell
Learn about Azure CLI 2.0
Learn about Azure Files storage