Azure
1. Authentication & Setup
User
export EMAIL=''
export PASSWORD=''
export AZURE_CONFIG_DIR="$(pwd)/<STORE_SESSION_FILES_FOLDER>"
az login -u "$EMAIL" -p "$PASSWORD" [--allow-no-subscriptions]
export SUBSCRIPTION_ID=$(az account show --query id --output tsv)
export TENANT_ID=$(az account show --query tenantId --output tsv)
export MY_OID=$(az ad signed-in-user show --query id -o tsv)ARM (Service Principal Authentication)
export ARM_CLIENT_ID=''
export ARM_SECRET=''
export TENANT_ID='fdd066e1-ee37-49bc-b08f-d0e152119b04'
export AZURE_CONFIG_DIR="$(pwd)/<STORE_SESSION_FILES_FOLDER>"
az login --service-principal -u "$ARM_CLIENT_ID" -p "$ARM_SECRET" --tenant "$TENANT_ID" [--allow-no-subscriptions]
export SUBSCRIPTION_ID=$(az account show --query id --output tsv)
export TENANT_ID=$(az account show --query tenantId --output tsv)
# Alternative 1
export MY_OID=$(az ad sp show --id $ARM_CLIENT_ID --query id -o tsv)
# Alternative 2
MY_OID=$(az ad sp show --id $(az account show --query user.name -o tsv) --query id -o tsv)Connection Information
Displays details of the currently authenticated user.
Lists all subscriptions accessible by the current user
2. Account Enumeration
Groups
Retrieves every group in the tenant.
Retrieve Azure AD groups and directory roles assigned to the current identity.
Get groups where the user is a member
List dynamic Azure AD groups (membership rule-based)
Roles
Get Entra ID roles assigned and its definition (One Liner)
Get Entra ID roles assigned and its definition (Manual)
List Azure Roles & Show Role actions definitions for a given scope (One Liner)
List Azure Roles & Show Role actions definitions for a given scope (Manual)
Find Custom Azure Roles
Service Principals
Users
Enumerate EntraID Users
Resources
Get Resource List
Check what actions you can execute on every specific resource after all role inheritance and assignments are calculated.
Identities
List managed identities in the resource group
Storage accounts
Enumerate storage accounts
In case case Firewall is set to "Deny", execute the following command to check the allowed roules.
Enumerate keys
Containers
Enumerate storage containers for a given account
Enumerate files inside the container
Download the file
Script to check all the storage accounts, its containers and the files inside them
File Shares
Enumerate Shares
Enumerate Files inside the Dir
Download the file
Enumerate snapshots
For each snapshot in the share name, enumerate its files
Applications
Enumerate applcations and miss configurations
Implicit Grant (
ImpAccess/ImpID)
The Risk: If
enableAccessTokenIssuanceorenableIdTokenIssuanceistrue, the application is using the Implicit Flow.Attack: This flow is legacy and insecure. Tokens are returned directly in the URL fragment (after the
#), making them susceptible to theft via browser history, logs, or Referer headers.
Public Client (
Public)
The Risk: If this is
true(orisFallbackPublicClientis enabled), the application is considered a "Public Client" (like a mobile app or a script).Attack: These apps do not require a Client Secret to authenticate. If you find a valid username/password (via spraying), you can often authenticate directly against this App ID without needing a secret.
Redirect URIs (
Redirects)
The Risk: These are the URLs where Azure sends the auth token after login.
Attack:
Open Redirects: If a URI is overly broad (e.g.,
[https://example.com/](https://example.com/)*), you might be able to craft a link that sends the token to a server you control.Subdomain Takeover: If one of the listed URLs points to a dead subdomain, you can claim that subdomain and hijack any tokens sent to it.
Required Resource Access (Permissions)
If you want to see what this application is actually allowed to do (e.g., "Read all Mail," "Directory.ReadWrite.All"), add this to the query:
Perms:requiredResourceAccess[].resourceAccess[].id
See the application's permissions and internal identifier URIs (great for finding internal domain names
Identify the target app
Identify users or service principals that have administrative rights over this application.
KeyVault
Who has access to the key vault
Enumerate KeyVault keys
Enumerate KeyVault secrets
Kyevault OneLiner - Enumerate the vaults, keys and its secrets
VMs
Obtain Machine user identities
Disks
Table Storage
MSSQL
Enumerate servers
Identify information from a given server
Obtian information from the database perspective
MySQL
Enumerate Database Servers
Enumerate Databases
FIrewall Rules
List AD admins and users
List backups and replicas
Enumerate Monitoring Mechanisms
Get the server's advanced threat protection setting
Audit Logging Enabled
List all of the maintenances of a flexible server
List log files for a server
PostgreSQL
Database Servers
Databases
Enumerate Firewalls
Flexible servers
CosmosDB
Enumerate Instances
Obtain keys
MongoDB
App Services
Get the App Settings (API Keys, DB Strings, etc.)
Retrieves the publishing profiles
Azure Container Registry
Function Apps
List functions
Get details about the source of the function code
Retrieve the publishing profiles for a specific Azure Function App
Get SCM credentials
Get function, system and master keys
Static Web Apps
Get appsettings
Get env information
Get current snippets
Get database connections
Azure Container Registry (ACR)
List of all authentication tokens
Retrieve recently deleted repositories
Retrieve active repositories
List tasks runs
Azure Container Instances
Queue Storage
Automation Accounts
Get keys of automation account. These are used for the DSC
Get schedules of automation account
Get jobs of an automation account
Get runbooks of an automation account
Get runbook content
Get variables of automation account. It's possible to get the value of unencrypted variables but not the encrypted ones.
Get credentials of automation account
Get credential details. Note that you will only be able to access the password from inside a Runbook
Service Bus
Namespace Enumeration
Authorization Rule Enumeration
Queue Enumeration
Topic Enumeration
Susbscription Enumeration
Logic Apps
Virtual Desktop
Monitoring Logs
Get The Flag
KeyVault
Blob
SSRF
Obtain tokens
Manual
Bash: Exfiltrate all the tokens
PowerShell: Exfiltrate all the tokens
Azure App & Functions Services & Automation Accounts
From the env you can get the values of IDENTITY_HEADER and IDENTITY_ENDPOINT. That you can use to gather a token to speak with the metadata server.
Bash
Examples:
Curl
Wget
PowerShell
Examples
Azure Cli Configuration Files
The az session files are found in the folder:
Linux/macOS:
~/.azure/Windows:
%USERPROFILE%.azure
Where you will find
Between all of them, the most important files are:
azureProfile.json: This is primarily Azure CLI account/subscription context, Azure CLI uses this information to know which Azure subscription and tenant you're operating against when you run commands such as:msal_token_cache.jsonormsal_token_cache.bin: Azure CLI uses Microsoft's MSAL (Microsoft Authentication Library) to authenticate with Microsoft Entra ID, as it contains the access (last between 60-90 minutes) and refresh tokens (last up to 90 days). Themsal_token_cache.binis ciphered with Windows DPAPI, access decrypting blobs to retrieve the unecrypted version.
MiTM
Tool
azure-cli-mitm: Proxy to intercept Azure CLI REST communications and append or modify Authorization Bearer tokens per Azure service domain.
Manual Analysis
Tools
azure-cli-mitm: Proxy to intercept Azure CLI REST communications and append or modify
AuthorizationBearer tokens per Azure service domain.AzurePEAS: Enumerates the principals permissions within your Azure and Entra ID environments, with a special focus on detecting privilege escalation pathways and identifying potential security risks.
CloudSploit: Open-source project designed to allow detection of security risks in cloud infrastructure accounts.
Cloudfox: Helps you gain situational awareness in unfamiliar cloud environments.
Last updated