Error Saving Artifacts to Blob Storage (MissingRequiredHeader)

SabrineBen 0 Reputation points
2024-09-09T21:51:14.0333333+00:00

I'm deploying an MLflow server on Azure using a Docker image. The MLflow server URL is accessible, but I'm encountering an issue when trying to save artifacts in Azure Blob Storage. I receive the following error:

requests.exceptions.HTTPError: 400 Client Error: An HTTP header that's mandatory for this request is not specified

I'm using Azure Blob Storage for storing artifacts. I've already:

  • Set up the Connection string and The access KEY as an env variables for the both the webapp and the client from where i launch my python experiment
  • I tried to use a SAS token in the URL artifact : "https://$STORAGE_ACCOUNT_NAME.blob.core.windows.net/$STORAGE_CONTAINER_NAME?$SAS_TOKEN"
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,918 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Vinod Kumar Reddy Chilupuri 660 Reputation points Microsoft Vendor
    2024-09-11T10:00:26.37+00:00

    Hi SabrineBen ,
    Welcome to Microsoft Q&A, thanks for posting your query.

     

    It sounds like you're encountering an issue with the HTTP headers required for Azure Blob Storage when saving artifacts from your ML flow server. The error
    requests.exceptions.HTTPError: 400 Client Error: An HTTP header that's mandatory for this request is not specified typically indicates an issue related to the request headers that Azure Blob Storage expects when interacting with it.

     

    Ensure the SAS token has the required permissions ( rwlac for reading, writing, listing, adding, and creating objects). The token should also not be expired, and it should be properly appended to the Blob Storage URL.

     

    A SAS token is used to provide limited access to Azure Blob Storage without sharing the storage account’s access keys. The error may occur if the SAS token is not properly configured, is expired, or lacks the necessary permissions.

     You mentioned using environment variables for the connection string and access key. The 400 error may indicate an issue with these variables not being set correctly or not properly configured in the ML flow setup.

    Double check the environment variables and their format to make sure they match azure requirements for connection string.

     

    Ensure the proper headers are being included in your request. If you're using a library like the ML flow, these headers should be managed automatically.

    Check the networking and access policies for your Blob Storage container to ensure that access is properly configured. You can also use Azure Blob Storage access tiers to control permissions.

     

    When saving artifacts in Azure Blob Storage, ensure that ML flow is configured correctly to point to the Blob Storage. In your ML flow setup, you should set the artifact_location to the correct Blob Storage URL. If you're using the SAS token directly, make sure it's properly referenced in your ML flow configuration.

     

    Please let us know if you have any further queries. I’m happy to assist you further. 


    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

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.