nerdexam
Microsoft

DP-300 · Question #279

Hotspot Question You have an Azure subscription that contains a logical SQL server. The server hosts two databases named db1 and db2 and an Azure AD service principal named app1. You need to ensure…

The correct answer is CREATE: USER; [app1]: FROM EXTERNAL PROVIDER. This question tests knowledge of granting Azure AD service principals access to specific Azure SQL databases using T-SQL with the principle of least privilege.

Submitted by carlos_mx· Mar 6, 2026Perform administration by using T-SQL

Question

Hotspot Question You have an Azure subscription that contains a logical SQL server. The server hosts two databases named db1 and db2 and an Azure AD service principal named app1. You need to ensure that app1 can access db1. The solution must use the principle of least privilege. How should you complete the Transact-SQL statement? To answer, select the appropriate options in the answer area. NOTE: Each correct selection is worth one point. Answer:

Exhibit

DP-300 question #279 exhibit

Answer Area

  • CREATEUSER
    CREDENTIALLOGINUSER
  • [app1]FROM EXTERNAL PROVIDER
    FOR LOGIN app1FROM EXTERNAL PROVIDERFROM LOGIN app1WITHOUT LOGIN

Explanation

This question tests knowledge of granting Azure AD service principals access to specific Azure SQL databases using T-SQL with the principle of least privilege.

Approach. The correct T-SQL statement to grant app1 access to db1 while following least privilege is: USE [db1]; CREATE USER [app1] FROM EXTERNAL PROVIDER; ALTER ROLE db_datareader ADD MEMBER [app1]; - or simply grant a minimal role. You must first USE [db1] to switch context to the correct database, then CREATE USER [app1] FROM EXTERNAL PROVIDER to create the Azure AD-based user in that specific database, and finally assign a least-privilege role such as db_datareader (read-only) rather than db_owner or other elevated roles. Using 'FROM EXTERNAL PROVIDER' is the required syntax for Azure AD identities including service principals.

Concept tested. Granting Azure AD service principals (external providers) access to a specific Azure SQL database using T-SQL with least privilege - specifically the use of 'CREATE USER [app1] FROM EXTERNAL PROVIDER' within the correct database context and assigning a minimal database role.

Reference. https://docs.microsoft.com/en-us/azure/azure-sql/database/authentication-aad-configure

Topics

#CREATE USER#external provider#Azure AD service principal#contained database user

Community Discussion

No community discussion yet for this question.

Full DP-300 Practice