Multi tenant app with RBAC enabled writing to StorageAccount using Storage SDK: Server failed to authenticate the request

Porsche Me 136 Reputation points
2020-12-19T03:48:58.08+00:00

We want our multi tenant app (using RBAC) write to StorageAccount using Storage SDK. Below is our scenario...

Tenant A: Created a application (clientId A1)
Application Permissions screen capture
49671-permission.png

Tenant B: Consented the application & granted 'Storage Blob Data Contributor' permission to A1 on StorageAccount S1

We are getting below error when tenant A tries upload a files to S1

I am getting below error...
Azure.RequestFailedException: Server failed to authenticate the request. Please refer to the information in the www-authenticate header.
RequestId:7a83e2bf-501e-0060-56b3-d5e372000000
Time:2020-12-19T03:06:42.5400377Z
Status: 401 (Server failed to authenticate the request. Please refer to the information in the www-authenticate header.)
ErrorCode: InvalidAuthenticationInfo

Headers:  
Server: Microsoft-HTTPAPI/2.0  

Below is our code snippet

 BlobServiceClient blobServiceClient = new BlobServiceClient(  
       new Uri($"https://{options.StorageAccount}.blob.core.windows.net"),  
       credential);  
  
BlobContainerClient containerClient = blobServiceClient.GetBlobContainerClient(  
     options.ContainerName);  
  
containerClient.CreateIfNotExists(PublicAccessType.BlobContainer);  
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
39,192 questions
0 comments No comments
{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.