Calling Azure blob storage rest API, but we are getting the 400 issue in PHP

salman 20 Reputation points
2024-07-31T06:32:25.9666667+00:00

Hi Support Team,

We are trying to upload files in Azure blob storage, by calling Azure blob storage rest API, but we are getting the following response,    

<Code>InvalidAuthenticationInfo</Code>    
<Message>Authentication information is not given in the correct format. Check the value of Authorization header.

RequestId:3bd2c23b-d01e-0081-0412-e301b0000000

Time:2024-07-31T06:25:35.7963267Z</Message>

URL: https://sampledemo1997.blob.core.windows.net/demo/user_details-39

Method: PUT

Can you please help us to fix this issue as soon as possible?

Thanks.

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,231 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,928 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Amrinder Singh 5,155 Reputation points Microsoft Employee
    2024-07-31T07:18:57.41+00:00

    Hi salman - Thanks for reaching out over Q&A forum.

    Based on the exception, you seem to be not passing the auth part correctly and need to be corrected.

    Please verify the same and try using SAS token once. You can generate one using portal for a quick test.

    You can refer to below blog as well for performing simple operation via CURL

    https://techcommunity.microsoft.com/t5/azure-paas-blog/performing-simple-blob-storage-rest-api-operations-using-curl/ba-p/3302552

    Hope that helps!

    Please let me know if there are any further queries/concerns, will be glad to assist.


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

    0 comments No comments

  2. Nehruji R 8,146 Reputation points Microsoft Vendor
    2024-08-01T07:45:42.3466667+00:00

    Hello salman,

    Greetings! Welcome to Microsoft Q&A Platform.

     

    I understand that you are trying to upload files in Azure blob storage, by calling Azure blob storage rest API and you are encountering an error "400 InvalidAuthenticationInfo" - the error message states "that Authentication information is not given in the correct format. Check the value of Authorization header"

    This type of error usually occurs due to one of the following reasons below and hence please consider checking that to resolve the issue,

    • The error information tells that it is due to Authentication information is not given in the correct format Make sure the Authorization header is formatted correctly according to the requirements of the Azure Blob Storage REST API refer: https://learn.microsoft.com/en-us/rest/api/storageservices/blob-service-error-codes.
    • The uploading file size might be greater than the original size of the blob storage, hence verify the size.
    • The copy of the source and destination account must be the same and the specified blob content should be valid with blob tier. 
    • Ensure the date and time in the request header are in the correct format. Azure requires the x-ms-date. Check whether any of the key you might be using may not be rotated or expired.
    • Make sure your connection string has all the necessary information.
    • Please ensure the service account has the necessary permissions to access the Blob Storage.
    • Azure Storage Accounts can have network rules applied to them, restricting access to certain IPs or VNETs. If your Azure Storage Account has firewall rules set up, ensure your environment's outbound connections are allowed to reach the Storage Account.
    • Ensure that the system clock on your client machine is synchronized with a reliable time source. Azure Storage requires that the request time be within 15 minutes of the server time.

     refer - https://learn.microsoft.com/en-us/rest/api/storageservices/blob-service-error-codes.

    Similar thread for reference: https://stackoverflow.com/questions/73858529/invalid-authentication-info-error-when-using-azure-ad-and-azure-storage-put-api,https://stackoverflow.com/questions/66600146/invalidauthenticationinfo-error-while-uploading-dcument-in-azure-blob-storage.

     

     

     

    Hope this answer helps! please let us know if you have any further queries. I’m happy to assist you further.

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

    0 comments No comments

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.