The following article describes the AZURE "Server admin" user. https://learn.microsoft.com/en-us/azure/sql-database/sql-database-manage-logins
This user has access to every database but unfortunately the HAS_DBACCESS(%database_name%) function fails to return 1 so I need some other way to detect this user and recognize that they have access to all databases.
I tried a number of the other methods including:
- IS_MEMBER ('db_owner')
- IS_SRVROLEMEMBER ('serveradmin')
- IS_SRVROLEMEMBER ('sysadmin')
Note: Oddly enough the HAS_DBACCESS(%database_name%) actually returns NULL.
Any suggestions would be appreciate.
The below queries were run from the Master database while logged in as rootadmin, which is the name of my Server Admin user.
Edit: When I switched to using the "Demo" database the query results changed and HAS_DBACCESS(t.name) returned NULL for the Master database and "1" for the "Demo" database.
So now I am confused.