Skip to content

Commit d3492e3

Browse files
authored
Information about SQL Error 33134
Largely, this is to improve awareness about the correlation between SQL Server and Conditional Access, and how CA policies can prevent the function of CREATE USER FROM EXTERNAL PROVIDER. I also touch on the fact that service principals cannot execute this command.
1 parent 9488d9b commit d3492e3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

articles/sql-database/sql-database-aad-authentication-configure.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,11 @@ To create a contained database user representing an application that connects us
301301
CREATE USER [appName] FROM EXTERNAL PROVIDER;
302302
```
303303

304+
> [!NOTE]
305+
> This command requires that SQL access Azure AD (the "external provider") on behalf of the logged-in user. Sometimes, circumstances will arise that cause Azure AD to return an exception back to SQL. In these cases, the user will see SQL error 33134, which should contain the AAD-specific error message. Most of the time, the error will say that access is denied, or that the user must enroll in MFA to access the resource, or that access between first-party applications must be handled via preauthorization. In the first two cases, the issue is usually caused by Conditional Access policies that are set in the user's AAD tenant: they prevent the user from accessing the external provider. Updating the CA policies to allow access to the application '00000002-0000-0000-c000-000000000000' (the application ID of the AAD Graph API) should resolve the issue. In the case that the error says access between first-party applications must be handled via preauthorization, the issue is because the user is signed in as a service principal. The command should succeed if it is executed by a user instead.
306+
304307
> [!TIP]
305-
> You cannot directly create a user from an Azure Active Directory other than the Azure Active
306-
Directory that is associated with your Azure subscription. However, members of other Active Directories that are imported users in the associated Active Directory (known as external users) can be added to an Active Directory group in the tenant Active Directory. By creating a contained database user for that AD group, the users from the external Active Directory can gain access to SQL Database.
308+
> You cannot directly create a user from an Azure Active Directory other than the Azure Active Directory that is associated with your Azure subscription. However, members of other Active Directories that are imported users in the associated Active Directory (known as external users) can be added to an Active Directory group in the tenant Active Directory. By creating a contained database user for that AD group, the users from the external Active Directory can gain access to SQL Database.
307309
308310
For more information about creating contained database users based on Azure Active Directory identities, see [CREATE USER (Transact-SQL)](https://msdn.microsoft.com/library/ms173463.aspx).
309311

0 commit comments

Comments
 (0)