I am using EF Core to connect to a Azure SQL Database deployed to Azure App Services. I am using an access token (obtained via the Managed Identities) to connect to Azure SQ
Is this a right way to do it or will it have issues with performance?
That is the right way. OnConfiguring is called for each new DbContext, so assuming you don't have any long-lived DbContext instances, this is the right pattern.
Do I need to worry about token expiration? I am not caching the token as of now.
AzureServiceTokenProvider takes care of caching.
Does EF Core has any better way to handle this?
Setting the SqlConnection.AccessToken is currently the only way of using AAD Auth in SqlClient for .NET Core.