Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass Azurite configuration settings to function host #3876

Open
danielniccoli opened this issue Oct 4, 2023 · 3 comments
Open

Pass Azurite configuration settings to function host #3876

danielniccoli opened this issue Oct 4, 2023 · 3 comments
Assignees
Milestone

Comments

@danielniccoli
Copy link

danielniccoli commented Oct 4, 2023

When working with Azure Durable Functions, Azurite is usually involved. If for some reason you have to change the ports that Azurite is listening on in settings.json as shown here ...

}
    "azurite.location": ".azurite",
    "azurite.blobPort": 10010,
    "azurite.queuePort": 10011,
    "azurite.tablePort": 10012,
    // ...
}

... one also must modify local.settings.json to inform the locally running azure functions host to connect to the new Azurite ports. This includes having to know the exact connection string details, including a public predefined password.

So the simple JSON key-value pair

{
  "IsEncrypted": false,
  "Values": {
    "FUNCTIONS_WORKER_RUNTIME": "python",
    "AzureWebJobsStorage": "UseDevelopmentStorage=True"
    "AzureWebJobsFeatureFlags": "EnableWorkerIndexing",
    // ...    
  },
  "Host": {
    "LocalHttpPort": 7072
  }
}

must be replaced by this very verbose line

{
  "IsEncrypted": false,
  "Values": {
    "FUNCTIONS_WORKER_RUNTIME": "python",
    "AzureWebJobsStorage": "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10010/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10011/devstoreaccount1;TableEndpoint=http://127.0.0.1:10012/devstoreaccount1;",
    "AzureWebJobsFeatureFlags": "EnableWorkerIndexing",
    // ...    
  },
  "Host": {
    "LocalHttpPort": 7072
  }
}

My suggestion is that the azurite listening configuration (e.g., azurite.blobPort) is passed to the functions host when set.

Implementation approach

The setting UseDevelopmentStorage=True is the short-hand for DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;. (The AccountKey is pre-defined as well and taken from the Microsoft docs!)

  1. Check if local.settings.json contains UseDevelopmentStorage=True
  2. Check if settings.json contains azurite listenening settings.
  3. If 1) and 2) are true, pass a modified connection string directly to the process when it is started, that overrides the local.settings.json value

I don't know the function host enough to know if that would work, so I'll just leave it here.

@nturinski nturinski added this to the Backlog milestone Oct 5, 2023
@alexweininger
Copy link
Member

Related to #3862

@paulyuk
Copy link
Member

paulyuk commented Nov 1, 2023

Hey @danielniccoli - thank you for this report. Could you do me a favor and ping me offline on my twitter @paulyuki99? I have a follow up question. Paul - from Azure team

@nturinski nturinski self-assigned this Nov 1, 2023
@danielniccoli
Copy link
Author

Hi @paulyuk, I don't have a Twitter account. I could contact you through the email address on your profile, if you like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants