This post will show you how to install the Azure CLI.
First you need to install the CLI.
Once it is installed you can set your config directory. This is useful for having multiple logins going at the same time.
set AZURE_CONFIG_DIR=<YOUR_DIRECTORY>
You can then login. There are different ways to do that
Way 1: This will popup a login where you enter your login credentials
az login
Way 2: This will ask you for password via the command line
az login -u <YOUR_LOGIN>
Way 3:
az login -u <YOUR_LOGIN> -p <YOUR_PASSWORD>
Way 4: logs in as a service principal
az login --service-principal --user-name <SPN_ID> --password <SPN_KEY> --tenant <TENANTID>
Show your Account
az account show
Set Account Subscription
az account set -s <SUBSCRIPTION_ID>
List Tags For A Resource
az tag list --subscription <SUBSCRIPTION_NAME>
Install Graph
az extension add --name resource-graph
Query for Anything that Has a Tag
az graph query -q "resourceGraoup, type, tags" | where tags.<TAG_NAME>=~'<VALUE>'
Query for More than One Tag
az graph query -q "resourceGraoup, type, tags" | where tags.<TAG_NAME>=~'<VALUE>' | tags.<TAG_NAME>=='<VALUE>'
Query Type
az graph query -q "resourceGroup, type, tags" | where type =~ 'microsoft.sql/servers/databases'
You must be logged in to post a comment.