user989988
user989988

Reputation: 3746

Grant Azure Function in staging slot MSI access to the SQL Server Database

I have an Azure Function (function-name) for which I granted MSI access to the SQL Server Database using the following sql query:

IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'function-name')
BEGIN
 CREATE USER [function-name] FROM EXTERNAL PROVIDER;
 ALTER ROLE db_datareader ADD MEMBER [function-name];
END

I added a staging deployment slot. How do I grant function-name in staging slot MSI access to the SQL Server Database?

Upvotes: 1

Views: 428

Answers (1)

Yevhen
Yevhen

Reputation: 21

In my case, it worked like this:

CREATE USER [function-name/slots/staging] FROM EXTERNAL PROVIDER    

Upvotes: 2

Related Questions