Azure SQL – Difference Between Server Login and Database Login

azure-sql-databasesql server

In my Azure SQL server, I see the SQL login that allows me to connect to the server. However, when I look at the Users defined for my database on that server, I don't see a user account with the same name (which I would expect). How am I able to access my database (which I am able to do), without a database user account?

Best Answer

Your login is mapped to different database user, most probably to dbo . You can check this by executing:

SELECT CURRENT_USER

You can also compare the output from following views (and find matching SIDs to figure out login to user mapping):

SELECT *  FROM sys.sql_logins -- you need to execute this on master azure db

SELECT * FROM sys.database_principals -- you need to execute this on the database of interest