/azure-core:accessfrom azure-core
Use when giving an Azure identity access to a resource, or finding why one is refused. Picks the identity first: a user-assigned managed identity for anything in Azure, a federated credential for GitHub Actions or other outside workloads, an app registration last. Then the role on the right plane, since Contributor and Owner carry no DataActions: Key Vault Secrets User, Storage Table and Blob Data roles, AcrPull, or Container Registry Repository Reader in ABAC mode. Covers who may assign roles (Owner, User Access Administrator, Role Based Access Control Administrator, PIM activation first), resource provider registration, propagation and the managed identity token cache, the AZURE_CLIENT_ID that azure/login and Azure Identity read as different identities, escalation through federated credentials, listKeys and Key Vault access policies, and credential expiry. Errors: 401, 403, AuthorizationPermissionMismatch, ForbiddenByRbac, MissingSubscriptionRegistration, AADSTS70021, AADSTS700213, AADSTS7000222.
Ships in azure-core. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Most Azure access failures come down to four things: the wrong identity is calling, its role sits on the wrong plane, the role was never assigned because whoever deployed could not assign roles, or the change has not reached the caller yet. This skill walks them in that order, for an identity calling Key Vault, Storage, Container Registry or Application Insights from a deploy pipeline or a running app.
Dated, and drilled from Microsoft Learn and az 2.90.0 on
2026-10-17, with later lines dated where they stand. A line marked
live ran against one client tenant (references/pim.md, and roles.md's
Functions section, 2026-10-25); the rest did not, and a line marked
unverified says what was not checked.
Not here. Fabric workspace roles and OneLake permissions, which
Azure RBAC does not govern. The Container Apps runtime: ingress,
probes, revisions. Bicep syntax and its green-build traps, bar
principalType, which references/errors.md covers. GitHub's half of
OIDC: the subject each trigger puts in the token. Sign-in policy for
people: Conditional Access and MFA. Data roles for Cosmos
DB, Service Bus, SQL and other services were not drilled.
Detail lives in references/: roles.md (the data-plane roles per
service, a Functions app with no keys, Contributor's exclusions, who
holds which write, both permission models), errors.md (401 and 403
codes by service, deploy
errors, AADSTS codes in Learn's words), identity-types.md (credential
types, lifetimes, Key Vault's expiry semantics), pim.md (reading
active and eligible roles, the activation the user sends, waiting for
it) and naming.md (the name a new identity, credential, group or
resource takes).
Each cites the Learn page behind its claims. Past them, Learn, by
microsoft-learn-mcp (microsoft_docs_search, then
microsoft_docs_fetch), or with no server, curl -sL -H 'Accept: text/markdown' <page URL> (undocumented, read 2026-11-07). A live page that contradicts a line here wins:
say so, act on the page, and route the fix by capture-learning, bar
a dated measured line that names the page it overrules and the call that
measured it, which a page changed since its date sends back to re-measure.
An observed claim is cited or marked pending a doc check, and stands, marked
observed, only where no page covers it.
Pin the tenant before any az call: set AZURE_CONFIG_DIR to a
directory kept for that tenant alone, since unset it is the shared
~/.azure, and an unpinned shell answers from whatever tenant that
config last held, so every listing below describes the wrong directory.
A pin is a directory, not a login: check az account show after it.
Where a user-scope CLAUDE.md names a directory per tenant, take that
one.
Every identity has two IDs, and each command wants one. A managed
identity or service principal has a client (application) ID and a
principal (object) ID. Role assignments take the principal ID:
--assignee-object-id is "The assignee's object ID (also known as
principal ID)", and skips the Microsoft Graph lookup --assignee makes.
azure/login's client-id, AZURE_CLIENT_ID and the SDKs' client_id
take the client ID.
az identity show -g <rg> -n <identity> --query "{clientId:clientId, principalId:principalId}" -o json
Name who actually called before reading any role: the azure/login
step's log for a pipeline, the credential the app builds (§6) for an
app, az account show for a person. A 403 diagnosed against the wrong
principal ends with roles granted to an identity that was never in the
request.
Best first; take the first that fits.
https://token.actions.githubusercontent.com and the audience
api://AzureADTokenExchange, exactly one; the subject is whatever
the job's token carries, which depends on its trigger.AADSTS700213 for the
subject or AADSTS700211 for the issuer.AADSTS70021; wait, and retry.dependsOn in a
template.az 2.90.0 shows a preview
--claims-matching-expression-value on az identity federated-credential create (2026-10-17).references/identity-types.md has Learn's ranking and
the lifetimes.A new identity, credential or group is named by
references/naming.md before it is proposed, the tenant's own
pattern first where its existing names show one; an existing one keeps
its name.
Admin consent is not the app owner's to give. Tenant-wide consent takes Privileged Role Administrator for any API, or Cloud Application, Application or AI Administrator for any API except Microsoft Graph app roles. Application Developer can register apps and update those it owns, and consents only on its own behalf. Where the user holds Application Developer, a consent request goes to the organization's identity team.
A Fabric service principal needs no API permissions: Fabric
authorizes it by tenant setting, security group and workspace role. In a
repo that also links fabric, rest-api's
references/auth.md has the detail.
Contributor and Owner manage resources, and read no Key Vault or
Storage data. Azure RBAC keeps the control plane in a role's
Actions and the data plane in its DataActions. Contributor holds
Actions: * and no DataActions, so a Contributor's token gets no
secret value from Key Vault and no blob or table entity from Storage.
Container Registry differs: its legacy roles hold pull and push as
Actions, which * covers, until the registry runs ABAC mode, where
Owner, Contributor and Reader "grant only control plane permissions".
Grant the data role for the operation, at the resource:
| The caller needs to | Grant | Not |
|---|---|---|
| Read a Key Vault secret's value | Key Vault Secrets User | Key Vault Reader, metadata only |
| Create, update or delete secrets | Key Vault Secrets Officer | Key Vault Contributor, control plane only |
| Read table entities | Storage Table Data Reader | Reader or Contributor |
| Write table entities | Storage Table Data Contributor | Storage Account Contributor |
| Read or write blobs | Storage Blob Data Reader or Contributor | Contributor |
| Pull images, RBAC-only registry | AcrPull | Contributor, which works but over-grants |
| Pull images, ABAC-enabled registry | Container Registry Repository Reader | AcrPull, not honored |
| Push images, ABAC-enabled registry | Container Registry Repository Writer | AcrPush, not honored |
| Run a Functions host on its storage account | Storage Blob Data Owner and Storage Table Data Contributor | Storage Blob Data Contributor, below Learn's minimum |
| Send Application Insights telemetry by Entra | Monitoring Metrics Publisher, on the Application Insights resource | Contributor |
A Functions app with no keys needs three settings beside those
roles, and on Flex Consumption an authentication block of its own for
the deployment container: references/roles.md § "A Functions app with
no keys".
Check the permission model before the role. Two services keep a second model beside plain RBAC, and a correct role does nothing under the other one:
Key Vault: enableRbacAuthorization true is RBAC; false or
null is access policies, under which the Key Vault roles do nothing.
RBAC became the default only for vaults created with API version
2026-02-01 or later, "This default applies only to create
operations", so a template pinned to an older API version still
creates an access-policy vault.
az keyvault list -g <rg> --query "[].{name:name, rbacEnabled:properties.enableRbacAuthorization}" -o table
Container Registry: in ABAC mode, rbac-abac, "Legacy ACR roles
such as AcrPull, AcrPush, and AcrDelete are not honored", and
Owner, Contributor and Reader grant the control plane only.
az acr show -n <registry> -g <rg> --query roleAssignmentMode -o tsv
It prints ARM's value, AbacRepositoryPermissions in ABAC mode and
LegacyRegistryPermissions in RBAC-only mode, never the CLI's
rbac-abac (Learn's RoleAssignmentMode SDK pages, read 2026-11-17).
Image pull by managed identity has a switch on the registry. "Your
Azure Container Registry must allow ARM audience tokens for
authentication in order to use managed identity to pull images";
without it, pulls fail UNAUTHORIZED "token validation failed". Check
with az acr config authentication-as-arm show -r <registry>.
Scope the role to the resource, the vault, account or registry, not the resource group: a group-scope grant reaches every vault and account the group will ever hold. Learn's Key Vault guidance is "a vault per application per environment ... with roles assigned at the key vault scope".
Assigning a role takes Microsoft.Authorization/roleAssignments/write,
which Owner, User Access Administrator and Role Based Access Control
Administrator hold. Contributor's NotActions exclude
Microsoft.Authorization/*/Write, "Create roles, role assignments,
policy assignments...". So a template holding role assignments, deployed
as Contributor, creates its resources and then fails at the first role
assignment, with an authorization error naming
Microsoft.Authorization/roleAssignments/write (a client repo,
2026-09-25). Deploy as a principal holding the write, or split the role
assignments into a deployment such a principal runs. An identity created
in that access template and attached as existing by the main one
leaves an empty resource group with nothing to run first, though access
then main is clean in an existing environment: create the identity in
main and keep only the assignments in the access template, accepting one
deploy where the app runs before its roles, or run main once without the
identity (unverified: reasoned from two templates, not run against an
empty group, 2026-10-25).
Role Based Access Control Administrator without conditions is close to Owner. Learn lists it as able to "Assign themselves or others the Owner role". Delegate it with conditions limiting which roles and which principals it may assign; Key Vault Data Access Administrator is the built-in example, constrained to the Key Vault roles.
Under PIM, activate first. "If users are eligible for a role, then
they must activate the role assignment before using the role." An
eligible Owner deploying unactivated deploys as whatever is active, and
fails as above. After activating, sign out and back in, since Resource
Manager caches (§7 step 5). The agent reads PIM; the user
activates. Read active and eligible roles with az rest, never Az
PowerShell, which ignores the tenant pin, and draft the activation for
the user to send: PIM records it under their name and reason, and may
ask for MFA. references/pim.md has the calls, the body and the wait.
Registering a resource provider is a subscription-level act. It
takes the provider's /register/action, which Contributor and Owner
include, held on the subscription: the request path is
/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/register.
A template registers the providers it defines when the deployer can,
and a deploy identity with Contributor on one resource group cannot, so
the first deploy of a new resource type fails
MissingSubscriptionRegistration (a client repo, 2026-09-29). Learn
offers no template resource type for registering, so register once,
outside the template, as someone with rights on the subscription:
az provider register --namespace <namespace> --wait
Contributor on a resource group reaches further than its resources. Check each route before granting it on a group that holds identities, vaults, storage or anything that runs code:
Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials/write
falls inside Contributor's *, and none of its NotActions excludes
it; a federated credential lets the issuer and subject it names get
tokens as the identity. So a Contributor there can make the identity
trust a workload of its own and act with every role the identity
holds. Learn states both premises, not the conclusion, so this is
derived; a client repo's Key Vault decision record reached it too.Contributor, Key Vault Contributor, or any role
that includes Microsoft.KeyVault/vaults/write permissions can grant
themselves data plane access by configuring a Key Vault access
policy." An RBAC vault can become one: Learn's default-model page says
changing enableRbacAuthorization takes
Microsoft.KeyVault/vaults/write, which Contributor holds, where the
RBAC guide asks for unrestricted roleAssignments/write. Untested, so
treat a Contributor as able to switch it (derived, 2026-11-03).listKeys on a storage account. Owner, Contributor and Storage
Account Contributor "do not provide access to the table data within
that account via Microsoft Entra ID. However, if a role includes
Microsoft.Storage/storageAccounts/listKeys/action, then a user to whom
that role is assigned can access data in the storage account via
Shared Key authorization". Close it with allowSharedKeyAccess: false; while the property is unset, Shared Key is allowed. A
Functions app on that account may read keys two ways, by
AzureWebJobsStorage and on Flex Consumption by
DEPLOYMENT_STORAGE_CONNECTION_STRING: move both to its identity
before closing it.So keep an identity whose roles matter in a resource group where only its owners hold Contributor. The Entra side has the same shape: Application and Cloud Application Administrator "can add credentials to an application, and use those credentials to impersonate the application's identity".
AZURE_CLIENT_IDThe same name means the deploy identity in a workflow and the app's identity in its container.
azure/login's client-id, usually fed from
secrets.AZURE_CLIENT_ID, is the identity the workflow deploys as,
copied "from your Microsoft Entra application or user-assigned managed
identity".DefaultAzureCredential's managed_identity_client_id "Defaults to
the value of the environment variable AZURE_CLIENT_ID, if any. If not
specified, a system-assigned identity will be used." Its first link,
EnvironmentCredential, reads the same variable as an app
registration's ID when a secret or certificate variable sits beside
it.ManagedIdentityCredential reads no variable: it
"defaults to using a system-assigned identity", so with only a
user-assigned identity attached it asks for one that may not exist.
Pass client_id.<prefix>__credential = managedidentity and <prefix>__clientId.
Without the client ID or a resource ID, "the system-assigned identity
is used", the same trap.So a template or workflow that copies its own AZURE_CLIENT_ID into
the container's environment points the app at the deploy identity.
Keep two names in the template, such as deployClientId and
workerClientId, and set the container's AZURE_CLIENT_ID from the
user-assigned identity's clientId. In production, construct the
specific credential: "Specifying this exact type of credential prevents
other available credentials from being picked up unexpectedly."
Each step rules out a class of cause before the next one costs anything.
Read the code, not the status. A 401 means the service had no
token it accepts: the wrong tenant or audience, an expired secret
(AADSTS7000222), a federated credential matching nothing
(AADSTS700213, AADSTS700211, AADSTS70021), or a registry
refusing ARM-audience tokens. A 403 means it knew the caller and
refused it: no data role (AuthorizationPermissionMismatch from
Storage; Forbidden or ForbiddenByRbac from Key Vault, or
AccessDenied under access policies), Shared Key disabled
(KeyBasedAuthenticationNotPermitted), or the network. Learn's RBAC
troubleshooting adds that a role change not yet seen can show as
Status: 401 (Unauthorized). references/errors.md has each code.
Name the caller (§1), and for an app the credential it built (§6).
List what the caller holds at the target, inherited included. Learn's own registry troubleshooting runs:
az role assignment list --assignee <principalId> --scope <resourceId> --include-inherited -o table
--include-inherited defaults off, and without it a role granted on
the resource group or the subscription is missing from the list;
without --scope, "only assignments scoped to subscription will be
displayed". Add --include-groups for a role held through a group,
and use --assignee-object-id in place of --assignee where Graph
is out of reach; whether the two combine was not checked
(unverified, az 2.90.0, 2026-10-17). Upstream's live role check
passes neither flag.
Check the plane and the model (§3): a data role for this operation, on a vault in RBAC mode or a registry in the mode the role belongs to, with Shared Key allowed if the caller signs with keys.
Check the clock. Learn gives "up to 10 minutes" for a role
change in its RBAC troubleshooting, "up to 30 minutes" on the Storage
authorization pages, and hours at management-group scope for roles
with DataActions. A person refreshes by signing out and in. A
managed identity cannot: its tokens are cached "per resource URI for
around 24 hours", "it isn't possible to force a managed identity's
token to be refreshed before its expiry", and a change to its group
membership "can take several hours". So grant a managed identity its
roles directly, not through a group, and before the resource using it
starts.
Network last. A firewall, a private endpoint or disabled public
access also returns 403, with its own code: AuthorizationFailure
from Storage, ForbiddenByFirewall from Key Vault.
App secrets and certificates expire on Entra's clock; list both
kinds. az ad app credential list shows passwords unless given
--cert:
az ad app credential list --id <appId> --query "[].{name:displayName, ends:endDateTime}" -o table
az ad app credential list --id <appId> --cert --query "[].{name:displayName, ends:endDateTime}" -o table
Graph documents endDateTime as "always in UTC time". A secret lives
at most 24 months, and Learn recommends under 12. Federated credentials
carry no expiry; az ad app federated-credential list --id <appId>
lists them. A managed identity needs no rotation by anyone.
Never run az ad app credential reset without --append. "By
default, this command clears all passwords and keys, and let graph
service generate a password credential": every other consumer of the
app's secrets and certificates loses access at once. Upstream's
entra-app-registration troubleshooting suggests the bare form for an
invalid secret.
A Key Vault secret's exp does not stop a get. It is optional
and "for informational purposes only"; operations outside the window
"are automatically disallowed, except in particular situations", and
Learn names get as one: "A secret's get operation works for
not-yet-valid and expired secrets". What breaks is
the credential stored inside, an app secret expiring in Entra, so audit
that at its source, above. The vault's own dates still serve as a
reminder, and Event Grid's Microsoft.KeyVault.SecretNearExpiry fires
30 days before one:
az keyvault secret list --vault-name <vault> --query "[].{name:name, expires:attributes.expires}" -o table # field names unverified against az output, 2026-10-17
--append (§8).az call (§1).Seeded from microsoft/azure-skills at cf79ce8 (2026-10-16),
MIT-licensed (LICENSE.upstream):
entra-app-registration 1.2.1, azure-validate 1.2.3, azure-deploy
1.2.2 and azure-compliance 1.2.3, rewritten against Learn, which
corrected them where this skill says so.
What SKILL.md sets; muted values are Claude Code's defaults
Use when asked to grant or check an Azure role, set up a managed identity or a GitHub OIDC federated credential, or explain why a deploy, a container app or a pipeline gets 401, 403 or Forbidden from Azure, why Contributor cannot read a secret or a table row, why a role assignment fails mid-deploy, or which app secrets and Key Vault secrets expire soon. Not for Fabric workspace roles or OneLake permissions, which Azure RBAC does not govern, nor for sign-in policy for people.
Other plugins' skills for the same job
npx claudepluginhub wardawgmalvicious/claude-plugins --plugin azure-core2 skills in this plugin