Microsoft Studies: Azure Cloud Shell
π Login and Run Your First Command
Step 1: Access Cloud Shell
Go here:
π https://shell.azure.com/
Sign in with your Azure account.
Step 2: Choose Your Shell
Youβll be prompted to choose:
- Bash (Azure CLI)
- PowerShell
π For this example, weβll use PowerShell, but you can switch anytime.
Step 3: Check Your Azure Subscriptions
Get-AzSubscription
What does this do?
- This is a PowerShell cmdlet
- It retrieves all subscriptions tied to your account
- Helps you confirm where you're connected β
π‘ Think of it as:
π βShow me all the Azure accounts I can use.β
β οΈ IMPORTANT: Select the Correct Subscription
Before creating resources, make sure you're working in the correct subscription.
π If you donβt do this:
- You might create resources in the wrong subscription
- This can lead to confusion or unexpected charges
β Set Your Active Subscription (Azure CLI)
az account list --output table
This shows all your subscriptions.
Then set the one you want:
az account set --subscription "Your-Subscription-Name"
β (Alternative) Set Subscription in PowerShell
Set-AzContext -Subscription "Your-Subscription-Name"
ποΈ Create Your First Resource
Now letβs create something simple: a Resource Group.
What is a Resource Group?
A resource group is like a container that holds Azure resources (VMs, storage, etc.).
β Create a Resource Group
az group create --location westus --resource-group rg-001
Whatβs happening here?
| Part | Meaning |
|---|---|
az |
Azure CLI command |
group create |
Create a resource group |
--location westus |
Region where it's created |
--resource-group rg-001 |
Name of the resource group |
β Delete the Resource Group (Cleanup)
az group delete --name rg-001
π‘ This removes the resource group and everything inside it.
β οΈ Always delete test resources to avoid unexpected charges.