1

For a Python Flask application I am using envconsul to read config from Consul KV store and inject it as environment variables into the app and watch for updates.

I am planning migration to Azure and considering switching to Azure App Configuration. Since there is nothing like envconsul (is there?) I will probably use azure-appconfiguration client library. I can see it's easy to plug in and read config, however:

  1. With envconsul and environment variables approach it was easy to run the app locally without Consul - I just needed to set the variables and all works fine. With Azure it seems I need to mock the endpoint or wrap config loading in some abstraction layer. Or is there an easier way?

  2. How do I manage watching for config updates? I see it's possible with SDKs for .NET, but not Python. I could write something like envazureappconfiguration ;) Or manually implement polling. Or maybe somehow pass an event through Event Grid to trigger reload...? Or, again, is there an easier way?

Kombajn zbożowy
  • 8,755
  • 3
  • 28
  • 60

1 Answers1

0

You are recommended to use the Python Provider library to access Azure App Configuration. The Python provider library uses the Python SDK under the cover but is designed to make it easier to use. Once data is loaded, you can access App Configuration just like a dictionary. It also offers other features like configuration composition from multiple labels, key name trimming, automatic resolution of Key Vault references, etc.

The Python provider doesn't support configuration refresh yet. It's a feature on our roadmap to add. Please feel free to open a feature request on our GitHub repo, so you will get updates. Please include details like how you expect the refresh to work. It helps us to shape the feature.

Zhenlan Wang
  • 1,213
  • 8
  • 10
  • I'm a bit confused about [my link](https://learn.microsoft.com/en-us/python/api/overview/azure/appconfiguration-readme?view=azure-python) mentioning `pip install azure-appconfiguration` and [your link](https://learn.microsoft.com/en-us/azure/azure-app-configuration/quickstart-python-provider?tabs=windowscommandprompt) mentioning `pip install azure-appconfiguration-provider`, both actually linking to the same [GitHub repo](https://github.com/Azure/azure-sdk-for-python/). Are you able to clarify this? Was there any reorganization/rewrite? – Kombajn zbożowy Nov 10 '22 at 20:46
  • The source code of both the "SDK" and the "Provider" resides in the same GitHub repo you mentioned. The SDK provides APIs mapping to the REST APIs of the App Configuration service. The Provider can be considered a convenience-layer library built on the SDK. The same concept applies to other languages. The caching, refreshing, key vault reference, etc. support, like what you saw in .NET, is part of the provider. The SDK doesn't provide those functionalities. The provider for python is still in development, so some functionalities are not available yet but will be added in the future. – Zhenlan Wang Nov 11 '22 at 22:02