question

babruvahana avatar image
0 Votes"
babruvahana asked babruvahana answered

REST API issue while creating container

Hi Experts,

Bearer authentication is working to create storage account via API - https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}?api-version=2018-02-01

I am using below REST API to create a container in my storage account and I would like to use Bearer token authentication.
https://{accountName}.blob.core.windows.net/{containerName}?restype=container
But, I am getting the below error in POSTMAN:

Log:


<?xml version="1.0" encoding="utf-8"?>
<Error>
<Code>AuthenticationFailed</Code>
<Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
RequestId:e3a26fc3-d01e-00b0-18e7-529719000000
Time:2021-05-27T10:59:33.6579643Z</Message>
<AuthenticationErrorDetail>Authentication scheme Bearer is not supported in this version.</AuthenticationErrorDetail>
</Error>



Any help would be highly appreciated.

azure-storage-accountsazure-blob-storage
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

babruvahana avatar image
0 Votes"
babruvahana answered

Hi All,

I have found the solution myself. While creating a storage account we should use the resource as "https://management.azure.com/"and while creating container/blob we should the resource as "https://storage.azure.com/" to fetch the OAuth token.
Also, we have to add the roles "Storage Blob Data Owner" to the Azure AD app we create to fetch OAuth Toekn

Regards,
Pavan

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

deherman-MSFT avatar image
1 Vote"
deherman-MSFT answered babruvahana commented

anonymous user
Make sure to include the x-ms-version: header in your request. Sometimes it can default to an older version, which might explain the error you are getting. This blog does a good job explaining how to work with Blob containers and bearer tokens.

Hope this helps. If you are still facing issues please let me know and we can take a deeper look with you.


Disclaimer: This response contains a reference to a third-party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.
There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.



Please don’t forget to "Accept the answer" and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @deherman-MSFT , Actually, I have followed the same blog to create a storage account it worked, now I would like to create a container and a blob. So, I followed the same steps which mentioned in the blog. I am getting that error while trying to create a container. ![100438-container-error.png][1] [1]: /answers/storage/attachments/100438-container-error.png

0 Votes 0 ·