QuestionQ24

Secure, optimize, and deploy database solutions

You have an Azure SQL database named SalesDB on a logical server called sales-sql01.

You have an Azure App Service web app named OrderApi that connects to SalesDB by using SQL authentication.

You enable a user-assigned managed identity named OrderApi-Id for OrderApi.

You need to configure OrderApi to connect to SalesDB using Microsoft Entra authentication. The managed identity must have read and write permissions to SalesDB.

Which Transact-SQL statements should you execute in SalesDB?

Explanation

A user-assigned managed identity needs a contained Microsoft Entra user in the database, created with CREATE USER [OrderApi-Id] FROM EXTERNAL PROVIDER. Adding that user to db_datareader grants read access and adding it to db_datawriter grants write access. This is the appropriate database-level configuration for Azure SQL Database; SQL-authentication passwords and server-level roles are not needed.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!