Azure Cloud Shell: A Browser-Based Shell with No Setup Required
Azure Cloud Shell is a browser-based terminal built directly into the Azure portal and accessible at shell.azure.com. It runs in a Microsoft-managed container that comes with the Azure CLI, PowerShell Az module, kubectl, Terraform, git, and a range of other tools pre-installed. There is nothing to install or maintain on your local machine. Open a browser, authenticate, and you have a working cloud terminal in seconds.
What Azure Cloud Shell Is
Cloud Shell is a managed, ephemeral Linux container that Microsoft provisions when you start a session. It runs on Azure infrastructure, not on your computer. The shell process terminates after 20 minutes of inactivity, but your files persist on an Azure Files share that is automatically mounted to your home directory.
Because Cloud Shell runs in Azure, it already has a Microsoft Entra ID identity associated with your account. You do not run az login — the CLI is pre-authenticated for your account. The first command you run in a new Cloud Shell session can be a real Azure CLI command against your resources.
You can open Cloud Shell from:
- The Azure portal — click the terminal icon (looks like a
>_prompt) in the top navigation bar. - A direct URL: shell.azure.com
- From within Visual Studio Code with the Azure Account extension.
- From the Azure mobile app.
Bash Mode vs PowerShell Mode
When you first open Cloud Shell, you choose between Bash and PowerShell. You can switch between them at any time using the dropdown in the Cloud Shell toolbar.
Bash mode gives you a standard Linux bash shell. The Azure CLI (az) commands you see throughout this documentation run here. You can also use Python, node, and common Unix tools. This is the recommended starting point if you are comfortable on the command line in any Linux/macOS environment.
PowerShell mode gives you a PowerShell 7 shell. The Azure PowerShell module (Az) is pre-installed, so you can use cmdlets like Get-AzResourceGroup, New-AzVM, and so on. The Azure CLI also works in PowerShell mode — you can mix az commands and Az cmdlets in the same session.
Your home directory files and the mounted Azure Files share are the same regardless of which shell mode you use. Switching from Bash to PowerShell in the same session does not lose your files. The shell type only affects which command syntax you use, not what is stored on disk.
Pre-Installed Tools
Cloud Shell maintains a managed environment that Microsoft keeps updated. You do not control the update schedule, but the tools are generally current versions. Commonly pre-installed tools include:
- Azure CLI (
az) — always current, automatically authenticated. - Azure PowerShell (
Azmodule) — in PowerShell mode. - kubectl — for managing Kubernetes clusters, including AKS.
- Helm — the Kubernetes package manager.
- Terraform — for infrastructure as code. You can run
terraform planandterraform applydirectly in Cloud Shell. - Ansible — for configuration management.
- git — clone repos, commit, push, pull.
- Python 3 and pip — including the Azure SDK for Python.
- Node.js and npm.
- jq — for parsing and transforming JSON in shell scripts.
- curl and wget — for HTTP requests and file downloads.
- vim, nano — text editors for editing files in the shell.
- Azure Developer CLI (
azd) — for scaffolding and deploying complete applications.
This set of tools covers the vast majority of Azure operations you might perform from a command line. For one-off tasks, you rarely need to install anything additional. For complex workflows that require specific package versions, Cloud Shell lets you install packages for the session duration using the usual package managers (pip, npm, apt).
Persistent Storage
When you start Cloud Shell for the first time, Azure creates a storage account in your subscription and an Azure Files share inside it. This share is mounted as your home directory (/home/username in Bash, C:\Users\ContainerAdministrator\CloudDrive in PowerShell). Files in your home directory survive session termination and container resets.
Files outside your home directory (for example, anything in /tmp) are in the container’s ephemeral storage and are gone when the session ends.
You can see the mounted share from within the shell:
# In Bash mode
df -h ~
# Shows the Azure Files share mounted at your home directory
# Filesystem: //csxxxxxxxx.file.core.windows.net/cs-username-xxx
# Size: 5.0GThe storage account created for Cloud Shell is in a resource group named cloud-shell-storage-{region} in your subscription. You can increase the share size in the portal if 5 GB is not enough. The contents are accessible through Azure Storage Explorer or the portal’s Storage Account blade.
Cloud Shell vs Local Azure CLI: When to Use Each
This comparison covers the practical scenarios where one tool is clearly better than the other.
| Scenario | Best Tool | Reason |
|---|---|---|
| You are on a machine without Azure CLI installed | Cloud Shell | No install needed. Works from any browser. |
| You are using a tablet, locked-down corporate laptop, or borrowed computer | Cloud Shell | No admin access needed. All you need is a browser. |
| You want to do a quick check or one-off fix without context switching from the portal | Cloud Shell | The portal’s built-in Cloud Shell button opens in seconds. No separate window needed. |
| You need to run scripts that involve AKS or kubectl | Cloud Shell | kubectl is already installed and configured. No need to install kubectl or merge kubeconfigs locally. |
| You are working in a CI/CD pipeline or automation | Local CLI / service principal | Cloud Shell is interactive only. Pipelines need service principal auth with az login —service-principal. |
| You run complex scripts that take longer than 20 minutes | Local CLI | Cloud Shell times out after 20 minutes of inactivity. Long-running scripts need a persistent environment. |
| You want to store and version-control your scripts locally | Local CLI | Your local filesystem is the right place for scripts you maintain over time, not the Cloud Shell file share. |
| You need specific CLI version pinning | Local CLI | Cloud Shell’s CLI version is managed by Microsoft and updates automatically. You cannot pin to a specific version. |
Many teams use Cloud Shell for ad hoc operations and quick fixes, and local CLI for scripted, repeatable workflows. See Using Azure CLI for a detailed guide to CLI commands regardless of where you run them.
Your First Cloud Shell Session
Here is what happens and what to do when you open Cloud Shell for the first time:
- Open the Azure portal and click the Cloud Shell icon (
>_) in the top navigation bar. - Choose Bash or PowerShell when prompted.
- If this is your first time, Azure prompts you to create a storage account for persistent files. Select the correct subscription and click Create storage. This takes about 30 seconds.
- The terminal opens. You are already authenticated — no
az loginneeded. - Verify your authentication and the active subscription:
az account show --output tableIf you have multiple subscriptions, set the one you want to work with:
az account set --subscription "my-dev-subscription"Now you can run any az command. For example, list your resource groups:
az group list --output tableThe connection to Azure is direct — no credential configuration, no network setup. Commands that would take multiple setup steps locally work immediately.
Customizing Your Cloud Shell Environment
Because files in your home directory persist, you can customize Cloud Shell like a regular shell environment. Common customizations stored in ~/.bashrc or ~/.bash_profile (Bash) or $PROFILE (PowerShell) carry over to every new session:
- Shell aliases (
alias k=kubectl) - CLI defaults (
az configure —defaults location=eastus) - Git configuration (
git config —global user.email) - kubectl context settings
- Custom prompt settings
You can also clone your personal dotfiles repository into Cloud Shell from git and run your usual setup script. Since the home directory persists, you only do this once.
The Cloud Shell editor (accessible with the {} icon in the toolbar) provides a basic web-based code editor for files on your Cloud Shell storage. It is useful for editing scripts without needing vim or nano.
Common Cloud Shell Mistakes
- Not creating persistent storage on first launch. If you dismiss the storage creation prompt and start a temporary session, everything you create — scripts, kubectl contexts, git clones — disappears when the session ends. Accept the storage creation to get persistence.
- Writing important files outside the home directory. Only
/home/usernameis on the persistent file share. Files written to/tmpor other system directories are gone when the container resets. Always write scripts and configurations to your home directory. - Relying on Cloud Shell for long-running tasks. The 20-minute inactivity timeout exists because Cloud Shell is an interactive tool, not a job runner. A deployment or script that takes 30+ minutes without user interaction will have its session terminated mid-run. Use a local environment or Azure Automation for long-running tasks.
- Forgetting to set the active subscription. Cloud Shell authenticates you automatically but does not know which subscription you want to work with if you have multiple. Check with
az account showand set withaz account setjust as you would locally. - Expecting Cloud Shell to be available in restricted network environments. Cloud Shell requires outbound internet access to Microsoft’s Cloud Shell service. In highly locked-down corporate networks with strict egress filtering, Cloud Shell may not work. Use the local CLI in those environments.
Summary
- Azure Cloud Shell is a browser-based terminal at shell.azure.com and built into the Azure portal, with no local install required.
- Choose Bash mode for az commands and standard Linux tools, or PowerShell mode for Az cmdlets. Both modes share the same persistent file storage.
- Pre-installed tools include az, kubectl, Helm, Terraform, git, Python, Node.js, and jq.
- Files in your home directory persist across sessions via a mounted Azure Files share. Files outside the home directory are ephemeral.
- Use Cloud Shell for quick ops, working from machines without a local CLI, and ad hoc kubectl work. Use local CLI for long-running scripts, CI/CD, and version-pinned tooling.
- The shell times out after 20 minutes of inactivity. It is an interactive tool, not a job runner.
Frequently asked questions
Is Azure Cloud Shell free?
The Cloud Shell compute itself is free. However, it requires a small Azure Files share (5 GB minimum) to persist your files across sessions. That storage share incurs a small monthly charge — typically less than $1/month for 5 GB in most regions. If you close your session without creating the storage share, the session is ephemeral and everything you create in that session is lost when it ends.
What happens to my Cloud Shell files if I do not use it for a long time?
The Azure Files share persists as long as the storage account exists. The shell environment itself is reset between sessions, but files you stored in your home directory (/home/your-username in Bash mode) survive because they are on the mounted file share. Files created outside the home directory are lost when the session ends.
Can multiple people share the same Cloud Shell?
Each user gets their own Cloud Shell environment tied to their Microsoft Entra ID account. There is no shared shell. If two people need to work together interactively, they each open their own Cloud Shell session and have independent environments.