Azure CLI Cheat Sheet

Quick reference for commonly used commands

Azure CLI Reference Documentation

Authentication

Service Principal

Login

az login --service-principal --username <user-name-xxxx-xxxx-xxxxxxxxxxxx> --password <password> --tenant <tenant>

Whoami

az ad sp show --id <user-name-xxxx-xxxx-xxxxxxxxxxxx>

View Role Assignments and Permissions

  • Get assignee from az login ... | jq -r '.[].user.name

az role assignment list --assignee $az_user --all --include-inherited | jq -r '.[].roleDefinitionName' | while read rolename; do az role definition list --name "$rolename" | jq -r '.[]'; done

Last updated

Was this helpful?