We have an ABP.IO multi-tenant application configured as database-per-tenant (each tenant has an isolated Azure SQL database).
We want to avoid SQL username/password in tenant connection strings and instead connect to Azure SQL using Microsoft Entra ID authentication with a Service Principal (Client ID + Client Secret or Certificate).
What we need from ABP support
- Recommended ABP approach to implement tenant-specific database connections using Entra ID Service Principal authentication.
- Where to integrate this in ABP:
- Should we override/implement
IConnectionStringResolver(or another ABP extension point) to resolve per-tenant connection settings? - What is the recommended place to inject an access token / configure the underlying SQL connection for Entra ID (e.g., during
DbContextconfiguration / connection creation)?
- Should we override/implement
- If ABP has an official or preferred pattern for this scenario, please share:
- Docs / sample project
- or a minimal code snippet showing the correct integration point for Azure SQL + Entra ID Service Principal in a multi-tenant, database-per-tenant setup.
3 Answer(s)
-
0
hi
ABP will use
MultiTenantConnectionStringResolverto get the connection string for the current tenant when a new EF Core DbContext is created.https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/MultiTenantConnectionStringResolver.cs#L12 https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.Data/Volo/Abp/Data/DefaultConnectionStringResolver.cs
So overriding the
IConnectionStringResolveris the correct way.connect to Azure SQL using Microsoft Entra ID authentication with a Service Principal (Client ID + Client Secret or Certificate).
Can you share some demo code for using it with DbContext? I will share the solution.
Thanks
-
0
Hello,
I don't have a demo solution because we're in the analysis phase and haven't implemented anything yet. I've created a ticket to ask if it's feasible to connect to the database this way, and if there are any design limitations in the framework.
Thank you very much.
-
0
hi
If EF Core DbContext supports
Microsoft Entra ID authentication with a Service Principal, then abp will support it.Thanks.