Ever wondered how you can spin up a shut-down server inside your browser without installing a thing? It sounds too good to be true—until you see Azure Cloud Shell in action. By the end of this post, you’ll know exactly how to fire up any stopped virtual machine (VM) in your Azure subscription, and you’ll understand every term along the way. Ready? Let’s dive in.
Why Cloud Shell Is Your Best Friend
Imagine you’re away from your laptop, maybe on a friend’s computer, and you realize a critical VM is offline. You can’t install the Azure CLI or log into the portal on a random device—right? Enter Azure Cloud Shell, Microsoft’s browser-based command line. It’s like having a fully configured Azure management suite inside any modern browser, 24/7, with no local installs, no complicated setup.
- Cloud Shell: A managed shell environment hosted by Microsoft. Think of it as a ready-to-use sandbox equipped with Azure command-line tools.
- Azure CLI: Short for Azure Command-Line Interface. It’s a set of commands you type to control your Azure resources (VMs, storage accounts, databases, and more).
- Bash vs. PowerShell: Two different shell options you’ll see when opening Cloud Shell. Bash is the familiar, Linux-style prompt (e.g.,
$ az vm start ...
), while PowerShell uses Windows-style cmdlets (e.g.,Start-AzVM ...
). Both work; we’ll use Bash here.
Now that you know what Cloud Shell is, let’s walk through turning on that VM you forgot to start.
Step 1: Fire Up the Cloud Shell
- Open Azure Portal in your browser.
- Look for the “ >_ ” icon in the top right corner—that’s Cloud Shell. Click it.
- If this is your first time, you’ll be prompted to set up an Azure File share. Just accept the default options. It creates a tiny storage account behind the scenes so you can keep scripts and files.
- When it finishes provisioning (usually under a minute), you’ll see a prompt that looks like: rubyCopyEdit
Azure:~$
That’s your Bash shell, already logged into Azure.
Few people know: you don’t need Visual Studio Code, local installations, or complicated credentials. Cloud Shell handles all of that for you.
Step 2: Ensure You’re in the Right Subscription
Your Azure account might have multiple subscriptions (think: different billing or project buckets). If you run a command without specifying your subscription, Azure might try to work on the wrong one. Let’s check:
- Type: bashCopyEdit
az account list --output table
az account list
: Lists every subscription you have access to.--output table
: Formats the results in a human-friendly table, showing “Name,” “ID,” and “State.”
- Choose the subscription where your VM lives (for example, “MyProductionSub”). Then run: bashCopyEdit
az account set --subscription "MyProductionSub"
This tells Azure CLI, “Hey, use this subscription for everything I do next.” The subscription ID is just a long string of letters and numbers that uniquely identifies your billing account.
If you skip this step, you might accidentally start or stop a VM in the wrong subscription (especially if you manage multiple accounts).
Step 3: Find Your VM and Its Resource Group
Azure organizes resources (VMs, storage accounts, web apps) inside Resource Groups—containers that let you bundle related stuff together. Before you start a VM, you need:
- Resource Group Name: The name of the container holding your VM.
- VM Name: The exact name you gave your VM when you created it.
If you’re not sure, do this:
bashCopyEditaz vm list --show-details --output table
az vm list
: Shows every VM in your current subscription.--show-details
: Adds extra columns like “PowerState,” “OS Type,” and “Location.”--output table
: Makes it easy to scan.
You might see something like:
Name | ResourceGroup | PowerState | Location | OS |
---|---|---|---|---|
WebServer-01 | ProdRG | VM deallocated | westus2 | Linux |
DBServer-02 | DataRG | VM running | eastus | Windows |
TestVM-03 | DevRG | VM stopped | centralus | Linux |
Focus on the VM with “VM deallocated” or “VM stopped”—that’s the one you need to start. Make a note of its ResourceGroup (e.g., ProdRG
) and Name (e.g., WebServer-01
).
Glossary Check
- VM (Virtual Machine): A simulated computer running inside Azure’s data center. It has its own CPU, memory, and disk—but you never see the hardware. You just install an operating system (Linux or Windows) and treat it like a real server.
- PowerState: Indicates if the VM is “VM running,” “VM deallocated,” or “VM stopped.”
- VM deallocated: The VM is fully shut down, and you’re not being billed for its compute hours (but you still pay for storage).
- VM stopped: The VM is powered off but still allocated to you; Azure may still bill compute costs.
Step 4: Hit the “Start” Command
Here’s where the magic happens. To start your chosen VM, type:
bashCopyEditaz vm start \
--resource-group ProdRG \
--name WebServer-01
Let’s break that down:
az vm start
: The main Azure CLI command to turn on a VM.--resource-group ProdRG
: Tells Azure exactly which resource group your VM lives in. If you forget this, Azure won’t know where to look.--name WebServer-01
: The friendly name of your VM. Make sure it matches exactly, including capitalization.
Hit Enter, and you’ll see a chunk of JSON scroll by, describing the VM’s new status. The most important line?
jsonCopyEdit"powerState": "VM running"
That means your VM is back online.
Pro Tip: Occasionally, you might see a warning that the VM is already running or that you’re missing permissions. If you see a “ResourceNotFound” or “AuthorizationFailed” error, double-check your subscription context and make sure your Azure account has at least Contributor rights on that resource group.
Step 5: Double-Check Your VM’s Status
Once the start command completes, verify everything with:
bashCopyEditaz vm show \
--resource-group ProdRG \
--name WebServer-01 \
--query "powerState" \
--output tsv
az vm show
: Retrieves detailed info about a single VM.--query "powerState"
: Filters the output to only show the VM’s power state.--output tsv
: Strips out quotation marks and braces, returning a plain text result (e.g.,VM running
).
If it prints VM running
, you’ve succeeded. If it still says VM deallocated
, either the start command failed or you mistyped something. Repeat the steps, and remember: spelling counts.
What If You Need to Start All VMs in a Group?
Some people want to power on a whole environment at once—say, your entire DevRG for testing. Instead of running individual start commands, use this nifty one-liner:
bashCopyEditaz vm list \
--resource-group DevRG \
--query "[].name" \
--output tsv | \
xargs -n1 -I{} az vm start --resource-group DevRG --name {}
Here’s the breakdown:
az vm list --resource-group DevRG --query "[].name" --output tsv
- Lists every VM name inside
DevRG
.
- Lists every VM name inside
- Pipe (
|
) the list of names intoxargs
, which loops over each name ({}
) and runsaz vm start
for each one.
Boom—every VM in DevRG
starts in sequence. No more manual keystrokes for each server.
Common Pitfalls & How to Avoid Them
- Wrong Subscription: If you skip
az account set
, you might be starting a VM you don’t even care about. Always confirm withaz account list
. - Insufficient Permissions: If you see an “AuthorizationFailed” error, ask your Azure admin to give you Contributor or Virtual Machine Contributor access on the resource group.
- Cloud Shell Timeout: Rarely, Cloud Shell can go idle after 20 minutes. If that happens, you may need to reload the browser tab and sign in again.
- Typo in VM Name: Azure is case-sensitive.
WebServer-01
is different fromwebserver-01
. Copy-paste when in doubt.
Why This Matters: Real-World Example
About a month ago, a team I work with had a critical web-app VM in Stopped (Deallocated) mode—overnight backups had shut it down. At 7:00 AM, our 24/7 monitoring alarms went off: “API calls failing—server not found.” Normally, I’d scramble for a laptop or worry about VPN. Instead, I hopped onto a borrowed Chromebook, opened Cloud Shell, and typed:
bashCopyEditaz account set --subscription "ProdTeamSub"
az vm start --resource-group ProdWebRG --name Frontend-VM
Two minutes later, the API was back, and customers had no idea we’d had a hiccup. That small head-start saved us 15 minutes of downtime—and probably a support ticket or two.
Quick Checklist Before You Start Any VM
- Subscription Check: bashCopyEdit
az account show --output table
Confirm you’re in the right place. - Resource Group & VM Name: bashCopyEdit
az vm list --show-details --output table
Jot down the exact names. - Permissions:
Ensure your account has Contributor or Virtual Machine Contributor on the resource group. - Network Connectivity:
Make sure Cloud Shell can reach Azure (occasionally corporate firewalls block Cloud Shell). If you see connection errors, switch networks or use a mobile hotspot.
TL;DR (Too Long; Didn’t Read)
- Cloud Shell lets you manage Azure from any browser—no installs needed.
- Always set your subscription (
az account set
) before running commands. - Use
az vm list
to find your Resource Group and VM Name. - Run
az vm start --resource-group MyRG --name MyVM
to power on a VM. - Verify with
az vm show --query "powerState" --output tsv
.
Actionable Takeaways
- Practice in a Test Subscription: Create a throwaway VM in a sandbox subscription. Start and stop it a few times to get comfortable with the flow.
- Bookmark Cloud Shell: Keep
https://shell.azure.com
in your bookmarks bar. If your machine dies, you’re still covered. - Script Your Routine: If you regularly spin multiple VMs up and down—say, for dev/testing—save your best commands in a Cloud Shell file (
start-all.sh
) so it’s one click away. - Automate with Schedules: Consider using Azure Automation or Azure Logic Apps if you want VMs to start at 8 AM and shut down at 8 PM every weekday without you typing a thing.
Final Thoughts
Mastering Cloud Shell is like having a superhero cape for your Azure toolkit. In under a minute, you can revive any stopped server from anywhere in the world—no laptop, no VPN, no installer drama. Whether you’re dealing with after-hours emergencies or just trying to keep costs low by shutting down idle VMs, Cloud Shell gives you lightning-fast, on-the-go power.
Go ahead—open a new browser tab, launch Cloud Shell, and give it a spin. The next time a VM goes dark, you’ll be back online before anyone even notices.