Azure CLI Cheat Sheet

Quick reference for commonly used commands

Authentication

Login

Identity Enumeration

Whoami

  • Look up current authenticated identity

  • Look up a specific identity

View Azure Role Assignments and Permissions

Users, Service Principals, Workload Identities, and Managed Identities can have Azure RBAC permissions assigned directly

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

View Azure Role Assignments and Permissions (Group)

Users and Service Principals can have Azure RBAC permissions assigned via Group membership

View Entra ID Group Membership Info

  • Get all groups a user is a member of, returns group name(s), group ids, and more

  • Get the group id for a group name (also in the output of previous command)

View Azure Roles Assigned to Group

  • Get the role definition id(s) for roles assigned to the group

View Azure Role's Permissions

  • Get the Azure RBAC permissions assigned to the role


Compute

Virtual Machines

List VM Extensions


Security

Key Vault

List Key Vault

List Secrets in Key Vault

Retrieve Secrets from Key Vault


Storage

Storage Account

Enumerate Storage Account Access Keys

Enumerate Storage Accounts

Storage Containers

List Storage Containers

  • Get account-name from az storage account list | jq -r '.[].name'

Restore Deleted Storage Container

Check if Versioning is Enabled on Container

  • Like AWS S3 objects, Azure supports versioning of data too

Blobs (files)

View Blobs in Container

  • Get container-name from az storage container list... jq -r '.[].name'

Check Available Blob Versions

  • --include v shows versions of the blobs

Stream Blob Content

  • View file contents without downloading the file

Download Blobs

  • Downloads the file to the destination

Tables

List Storage Tables

Query Storage Entities

  • These exist within a Storage Table

Last updated

Was this helpful?