You have two ways to get the key:
1. Set your own key
Set a master key of your own and pass it into the container, so that the container will always accept that key.
Step 1: Create a test_host_keys.json
file locally with the following contents:
{
"masterKey": {
"name": "master",
"value": "test", <-- this will be the host key you use
"encrypted": false
},
"functionKeys": []
}
Step 2: Invoke docker with two extra parameters:
-e AzureWebJobsSecretStorageType=files
to make it use local auth keys
-v path/to/your/test_host_keys.json:/azure-functions-host/Secrets/host.json
to set the custom host keys
(This is an improvement on this answer, since with this you can use the same Dockerfile for local testing and for production)
2. Get it from the running container.
In the container, look inside the /azure-functions-host/Secrets/
folder for a .json file
Read that file to find the default key. It'll look something like the following:
> cat /azure-functions-host/Secrets/[thefile].json
root@5b9250f41cc6:/# cat /azure-functions-host/Secrets/some_trigger.json
{
"keys": [
{
"name": "default",
"value": "buoxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==", <-- your key
"encrypted": false
}
],
"hostName": null,
"instanceId": "000000000000000000000000xxxxxxxx",
"source": "runtime",
"decryptionKeyId": ""
}