...
Exercise - Install and run the Azure CLI - information on how to do it for Mac and Linux as well
...
Tips and Tidbits
You can install it locally on computers running the Linux, macOS, or Windows operating systems.
You can also use Azure CLI from a browser through Azure Cloud Shell.
Azure CLI can be used interactively or through scripts
how do you find the particular commands you need? One way is to use
az find
.If you already know the name of the command you want, the
--help
argument for that command will get you more detailed information on the commandAz is the formal name for the Azure PowerShell module, which contains cmdlets to work with Azure features.
This module is an open-source component available on GitHub.
...
Installing Azure AZ CLI
Official installation instrutions: https://docs.microsoft.com/en-us/powershell/azure/install-az-ps
Uninstall the older shell Uninstall the Azure PowerShell
...
Sign-in to your Azure account. https://www.craigforrester.com/posts/azure-cli-basics-logging-in/
Code Block |
---|
az login |
If you need to use Azure PowerShell CLI
Code Block |
---|
Connect-AzAccount |
If you need to use the deprecated CLI
...
Code Block |
---|
let rNum=$RANDOM*$RANDOM |
...
Create a template from all resources in a resource group
To export all resources in a resource group as it exists right now, use az group export and provide the resource group name.
Code Block |
---|
az group export --name demoGroup |
You can save a template from a deployment in the deployment history. The template you get is exactly the one that was used for deployment.
Code Block |
---|
az deployment group export --resource-group demoGroup --name demoDeployment |
...
List AD Tenants
Code Block |
---|
az account tenant list |
...
Source: Create virtual networks
...
Query / Filter Output
If you have several items in the group list, you can filter the return values by adding a --query
option
Code Block |
---|
az group list --query "[?name == '$RESOURCE_GROUP']" |
The query is formatted using JMESPath, which is a standard query language for JSON requests. You can learn more about this powerful filter language at http://jmespath.org/
...
List Resource Groups Starting With Name Pattern
...