Authentication + Authorization workflow
- A user or service principal proves identity to Entra ID (interactive sign-in or a token request). Entra ID authenticates the identity and issues a bearer token.
- The client presents the bearer token to the Azure Storage REST API.
- Storage validates the token and evaluates storage RBAC to determine whether the caller is authorized for the requested resource.
- If authorized, Storage returns the requested object or data.
1. Create an app registration (service principal) and client secret
- In Microsoft Entra ID, create a new app registration (single-tenant), e.g., “Storage SPN”.
- Copy the Application (client) ID and the Tenant ID.
- Create a client secret and save its value immediately — it is shown only once.

When you create a client secret, copy the secret value immediately — it is visible only at creation. Store it securely (secrets vault, Key Vault, or a secure password manager).

2. Assign a storage-specific RBAC role to the service principal
- Open the Storage account you want the service principal to access.
- Go to Access Control (IAM) → Add role assignment.
- Choose the appropriate storage data role (least privilege principle). For read-only blob access, select “Storage Blob Data Reader”.



Common storage data roles
Always assign the least privileged storage role required for the task. Do not give owner-level data permissions unless necessary.
3. Request a token using the client credentials flow
Use the service principal (client ID), client secret, and the tenant token endpoint to request an access token for the Azure Storage resource. For the v1 endpoint you may see examples that use theresource parameter. For v2 endpoints and modern apps, use the scope https://storage.azure.com/.default with the /oauth2/v2.0/token path.
Example POST (v1 style, application/x-www-form-urlencoded):
- For v2.0 token endpoints, POST to
/oauth2/v2.0/tokenand usescope=https://storage.azure.com/.default. - The client credentials flow does not return refresh tokens. When the access token expires, request a new token using the same client credentials flow.
4. Access a blob with the bearer token
First, you can test an unauthenticated GET to confirm the blob is private (or to validate public blob access):x-ms-version and the Authorization: Bearer <access_token> header:

Summary
- Use Microsoft Entra ID for stronger authentication and to enable Conditional Access and MFA.
- Entra ID handles authentication (who you are); storage-specific RBAC grants authorization to storage data.
- Service principals (app registrations) with client credentials are a common pattern for non-interactive service-to-service access.
- Follow the least privilege principle — assign the minimum storage data role required for the workload.
Links and references
- Microsoft Entra ID / Azure AD: https://learn.microsoft.com/azure/active-directory/
- Azure Storage authentication: https://learn.microsoft.com/azure/storage/common/storage-auth-aad
- OAuth 2.0 client credentials flow: https://learn.microsoft.com/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow
- Azure RBAC roles for storage: https://learn.microsoft.com/azure/role-based-access-control/built-in-roles#storage-accounts