Samples for creating Azure infra
- Azure CLI
- az login
- jq - utility for extracting values from json
If you have multiple subscriptions then set subscription after completing the login.
az login
az account list
az account set --subscription="SUBSCRIPTION_ID"
Useful Azure CLI commands
az account list
You will find the subscriptionId and tenantId displayed.
Get your account information
az account list --output json | jq -r '.[].name'
az account show --output json | jq -r '.id'
az group list
az resource list
az resource list --location australiaeast
az resource list --resource-group SuperfundLookupRG
LOCATION=xxx
GROUPNAME=xxx
az group create --name $GROUPNAME --location $LOCATION
az storage account create \
--name STORAGENAME
--resource-group $GROUPNAME \
--location $LOCATION \
--sku Standard_LRS \
--kind Storage
az ad sp create-for-rbac -n "Packer" --role contributor \
--scopes /subscriptions/{SubID}
az role definition list --output json | jq ".[] | {name:.roleName, description:.description}"