Azure Cloud Shell, Azure CLI, and Azure PowerShell: environment vs tools
Management and governance
Azure Cloud Shell, Azure CLI, and Azure PowerShell: environment vs tools
Short Summary
In this lesson, you’ll learn what Azure Cloud Shell is and why it’s useful. You’ll also learn how Azure Command-Line Interface (CLI) and Azure PowerShell relate to Cloud Shell. By the end, you’ll be able to choose the right option based on whether you need a quick browser session or a local setup.
Learning Objectives
By the end of this lesson, you will be able to:
- Define Azure Cloud Shell in plain language.
- Distinguish between Cloud Shell (environment) and Azure CLI / Azure PowerShell (tools).
- Compare Azure CLI and Azure PowerShell at a high level.
- Choose when to use Cloud Shell versus installing tools locally.
- Explain what “persistence” means in Cloud Shell and where to save important files.
Core Concepts
Azure Cloud Shell
Azure Cloud Shell is an interactive, authenticated, browser-based terminal for managing Azure resources. You can launch it from the Azure portal (and other entry points) and start running commands without setting up tools on your own machine.
Cloud Shell provides two shell experiences:
- Bash (Bourne Again SHell)
- PowerShell
A simple mental model that prevents most confusion:
- Cloud Shell = the environment (where you run commands)
- Azure CLI / Azure PowerShell = the tools (the command sets you use)
Cloud Shell is built for fast, “I need a terminal right now” work: quick changes, troubleshooting, learning, and one-off tasks.
Azure Command-Line Interface (CLI)
Azure Command-Line Interface (CLI) is a cross-platform command-line tool for managing Azure resources. You typically use it via the az command.
- You can run Azure CLI inside Cloud Shell.
- You can also install it locally and run it from your preferred terminal (Bash, PowerShell, or another shell).
Azure PowerShell
Azure PowerShell is a set of PowerShell modules (most commonly the Az module) that lets you manage Azure using PowerShell commandlets (cmdlets).
- In Cloud Shell, you usually choose the PowerShell experience when you want Azure PowerShell cmdlets.
- You can also install Azure PowerShell locally to integrate with your own scripts, tooling, and automation.
Persistence in Cloud Shell
Cloud Shell runs on a temporary session host, so you shouldn’t treat it like your personal permanent virtual machine (VM). To keep files across sessions, Cloud Shell provides persistent storage (a “cloud drive” mounted into your session).
A practical rule:
- If you want a script to still be there next time, save it in your Cloud Shell home folder / cloud drive (commonly shown as
clouddrive).
Practical Understanding
Practical Situation 1: “I need an Azure terminal right now, on a fresh laptop”
You’re on a device where you can’t (or don’t want to) install anything, but you still need to run a few Azure management commands.
How to think about it: Use Cloud Shell. It gives you a ready-to-use terminal in the browser with Azure tooling already available.
Common misunderstanding: “Command line always means local install.” Cloud Shell is command line without the local setup step.
Practical Situation 2: “I like az commands and a CLI workflow”
You’re comfortable with CLI-style commands and want something that works well for quick commands or scripts.
How to think about it:
Choose Azure CLI (the az tool). Run it in Cloud Shell for quick tasks, or install it locally when you want your own environment (editor integration, automation, and repeatable scripts).
Common misunderstanding: “Azure CLI only works in Bash.” Azure CLI is a tool you can run from multiple shells; Bash is just one common option.
Practical Situation 3: “I prefer PowerShell cmdlets and PowerShell scripting”
You’re already productive with PowerShell and want Azure management that fits that style.
How to think about it: Choose Azure PowerShell (Az cmdlets). Use Cloud Shell (PowerShell) for quick work, or install Azure PowerShell locally when you want deeper scripting and automation in your environment.
Common misunderstanding: “Azure CLI and Azure PowerShell are the same thing.” They overlap in what they can manage, but they use different command styles and ecosystems.
Practical Situation 4: “I wrote a script in Cloud Shell and it disappeared”
You created files during a Cloud Shell session and expected them to still exist later, but some things are missing.
How to think about it: Treat the session host as temporary. Save important files in the persistent area (your home folder / mounted cloud drive) so they’re available across sessions.
Common misunderstanding: “Cloud Shell is my permanent VM.” It’s best viewed as a disposable session plus a persistent place to store the files you care about.
Common Pitfalls
-
Mistake: Confusing Azure Cloud Shell with Azure CLI. Correction: Cloud Shell is the environment; Azure CLI is a tool you can run in Cloud Shell or locally.
-
Mistake: Assuming you must install Azure CLI or Azure PowerShell locally to manage Azure. Correction: Cloud Shell lets you manage Azure from a browser, so local install is optional.
-
Mistake: Treating Azure CLI and Azure PowerShell as interchangeable in syntax. Correction: They manage similar resources, but commands differ (
az ...vs PowerShell cmdlets). -
Mistake: Saving important files in temporary locations during a Cloud Shell session. Correction: Save scripts in the persistent storage area (home folder / cloud drive) if you want them across sessions.
Check Your Understanding
- Explain, in one sentence, the difference between “Azure Cloud Shell” and “Azure CLI.”
- Describe a real situation where Cloud Shell is a better fit than installing tools locally.
- Describe a real situation where installing Azure CLI or Azure PowerShell locally is a better fit than Cloud Shell.
- If you prefer a CLI workflow, what combination would you pick (environment + tool), and why?
- Where should you save scripts in Cloud Shell if you want them to be available across sessions, and why?
Further Reading
- Azure Cloud Shell overview — https://learn.microsoft.com/en-us/azure/cloud-shell/overview
- What is Azure CLI? — https://learn.microsoft.com/en-us/cli/azure/what-is-azure-cli
- What is Azure PowerShell? — https://learn.microsoft.com/en-us/powershell/azure/what-is-azure-powershell
