A few Azure CLI experiences summarized!

%3CLINGO-SUB%20id%3D%22lingo-sub-2136615%22%20slang%3D%22en-US%22%3EA%20few%20Azure%20CLI%20experiences%20summarized!%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2136615%22%20slang%3D%22en-US%22%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%20Azure%20Friends%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20this%20article%2C%20I%20have%20summarized%20a%20few%20Azure%20CLI%20commands%20that%20I%20often%20use.%20I%20am%20absolutely%20aware%20that%20this%20is%20really%20only%20a%20small%20overview%2C%20but%20I%20wanted%20to%20share%20it%20with%20you%20anyway.%20Please%20start%20with%20the%20following%20steps%20to%20begin%20the%20%22journey%22%20(the%20Hashtags%20are%20comments)%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3E%23If%26nbsp%3Byour%26nbsp%3Bwork%26nbsp%3Bon%26nbsp%3Byour%26nbsp%3Blocal%26nbsp%3Bmachine%26nbsp%3Bplease%26nbsp%3Blogin%26nbsp%3B(no%26nbsp%3Blogin%26nbsp%3Brequired%26nbsp%3Bwith%26nbsp%3Bthe%26nbsp%3Bcloud%26nbsp%3Bshell)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSTRONG%3Eaz%26nbsp%3Blogin%3C%2FSTRONG%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CDIV%3E%3CSPAN%3E%23Which%26nbsp%3Bsubscription%26nbsp%3Bam%26nbsp%3BI%26nbsp%3Bworking%26nbsp%3Bwith%3F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSTRONG%3Eaz%26nbsp%3Baccount%26nbsp%3Bshow%3C%2FSTRONG%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CDIV%3E%3CSPAN%3E%23A%26nbsp%3Blist%26nbsp%3Bwith%26nbsp%3Ball%26nbsp%3Bsubscriptions%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSTRONG%3Eaz%26nbsp%3Baccount%26nbsp%3Blist%26nbsp%3B--all%26nbsp%3B--output%26nbsp%3Btable%3C%2FSTRONG%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CDIV%3E%3CSPAN%3E%23If%26nbsp%3Byou%26nbsp%3Bwant%26nbsp%3Bto%26nbsp%3Bchange%26nbsp%3Bthe%26nbsp%3Bsubscription%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSTRONG%3Eaz%26nbsp%3Baccount%26nbsp%3Bset%26nbsp%3B--subscription%26nbsp%3B%22your%20subscription%20name%22%3C%2FSTRONG%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CDIV%3E%3CSPAN%3E%23lists%26nbsp%3Bthe%26nbsp%3Bresource%26nbsp%3Bgroups%26nbsp%3Bunder%26nbsp%3Byour%26nbsp%3Bsubscription%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSTRONG%3Eaz%26nbsp%3Bgroup%26nbsp%3Blist%26nbsp%3B--output%26nbsp%3Btable%3C%2FSTRONG%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CDIV%3E%3CSPAN%3E%23List%26nbsp%3Ball%26nbsp%3Bresource%26nbsp%3Bgroups%26nbsp%3Blocated%26nbsp%3Bin%26nbsp%3Bthe%26nbsp%3BWestEurope%26nbsp%3Bregion%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSTRONG%3Eaz%26nbsp%3Bgroup%26nbsp%3Blist%26nbsp%3B--query%26nbsp%3B%22%5B%3Flocation%3D%3D'westeurope'%5D%22%26nbsp%3B--output%26nbsp%3Btable%3C%2FSTRONG%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CDIV%3E%3CSPAN%3E%23List%26nbsp%3Ball%26nbsp%3Bresources%26nbsp%3Bin%26nbsp%3Bthe%26nbsp%3BWestEurope%26nbsp%3Bregion%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSTRONG%3Eaz%26nbsp%3Bresource%26nbsp%3Blist%26nbsp%3B--location%26nbsp%3Bwesteurope%26nbsp%3B--output%26nbsp%3Btable%3C%2FSTRONG%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CDIV%3E%3CSPAN%3E%23List%26nbsp%3Ball%26nbsp%3Bresource%26nbsp%3Bof%26nbsp%3Ba%26nbsp%3Bspecific%26nbsp%3Bregion%26nbsp%3Band%26nbsp%3Bresource%26nbsp%3Bgroup%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSTRONG%3Eaz%26nbsp%3Bresource%26nbsp%3Blist%26nbsp%3B-g%26nbsp%3Btw-rg01%26nbsp%3B--location%26nbsp%3Bwesteurope%26nbsp%3B--output%26nbsp%3Btable%3C%2FSTRONG%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CDIV%3E%3CSPAN%3E%23List%26nbsp%3Ball%26nbsp%3BVM's%26nbsp%3Bin%26nbsp%3Ba%26nbsp%3Bresource%26nbsp%3Bgroup%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSTRONG%3Eaz%26nbsp%3Bvm%26nbsp%3Blist%26nbsp%3B-g%26nbsp%3Btw-rg01%26nbsp%3B--output%26nbsp%3Btable%3C%2FSTRONG%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CDIV%3E%3CSPAN%3E%23Restart%26nbsp%3Ba%26nbsp%3BVM%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSTRONG%3Eaz%26nbsp%3Bvm%26nbsp%3Brestart%26nbsp%3B-g%26nbsp%3Btw-rg01%26nbsp%3B-n%26nbsp%3Btw-win2019%3C%2FSTRONG%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CDIV%3E%3CSPAN%3E%23Get%26nbsp%3Bthe%26nbsp%3Bpublic%26nbsp%3BIP%26nbsp%3Baddresses%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSTRONG%3Eaz%26nbsp%3Bnetwork%26nbsp%3Bpublic-ip%26nbsp%3Blist%26nbsp%3B-g%26nbsp%3Btw-rg01%26nbsp%3B--output%26nbsp%3Btable%3C%2FSTRONG%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CDIV%3E%3CSPAN%3E%23A%26nbsp%3Blist%26nbsp%3Bof%26nbsp%3BVNet's%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSTRONG%3Eaz%26nbsp%3Bnetwork%26nbsp%3Bvnet%26nbsp%3Blist%26nbsp%3B--output%26nbsp%3Btable%3C%2FSTRONG%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CDIV%3E%3CSPAN%3E%23All%26nbsp%3Bthe%26nbsp%3Bsubnets%26nbsp%3Bin%26nbsp%3Bthe%26nbsp%3Bspecific%26nbsp%3BVNet%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSTRONG%3Eaz%26nbsp%3Bnetwork%26nbsp%3Bvnet%26nbsp%3Bsubnet%26nbsp%3Blist%26nbsp%3B-g%26nbsp%3Btw-rg01%26nbsp%3B--vnet-name%26nbsp%3Bvnet-base%26nbsp%3B--output%26nbsp%3Btable%3C%2FSTRONG%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CDIV%3E%3CSPAN%3E%23Infos%26nbsp%3Babout%26nbsp%3Bthe%26nbsp%3BNSG%26nbsp%3B(Network%26nbsp%3BSecurity%26nbsp%3BGroup)%26nbsp%3Bin%26nbsp%3Ba%26nbsp%3Bspecific%26nbsp%3Bresource%26nbsp%3Bgroup%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSTRONG%3Eaz%26nbsp%3Bnetwork%26nbsp%3Bnsg%26nbsp%3Blist%26nbsp%3B-g%26nbsp%3Btw-rg01%26nbsp%3B--output%26nbsp%3Btable%3C%2FSTRONG%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CDIV%3E%3CSPAN%3E%23All%26nbsp%3Bthe%26nbsp%3Brules%26nbsp%3Bin%26nbsp%3Ba%26nbsp%3Bspecific%26nbsp%3BNSG%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSTRONG%3Eaz%26nbsp%3Bnetwork%26nbsp%3Bnsg%26nbsp%3Brule%26nbsp%3Blist%26nbsp%3B-g%26nbsp%3Btw-rg01%26nbsp%3B--nsg-name%26nbsp%3Btw-base-nsg%26nbsp%3B--output%26nbsp%3Btable%3C%2FSTRONG%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CDIV%3E%3CSPAN%3E%23Infos%26nbsp%3Babout%26nbsp%3Bthe%26nbsp%3BNIC's%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSTRONG%3Eaz%26nbsp%3Bnetwork%26nbsp%3Bnic%26nbsp%3Blist%26nbsp%3B--output%26nbsp%3Btable%3C%2FSTRONG%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CDIV%3E%3CSPAN%3E%23Lets%26nbsp%3Bshow%26nbsp%3Bthe%26nbsp%3BIP%26nbsp%3Bconfiguration%26nbsp%3Bof%26nbsp%3Ba%26nbsp%3Bspecific%26nbsp%3BNIC%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSTRONG%3Eaz%26nbsp%3Bnetwork%26nbsp%3Bnic%26nbsp%3Bip-config%26nbsp%3Blist%26nbsp%3B-g%26nbsp%3Btw-rg01%26nbsp%3B--nic-name%26nbsp%3Btw-linsrv536%26nbsp%3B--output%26nbsp%3Btable%3C%2FSTRONG%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CDIV%3EI%20am%20absolutely%20aware%20that%20this%20is%20nothing%20spectacular.%20I%20just%20wanted%20to%20share%20a%20few%20impressions%20with%20you.%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CDIV%3E%3CDIV%3E%3CP%3EI%20hope%20this%20article%20was%20useful.%20Best%20regards%2C%20Tom%20Wechsler%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EP.S.%26nbsp%3BAll%20scripts%20(%23PowerShell%2C%20Azure%20CLI%2C%20%23Terraform%2C%20%23ARM)%20that%20I%20use%20can%20be%20found%20on%20github!%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Ftomwechsler%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Ftomwechsler%3C%2FA%3E%3C%2FP%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2136615%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EHands-on-Labs%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMonitoring%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ENetworking%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EVirtual%20Network%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Frequent Contributor

 

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