Skip to content
Pwnversity
CLOUD-AZUREintermediate · 5 min · upd. 2026-10

Azure Pentesting

Azure differs from AWS/GCP in one key point: it’s deeply intertwined with Entra ID (formerly Azure AD), the identity that also governs Microsoft 365. That means an Azure compromise can extend to M365 and vice versa (see Microsoft 365 and Entra ID), and that enumeration and escalation revolve around the tenant’s users, roles, applications, and managed identities. It’s the most common cloud environment in companies already using Windows/AD.

Azure has two independent planes, each with its own roles and escalation: the identity plane (Entra ID) and the resource plane (Azure Resource Manager). The attacker gets in with a user, a service principal, or a stolen token, maps the tenant, and looks for the jump to Global Administrator (Entra) or Owner (ARM). A critical link: a Global Admin can elevate to control all subscriptions. Hot vectors: service principals with excessive API permissions, illicit app consent, VM managed identities, and poorly governed PIM.

flowchart TB
    U[User / SP / token] --> E[Entra ID]
    U --> R[Azure RM]
    E -->|directory roles| GA[Global Administrator]
    R -->|RBAC: roleAssignments/write| OW[Owner]
    E -->|illicit consent / app perms| T[User tokens]
    R -->|VM Managed Identity| MI[Resource token]
    GA -->|elevate access| OW
    OW --> C[Subscription control]

Theory: Entra ID and Azure Resource Manager

Section titled “Theory: Entra ID and Azure Resource Manager”
  • Entra ID (identity): users, groups, applications, service principals, and directory roles (Global Administrator, Privileged Role Administrator…). It also governs M365.
  • Azure RM (resources): subscriptions, resource groups, VMs, storage, and RBAC roles (Owner, Contributor, User Access Administrator…).

These are two distinct permission hierarchies. Enumeration must cover both.

Ventana de terminal
# ways in
az login # interactive user
az login --service-principal -u <appId> -p <secret> --tenant <tenantId>
# stolen tokens, refresh tokens (see cloud-m365), managed identities (see cloud-metadata)
Ventana de terminal
az account show ; az ad signed-in-user show
az role assignment list --all # resource RBAC
az ad app list ; az ad sp list # apps and service principals
az resource list

Specialized tools: ROADrecon (exhaustive Entra ID dump to a database), AzureHound + BloodHound (escalation-path graph, as powerful as in on-prem AD), MicroBurst (PowerShell enum/exploitation scripts).

Ventana de terminal
# ROADrecon
roadrecon auth -u user@target.com -p 'Password'
roadrecon gather
roadrecon gui
# AzureHound -> ingest into BloodHound
azurehound -u user@target.com -p 'Password' -t target.com list --output az.json

In Entra ID:

  • Application / Service Principal with excessive API permissions (e.g. RoleManagement.ReadWrite.Directory, Application.ReadWrite.All).
  • Directory roles misassigned: Privileged Role Administrator lets you grant yourself Global Admin.
  • Illicit consent grant: a malicious app requests permissions and the user consents → tokens.
  • Dynamic groups misconfigured (add yourself to a privileged group by changing an attribute).

In Azure RM:

  • Microsoft.Authorization/roleAssignments/write (User Access Administrator) → assign yourself Owner.
  • Managed Identity of a VM/function with permissions → steal its token (see Metadata Service (IMDS)).
  • Automation Accounts / Runbooks with credentials or privileged identities.

Managed Identities (the instance-role equivalent)

Section titled “Managed Identities (the instance-role equivalent)”
Ventana de terminal
# from a compromised VM, request its Managed Identity token (see cloud-metadata)
curl -s -H "Metadata:true" \
"http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com/"
# use the token to act as that identity
az rest --method get --url "https://management.azure.com/subscriptions?api-version=2020-01-01"
  • Add credentials (clientSecret/certificate) to a Service Principal → persistent access.
  • Create an app with permissions and consent; add a user to a privileged role.
  • Federation backdoors (see Microsoft 365 and Entra ID) — very stealthy, requires Global Admin.
  • MFA and Conditional Access for all users, especially privileged ones; block legacy protocols.
  • PIM (Privileged Identity Management): privileged roles just-in-time, not permanent.
  • Review app/Service Principal permissions and consent (block user consent to apps).
  • Least-privilege RBAC; watch roleAssignments/write and custom roles with Microsoft.Authorization/*.
  • Logs: Entra ID sign-in/audit logs, Azure Activity Log, Microsoft Defender for Cloud; alerts on role and SP credential changes.
  • Access with user/SP/token and az account show
  • Enumerate Entra ID (ROADrecon) and RM resources
  • AzureHound + BloodHound for escalation paths
  • Apps/Service Principals with excessive permissions / consent
  • roleAssignments/write → Owner; directory roles → Global Admin
  • VM/function Managed Identities (Metadata Service (IMDS))
  • Automation Accounts/Runbooks with credentials
  • Bridge to M365 (Microsoft 365 and Entra ID) and persistence