Entra ID OAuth2 Token signature failure when listing container

Chris Popescu 15 Reputation points
2025-02-18T17:17:03.62+00:00

I am trying to use REST & Entra ID token for a user managed identity to list containers and read them for a blob. While I was able to get a token and list the storage account ok like this:

Invoke-WebRequest -Uri (-join ('https://management.azure.com/subscriptions/"subscription_id"/providers/Microsoft.Storage/storageAccounts?api-version=2019-06-01')) -Method GET -Headers @{ Authorization ="Bearer $Token"}

while using same method for container list and read will respond that the Bearer $Token is not supported and signature is incorrectly formed.

Invoke-WebRequest -Uri "https://"storage_account_name".blob.core.windows.net/"container_name"?restype=container&comp=list" -Headers @{ Authorization ="Bearer $Token"}

Invoke-WebRequest: 

AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.

RequestId:1dafc7a3-301e-006f-6b25-82ece9000000

Time:2025-02-18T16:54:20.4625718ZAuthentication scheme Bearer is not supported in this version.

Can I use Entra ID Token to list the containers with REST API ? I did a lot of searching and can't find a functional example.

Azure CLI works for same user managed identity...

Thank you for your help.

C.

Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
3,382 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
3,093 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.