Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

Azure Blob 403 AuthorizationPermissionMismatch: "This request is not authorized to perform this operation using this permission"

Technical article
Cloud

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

When a backup job or script gets HTTP 403 with the error code AuthorizationPermissionMismatch from Azure Blob Storage, the request was refused for lack of the permission the operation needs. Microsoft's table of shared access signature (SAS) error codes gives the message as "This request is not authorized to perform this operation using this permission." Microsoft's Entra ID page names the same code for callers that use Microsoft Entra ID, and states that management roles do not give access to blob data. The first thing to prove is therefore whether the caller holds a blob data role.

What the error means

Azure Blob Storage checks each data operation against the permissions of the caller. There are two common callers. A Microsoft Entra identity (a user, group, service principal or managed identity) is checked against Azure role assignments. A SAS token is checked against the permissions signed into the token.

For the Entra case, Microsoft states: "When you create an Azure Storage account, you're not automatically assigned permissions to access data via Microsoft Entra ID. You must explicitly assign yourself an Azure role for access to Blob Storage." It adds: "Only roles explicitly defined for data access permit a security principal to access blob data. Built-in roles such as Owner, Contributor, and Storage Account Contributor permit a security principal to manage a storage account, but don't provide access to the blob data within that account via Microsoft Entra ID."

The same page gives one exception: a role that includes Microsoft.Storage/storageAccounts/listKeys/action lets its holder reach the data through Shared Key authorisation with the account keys.

The same page describes the built-in data roles. Storage Blob Data Contributor is for "read, write, and delete permissions to Blob storage resources", and Storage Blob Data Reader is for "read-only permissions".

For the SAS case, the error table lists AuthorizationPermissionMismatch for an "Unauthorized signed permission (including create and add permissions)". The table's columns are the old status code, 404 (Not Found), and the new status code, 403 (Forbidden), from storage version 2015-04-05 onward.

Likely causes

Cause What you see How to confirm
The identity has only management roles such as Owner or Contributor Management tasks work, every blob operation returns 403 The role assignment list shows no Storage Blob Data role
A data role exists, but at another scope One container works, another does not The assignment's scope does not cover the target container or account
The role is too weak for the operation Reads work, writes fail A read-only role against Put Blob, which needs a write permission
The role was assigned a short time ago The error ends without any change The assignment is newer than the propagation delay
A deny assignment blocks access A correct role is present and the error remains Microsoft's page says to be sure there are no deny assignments
A role assignment condition (ABAC) limits the role Some blobs or operations work The assignment carries a condition
The SAS token lacks the permission The error occurs only with that token The token's signed permissions do not include the operation

Prove the cause before changing anything

All commands below only read.

  1. Find the identity the job really uses: the user, the service principal or the managed identity named in the job's configuration. Note its name or object ID.

  2. List its role assignments. The az role assignment list page says "By default, only assignments scoped to subscription will be displayed. To view assignments scoped by resource or group, use --all."

az role assignment list --all --assignee <assignee>

A good result shows a role such as Storage Blob Data Contributor with a scope that covers the container or the storage account. A bad result shows only Owner, Contributor or Storage Account Contributor, or a data role at a scope that does not cover the target.

  1. Match the operation to the permission. The REST page's table gives, among others: List Blobs needs Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read; Get Blob needs the same read permission; Put Blob, to create or replace, needs Microsoft.Storage/storageAccounts/blobServices/containers/blobs/write; to create a new blob, the table gives Microsoft.Storage/storageAccounts/blobServices/containers/blobs/add/action.

  2. Check when the role was assigned. The role assignment page says "When you assign roles or remove role assignments, it can take up to 10 minutes for changes to take effect. If you assign roles at the management group scope, it can take much longer." A note on the Entra ID page says "Azure role assignments can take up to 30 minutes to propagate." Treat the longer figure as the safe wait.

  3. For the Azure CLI, check how the command authorises. The CLI page says "If you omit the --auth-mode parameter, then the Azure CLI also attempts to retrieve the access key." The page says to "Set the --auth-mode parameter to login to sign in using a Microsoft Entra security principal (recommended)." Our reading: a command run with --auth-mode login is authorised as the signed-in Entra identity, so that identity's role assignments apply. In key mode, which the page calls the legacy value, the command attempts to use the account access key instead, so the blob data roles are not what authorises it.

  4. For a SAS token, read the permissions signed into it. If they do not include the operation, the error is expected.

Fix

Microsoft's guidance for the Entra case is to assign a data role at the narrowest scope that works: "Always grant only the narrowest possible scope". The scopes run from one container up to a management group.

Assign a blob data role

You need a role that includes Microsoft.Authorization/roleAssignments/write at the scope or higher.

First save the current state:

az role assignment list --all --assignee-object-id <object-id> > role-assignments-before.json

Risk: the next command gives the identity read, write and delete access to every blob in the container named in --scope. A role assigned too widely stays in force until someone removes it.

Assign the role at container scope. The page's example that uses an object ID has --assignee-object-id and --assignee-principal-type; the type can be ForeignGroup, Group, ServicePrincipal or User:

az role assignment create \
  --role "Storage Blob Data Contributor" \
  --assignee-object-id <object-id> \
  --assignee-principal-type ServicePrincipal \
  --scope "/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Storage/storageAccounts/<storage-account-name>/blobServices/default/containers/<container-name>"

To undo it: first list the assignments with the same role, object ID and scope that the delete will use, and compare with role-assignments-before.json. The delete page says it "deletes all role assignments that satisfy the provided query condition" and recommends running az role assignment list first with the same arguments.

az role assignment list --all --assignee-object-id <object-id> --role "Storage Blob Data Contributor" --scope "/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Storage/storageAccounts/<storage-account-name>/blobServices/default/containers/<container-name>"

One line in the result is the assignment you created. If the saved file already held this role at this scope, stop: the assignment existed before the change, and removing it would take away access that was there before. Only if the saved file did not hold it, delete the assignment:

az role assignment delete \
  --role "Storage Blob Data Contributor" \
  --assignee-object-id <object-id> \
  --scope "/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Storage/storageAccounts/<storage-account-name>/blobServices/default/containers/<container-name>"

Then run the first list command again; it prints no line for the role at that scope.

Wait for propagation

If the role is present and recent, wait the 30 minutes from the note above, then retry the same operation. If the error remains, check for a deny assignment and for a role assignment condition. Microsoft's page names the deny assignments article, "Understand Azure deny assignments", for the first.

SAS token

A SAS token's permissions are signed into the token, and the error table ties this code to the signed permission. A token that lacks a permission therefore has to be replaced by one that includes it. No commands for issuing a SAS token are given here.

Example (illustrative): the service principal backup-job-sp uploads to the container backups in the storage account stexample01 and gets 403 AuthorizationPermissionMismatch on Put Blob. az role assignment list --all --assignee <object-id> shows Contributor at the resource group rg-backup-example and no Storage Blob Data role. Contributor manages the account but does not grant blob data access. The administrator assigns Storage Blob Data Contributor at the backups container scope and, after 30 minutes, the upload works.

Confirm the fix

  1. az role assignment list --all --assignee-object-id <object-id> shows the data role at the intended scope.
  2. The failed operation, run again as the same identity, completes.
  3. A write to a different container, outside the scope, should still return the 403 unless the identity holds a role there from another assignment. That is the narrow scope working as intended.

What to watch afterwards

Risks and limits

  • These commands have not been run or lab-tested.
  • The pages give different propagation figures, 10 and 30 minutes, and up to 12 hours in rare cases for data actions at management group scope on certain resource types.
  • A role assignment grants real access to data. Assign the narrowest role and scope that works, and remove any role that was added only for a test.
  • Microsoft's pages do not give a message text for the Entra ID case; the message quoted here comes from the SAS table.
  • Azure Files with Entra ID has separate requirements that these pages do not cover.
  • Network rules on the storage account are not covered here.

Sources