Azure / AppConfiguration-DotnetProvider

The .NET Standard configuration provider for Azure App Configuration
https://github.com/Azure/AppConfiguration
MIT License
86 stars 38 forks source link

Guidance on using App Configuration on Multi-Tenant applications #293

Open ielcoro opened 3 years ago

ielcoro commented 3 years ago

I'm not able to find any documentation or examples about using App Configuration on multi-tenant applications. I can only find documentation on how to map on startup to specific labels or prefixes, however in a multi-tenant application, for example an api that servers requests to multiple tenants, you need to filter the configuration on a per-request basis, loading the current tenant from the current request info.

How can we implement such scenario using App Configuration? We thought about using named options and IOptionsSnapshot, however we didn't find any info on what is the relation between named options and Azure App Configuration settings.

lubgi commented 1 year ago

+1 @ielcoro Have you found a solution for this or ended up using something else? I'm stuck with the exact same problem and doing some research. Without per-request configuration binding, it doesn't really make much sense to use App Configuration, since developing a custom solution or using Spring Config + DB/Redis (which is an option for me) doesn't sound that crazy

zhenlan commented 1 year ago

https://learn.microsoft.com/en-us/azure/azure-app-configuration/howto-best-practices#multitenant-applications-in-app-configuration

lubgi commented 1 year ago

This doesn’t answer the question, I’ve already read that article before commenting. There’s no info about handling multitenant configs there, except for advice to use tenantId as key prefix. I guess I might use OptionsBuilder (or better IOptionsFactory, to avoid scope problems) in pair with my implementation for scoping tenant info (e.g. ITenantProvider, wrapped around IHttpContextAcessor), but I still can’t find elegant solution. Also, how would I handle non-nested config values? Should I put everything inside IOptions? I don’t think so

Сб, 18 нояб. 2023 г. в 03:44, Zhenlan Wang @.***>:

https://learn.microsoft.com/en-us/azure/azure-app-configuration/howto-best-practices#multitenant-applications-in-app-configuration

— Reply to this email directly, view it on GitHub https://github.com/Azure/AppConfiguration-DotnetProvider/issues/293#issuecomment-1817315516, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHNIUQOOPKRP3YRKYWMUKYDYFAHIXAVCNFSM5IS2GPK2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBRG4ZTCNJVGE3A . You are receiving this because you commented.Message ID: @.***>

lubgi commented 10 months ago

@zhenlan @ielcoro any updates on this?

vienleidl commented 5 months ago

Hi @ielcoro @lubgi, I'm also finding an architecture for App Configuration in a multitenancy setup. It's not much information about that, I found this article, which has a little bit of related information.

Kashif-datamagnetics commented 4 months ago

Stuck with same issue, can anyone help?

samsadsam commented 1 month ago

@lubgi @ielcoro @vienleidl @Kashif-datamagnetics

I'll say my understanding of your problem first before suggestions. It seems that you want a way to load some configuration that is dependent on a runtime tenant information. This information is taken from an incoming request.

Given these assumptions, these configurations cannot be loaded at startup, and since our dynamic refresh mechanism is based on loaded settings at startup, there is no direct way to achieve your scenario with this library.

However, you can still use our service and instantiate a ConfigurationClient instance that can pull specific configuration given runtime tenant information.

Please correct my understanding of your problem and let me know if this suggestion helps!

samsadsam commented 1 month ago

@drago-draganov do you have any suggestions? 👀