基于 SOC 职业分类
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/fabioc-aloha/Alex_Skill_Mall --skill azure-identity-msi命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
Create or improve a Markdown instruction, skill, prompt, or agent from an explicitly selected file or user-identified text. Use when a user asks to optimize an existing brain artifact or create one for consistent future execution.
Clear documentation through visual excellence
Assess active Markdown brain files in a local AI agent project or plugin source without changing it. Use before modifying a brain or reviewing declared instructions, skills, prompts, agents, bundled Markdown resources, and research documentation.
| name | azure-identity-msi |
| description | Time Saved: 1-2 hours debugging identity and RBAC |
| lastReviewed | 2026-04-30T00:00:00.000Z |
Category: Azure Time Saved: 1-2 hours debugging identity and RBAC Battle-tested: Yes — multiple Azure deployments
You're configuring RBAC for an Azure resource's managed identity. You see principalId in one place, servicePrincipal in another, and objectId elsewhere. Documentation uses these terms interchangeably and you're not sure if they're the same thing.
A Managed Identity is a Service Principal — they're the same object viewed from different angles:
A Managed Identity IS a Service Principal in Entra ID. The principalId from the resource matches the Service Principal's Object ID in role assignments.
Azure Resource (VM, Function, Container App)
│
▼ creates
Managed Identity
│
▼ which IS
Service Principal in Entra ID
│
▼ gets assigned
RBAC Role on Target Resource
When debugging RBAC issues, verify the chain:
# For a Container App
az containerapp show \
--name myapp \
--resource-group myrg \
--query identity.principalId
# For a Function App
az functionapp show \
--name myfunc \
--resource-group myrg \
--query identity.principalId
# For a VM
az vm show \
--name myvm \
--resource-group myrg \
--query identity.principalId
# The principalId should match an SP's objectId
az ad sp show --id <principalId> --query objectId
# List role assignments on the target resource
az role assignment list \
--scope /subscriptions/{sub}/resourceGroups/{rg}/providers/{provider}/{resource} \
--query "[].{principal:principalId,role:roleDefinitionName}"
# Principal from resource should appear in role assignments
# with the expected role (Reader, Contributor, etc.)
| Role | When to Use |
|---|---|
| Reader | Read-only access to resources |
| Contributor | Full access except RBAC management |
| Owner | Full access including RBAC |
| Storage Blob Data Reader | Read blobs (not just management) |
| Key Vault Secrets User | Read secrets from Key Vault |
Note: Management roles (Reader, Contributor) don't grant data plane access. For blob storage, you need "Storage Blob Data *" roles.
# Assign role to managed identity
PRINCIPAL_ID=$(az containerapp show \
--name myapp \
--resource-group myrg \
--query identity.principalId -o tsv)
az role assignment create \
--assignee-object-id $PRINCIPAL_ID \
--assignee-principal-type ServicePrincipal \
--role "Storage Blob Data Reader" \
--scope /subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.Storage/storageAccounts/{account}
| Type | Creation | Lifecycle | Use Case |
|---|---|---|---|
| System-assigned | With resource | Deleted with resource | Single-resource identity |
| User-assigned | Separately | Independent | Shared across resources |
# Enable system-assigned identity
az containerapp identity assign \
--name myapp \
--resource-group myrg \
--system-assigned
# Create user-assigned identity
az identity create \
--name myidentity \
--resource-group myrg
# Assign user-assigned to resource
az containerapp identity assign \
--name myapp \
--resource-group myrg \
--user-assigned myidentity
azure-subscription-context — Subscription issuesazure-swa-gotchas — SWA-specific identity issues