0
votes

I'm trying to create a new container in a Blob Storage account using the Create Container API.

https://myaccount.blob.core.windows.net/mycontainer?restype=container

I can't get this to work, I'm struggling to get the format of the Authorization header right. Other blob services I've used allow this to be passed as a query parameter.

I have the SAS token, similar to ?sv=2019-12-12&ss=bfqt&srt=sco&sp=rwdlacupx&se=2022-02-01T16:52:59Z&st=2021-02-02T08:52:59Z&spr=https&sig=r4%2B7dlSfSO8kyd8mKawHhXNtRzInq7YI%2FIbqSr1g%2FqE%3D

How do I form the Authorization header correctly to pass this?

Thanks.

1
Hello, if the answer is helpful, could you please accept it as answer? Thank you very much.Ivan Yang

1 Answers

0
votes

To create a blob container by using Create Container rest api, if you're using "sas token", then you don't need to add "Authorization" in the Headers.

Assume you have a correct "sas token", then you the request url should look like this(Note: you should remove the first "?" from the "sas token"):

https://myaccount.blob.core.windows.net/mycontainer?restype=container&your_sas_token(note that remove the first ? from sas token)

And in the Headers, you just need pass x-ms-date and x-ms-version.

Here is the test by using Postman:

enter image description here

By the way, here is the screenshot about how to generate the "sas token" for creating blob container:

enter image description here