Search code examples
sql-serverazureazure-sql-databasessms

Why do I receive Incorrect syntax near 'PROVIDER' error when trying to create a new Azure AD server principal (logins) on Azure SQL Server?


Why do I receive Incorrect syntax near 'PROVIDER' error when trying to create a new Azure AD server principal (logins) on Azure SQL Server?

I'm following the official Microsoft documentation titled "Create additional Azure AD server principals (logins) using SSMS", and I'm using SQL Server Management Studio version 18.1.

Following the documentation, I've already successfully logged into my Azure SQL Server using "Active Directory - Universal with MFA support" option, and I want to add an Active Directory user, so that my colleague can also access the same server and see the database I've created on that server. As described in the Microsoft documentation, I open a new query window, and I try to run the following SQL command:

USE master
GO
CREATE LOGIN [firstname.lastname@example.com] FROM EXTERNAL PROVIDER
GO

But I immediately get the following error:

Msg 102, Level 15, State 48, Line 3
Incorrect syntax near 'PROVIDER'.

Solution

  • In Azure SQL Database (single database) you can only create AAD Users, not AAD Logins. AAD Logins were added for Azure SQL Database Managed Instance.

    So you just create the user in the target database(s), eg

    CREATE USER [someuser@somedomain.com] FROM EXTERNAL PROVIDER;