Uploading from a passed file stream to Azure blob works locally, but not in Azure

Phil 96 Reputation points
2020-11-19T18:14:39.427+00:00

I have a Python/Flask API app I have deployed to an Azure App Service plan (Linux/Python 3.8). Everything works locally as it should, but when I deploy it to Azure it fails. Here's the relevant code:

blob_client = BlobClient.from_connection_string(
    conn_str=__ams_storage_connection_string, 
    container_name=input_asset_name, 
    blob_name=request.files["video"].filename
)
blob_client.upload_blob(request.files["video"].stream.read())

When I test this in Postman I pass the video file in the Body/form-data as a file. request.files["video"].filename has the correct filename (abc.mp4). It fails on the upload_blob and the exception I get when this runs in Azure is "Connection string missing required connection details"

I'm stumped.

Any help is appreciated and TIA.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,779 questions
0 comments No comments
{count} votes

Accepted answer
  1. Phil 96 Reputation points
    2020-11-20T00:12:41.4+00:00

    Solved my own problem, and now I really do feel stupid.

    It turned out to be a mistake on my part. My environment variable for the "__ams_storage_connection_string" was 1-character different in Azure than it is in my development environment. Fixed that and it finally works in both local and Azure. When I copied it from my dev environment to paste it into the Azure environment, I missed copying the very last character.


0 additional answers

Sort by: Most helpful

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.