Lesson Learned #93: Defining a custom SQL role to someone logging in via Azure AD
Published Jul 03 2019 10:31 AM 1,088 Views

Today, I worked on a service request where our customer asked is it possible to define a custom SQL role to someone logging in via Azure Active Directory who is in the Admins group?


In Azure SQL Database we have two administrator users: SQL Logins and Azure Active Directory that could be a AAD User or AAD Group.


However, we couldn't see this user in the security list of the database and we cannot add this administrator user as a custom SQL role.


In this situation, I noticed that running SELECT USER_NAME(), this command returns dbo and, at least, you could identify this type of group.


For giving more context in this situation, the idea is to use Row Level Security to an specific group and specific Admin Users, for example:


ALTER FUNCTION [fn_access]()





RETURN SELECT 1 AS fn_accessResult




Version history
Last update:
‎Jul 03 2019 10:31 AM
Updated by: