简体   繁体   中英

Update metadata BlockBlob in Azure Blob Storage

I have been trying to update the metadata to my BlockBlob using Insomnia.I have managed to clear the metadata using the header(param json is empty):

enter image description here

with the strToSign:

"PUT\n\n\n\n\n\n\n\n\n\n\n\nx-ms-date:Fri, 11 Mar 2022 09:24:07 GMT\nx-ms-version:2021-04-10\n/myaccount/search/file_6444\ncomp:metadata"

but if I want to update the metadata, sending x-ms-meta-ide:2021 in the header(param json is empty), it doesn't work, it returns the error: AuthenticationErrorDetail The MAC signature found in the HTTP request 'XXXXXXXXX' is not the same as any computed signature.

The strToSign is:

"PUT\n\n\n\n\n\n\n\n\n\n\n\nx-ms-date:Fri, 11 Mar 2022 09:24:07 GMT\nx-ms-version:2021-04-10\nx-ms-meta-ide:2021\n/myaccount/search/file_6444\ncomp:metadata"

why it's not working?? Thanksss

Please change your string to sign to:

PUT\n\n\n\n\n\n\n\n\n\n\n\nx-ms-date:Fri, 11 Mar 2022 09:24:07 GMT\nx-ms-meta-ide:2021\nx-ms-version:2021-04-10\n/myaccount/search/file_6444\ncomp:metadata

Essentially the issue is that the headers must be alphabetically sorted in the string to sign so the order of the headers would be x-ms-date , x-ms-meta-ide and then x-ms-version .

For more details, please see this link: https://learn.microsoft.com/en-us/rest/api/storageservices/authorize-with-shared-key#constructing-the-canonicalized-headers-string .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM