Azure app service Web API connect to a SQL Server database, with Azure AD account/windows authentication

1.7k Views Asked by At

Currently I have everything on premise - .NET Core 3.0 API and SQL Server database.

Azure AD/Service account are configured in IIS and database has given access to the service account.

All requests use that Azure AD service account.

Now we are planning for an Azure migration. API is published in App Services.

Now I want to use the same Azure AD account to connect to an Azure SQL Server database.

How should I do that?

Don't send me Microsoft links, those are having toooo much info.

Tell what and how to do configuration in Azure SQL and App Services.

Any help is appreciated.

1

There are 1 best solutions below

13
On

Now I want to use the same AD account to connect to an Azure SQL Server database.

AD accounts can't connect to Azure SQL Database. Only SQL and Azure Active Directory (AAD) Logins/Users.

There are some options, but there's a clear best-practice: Provision a Managed Service Identity (MSI) for your Azure App Service Application and use that to connect to SQL Server.

Here is a simple tutorial for how you should integrate App Service and Azure SQL Database:

Tutorial: Secure Azure SQL Database connection from App Service using a managed identity