This cheatsheet provides commands to manage authentication and authorization in Azure. It covers role assignments, identity provider configurations, and security policies. Designed for DevOps, it assists in creation, management, and troubleshooting of Azure AUTH and AUTHZ.
az role assignment list --assignee $(az ad signed-in-user show --query objectId -o tsv) --output table
az role assignment create --assignee <userId> --role Contributor --scope /subscriptions/<subscriptionId>
az role assignment delete --assignee <userId> --role Contributor --scope /subscriptions/<subscriptionId>
az role assignment list --output table
Note: Conditional Access policies are mostly configured via portal, but you can export/import policies.
az rest --method GET --uri "https://graph.microsoft.com/v1.0/identity/conditionalAccess/policies"
az ad policy list --output table
az role definition create --role-definition @custom-role.json
az role definition update --role-definition @updated-role.json
az role definition delete --name <roleName>
az monitor activity-log list --resource-group <rg> --query "[?contains(operationName.value, 'SignIn')]" --output table