billythegoat
billythegoat

Reputation: 111

Azure Function Python docker container: Unable to find an Azure Storage connection string to use for this binding

I'm having trouble getting my Azure Function (python, timer trigger) to work in a docker container. Outside of the docker container, everything works just fine. But as soon as I start my container, I get an error saying:

fail: Host.Startup[515] A host error has occurred System.InvalidOperationException: Unable to find an Azure Storage connection string to use for this binding.

My connection string is defined in my local.settings.json. I have no clue as to why this isn't working in the docker container, has anyone dealt with this? I appreciate any direction, thank you.

Edit: Just a clarification, this is happening on my local machine. I have not deployed yet.

Upvotes: 5

Views: 1944

Answers (3)

Robert Kalapurackal
Robert Kalapurackal

Reputation: 21

we can pass the connection string as an environment variable called AzureWebJobsStorage to the docker run command.

docker run -p 8080:80 -it -e AzureWebJobsStorage="{connection-string}" <docker-id>

Upvotes: 1

Emad Alashi
Emad Alashi

Reputation: 503

The explanation is in this github issue.

Basically local.settings.json is only used by the local CLI, it's totally ignored by the runtime

Upvotes: 0

billythegoat
billythegoat

Reputation: 111

As I said before, I defined my connection string in my local.settings.json. I ended up accessing the file system of the container, and verified that my local.settings.json was in fact in there. I ended up adding my connection string as an env variable in my docker file (AzureWebJobsStorage={YOURCONNNECTIONSTRINGHERE}) and got it working. Hopefully this helps someone who comes across this issue.

Upvotes: 6

Related Questions