Skip to content

CLI

Basic

Tool Description
azure-cli
CloudShell
  • Browser-based shell environment allows to manage and configure Azure services
  • It provides a host of tools, including Azure CLI, Azure PowerShell, Ansible, Terraform, Chef, Puppet Bolt, kubectl, and many more
Start CLI
 docker run -it -v ${HOME}/.ssh:/root/.ssh mcr.microsoft.com/azure-cli

CLI

Basics (az...)

Command Notes
login Login to Azure (and follow instructions on screen)
account list --output table List Subscriptions
account show Get the details of current Subscription
group list List all the resource groups in a subscription
az resource list --resource-group <ID> --resource-type Microsoft.Web/sites List all the resources in a resource group

IAM (az...)

Command Notes
az role definition list --custom-role-only true
--output json | jq '.[] | {"roleName":.roleName, "roleType":.roleType}'
List all custom roles
az role definition list --name "Virtual Machine Operator" View definition for a specific role
role definition list --name "Virtual Machine Contributor"
--output json | jq '.[] | .permissions[0].actions'
List permissions for the built-in role Virtual Machine Contributor
az role assignment list --role "Virtual Machine Operator" List custom role assignment
az role definition create --role-definition vm-operator-role.json Create custom role
az role assignment create --assignee $USER --role "Virtual Machine Operator" Assign custom role
az role assignment delete --role "role name"
az role definition delete --name "role name"
Delete custom role