Open Cloud Shell for the first time
In this task you'll open Cloud Shell.
Azure Cloud Shell is a command line in your browser, already signed in as you, with the Azure CLI, Azure PowerShell, kubectl, git and other tools installed. Nothing to install, and it works from any computer.
You can run it without a storage account (an ephemeral session), in which case your files are lost when the session ends. Or you can attach a storage account so your files are kept, which is billed like any other storage.
Example. A SS Kaiser engineer on holiday is asked to restart a stuck VM. From a borrowed laptop, they open the portal, start Cloud Shell and run one command, with nothing installed and nothing left behind.
Before you start
You need: Any Azure account. Time: 10 minutes.
Where to look
- Top bar
- Cloud Shell (>_)
Steps
- Select the >_ icon in the top bar, next to the search box.
- Choose Bash when asked.You can switch to PowerShell any time from the Cloud Shell toolbar. Once you've chosen, Cloud Shell remembers, so later sessions open straight away.
- When asked about storage, choose to continue without a storage account (an ephemeral session) and pick your subscription.This keeps it free. Anything you save is lost when the session ends.
- Type
az account show --output tableto check which account and subscription you're using. - Try the toolbar: Manage files to upload or download, the editor icon (or type
code .) to edit files, and the switch between Bash and PowerShell. - Select the maximise icon to give it more room, or close the pane when you've finished.
Tip. You can also open it full screen at shell.azure.com.
Commands
# Which account and subscription is this shell using?
az account show --output table
# Switch subscription if you have more than one
az account set --subscription "<name or ID>"
Watch out for
- Cost
- An ephemeral session is free. If you attach a storage account, its file share is billed like any other storage, so delete it when you no longer need it.
- Security
- Cloud Shell signs in as you, with all your rights. Close it on shared computers, and never paste secrets into commands that will stay in the shell's history.
- Common mistakes
- Saving important scripts in an ephemeral session and losing them. Running a command against the wrong subscription: check with az account show first.
Clean up
Nothing to clean up for an ephemeral session. If you attached storage, delete that storage account or its resource group when you no longer need it.
Words to know
- Ephemeral session
- A Cloud Shell session with no storage attached. Files disappear when it ends.
- Bash and PowerShell
- The two command-line environments Cloud Shell offers. You can switch between them.
- Session timeout
- Cloud Shell ends a session after about 20 minutes without input.
Tick off each step and track your progress in the guide.
Open this task in Azure Portal, Hands On