A few Azure CLI experiences summarized!



Hi Azure Friends,


In this article, I have summarized a few Azure CLI commands that I often use. I am absolutely aware that this is really only a small overview, but I wanted to share it with you anyway. Please start with the following steps to begin the "journey" (the Hashtags are comments):


#If your work on your local machine please login (no login required with the cloud shell)
az login

#Which subscription am I working with?
az account show

#A list with all subscriptions
az account list --all --output table

#If you want to change the subscription
az account set --subscription "your subscription name"

#lists the resource groups under your subscription
az group list --output table

#List all resource groups located in the WestEurope region
az group list --query "[?location=='westeurope']" --output table

#List all resources in the WestEurope region
az resource list --location westeurope --output table

#List all resource of a specific region and resource group
az resource list -g tw-rg01 --location westeurope --output table

#List all VM's in a resource group
az vm list -g tw-rg01 --output table

#Restart a VM
az vm restart -g tw-rg01 -n tw-win2019

#Get the public IP addresses
az network public-ip list -g tw-rg01 --output table

#A list of VNet's
az network vnet list --output table

#All the subnets in the specific VNet
az network vnet subnet list -g tw-rg01 --vnet-name vnet-base --output table

#Infos about the NSG (Network Security Group) in a specific resource group
az network nsg list -g tw-rg01 --output table

#All the rules in a specific NSG
az network nsg rule list -g tw-rg01 --nsg-name tw-base-nsg --output table

#Infos about the NIC's
az network nic list --output table

#Lets show the IP configuration of a specific NIC
az network nic ip-config list -g tw-rg01 --nic-name tw-linsrv536 --output table
I am absolutely aware that this is nothing spectacular. I just wanted to share a few impressions with you.

I hope this article was useful. Best regards, Tom Wechsler


P.S. All scripts (#PowerShell, Azure CLI, #Terraform, #ARM) that I use can be found on github! https://github.com/tomwechsler

0 Replies