At the recent Build conference, Microsoft officially announced public preview of Azure Cloud Shell – browser-accessible, pre-configured shell experience for managing Azure resources without the overhead of installing, versioning, and maintaining a machine yourself.
Cloud Shell runs entirely on containers orchestrated by Kubernetes and shows us just another example of how container technology can revolutionize solutions built on Azure.
Machine for Cloud Shell is not persistent and temporary provided on a per-request basis (1 machine per 1 user, permissions are set as a regular Linux user). That machine’s hosting is free. You just need to pay for storage that it consumes (file share –> described later in this post).
Cloud Shell comes with the support of well known tools and languages:
|Azure Tools||Azure CLI 2.0 and 1.0|
|Linux shell interpreter||Bash,sh|
|Containers||Docker,Kubectl, DC/OS CLI|
|Python||2.7 and 3.5|
|More:||use this link|
It supports Bash experience so far. Everyone’s favorite PowerShell is coming soon. You can try the new shell today by pressing the special icon at the top navigation bar of the Azure portal.
The new storage account (LRS), resources group and file share will be created during one-time setup.
- Resource group is named: cloud-shell-storage-
- Storage Account: cs-uniqueGuid
- File Share: cs—com-uniqueGuid
As Cloud Shell’s machine is temporary, file share makes possible to persist your bash $Home directory. This file share will mount as clouddrive under your $Home directory and it’s also used to store a 5 GB image created for you that automatically updates and persists your $Home directory as well (see the pic below, acc_<username>.img).
Note: you pay only for this file share. There are no any additional compute costs.
To download/upload files you can use portal as usual. For example, I created txt-file in my clouddrive and would like to download it to my local machine. So, I need to open the file share associated with cloud shell, locate the file “text.txt” and just hit “Download”.
To add some files from local machine to clouddrive, use the “Upload” button and then check result by running cd clouddrive and ls in the cloud shell session
As you may noticed, Cloud Shell automatically authenticates on each session for instant access to your resources through the Azure CLI 2.0. You can even use the interactive mode for Azure CLI 2.0 to ease scripting and save a lot of time
Each cloud shell session times out after 10 minutes without any activities
That’s great, but that is not the whole news
Cloud Shell is also embedded directly in docs.microsoft.com and it makes Azure CLI samples in documentation fully interactive. To evaluate this new functionality, go to Azure CLI 2.0 documentation, log in to Cloud Shell by clicking “Try it” and start learning in just a new way.
Some more examples
Creating VM in the cloud shell
List of VMs in the resource group with customized output