简体   繁体   中英

How to identify server admin account name in windows Azure SQL Database

There are two administrative accounts ( Server admin and Active Directory admin) that act as administrators. My requirement is to find out the names of these accounts. I have looked into sys.database_principles view and sys.sql_logins view but could not find anything relevant to the same. From SQL query i could not find any helpful system view to fetch the information. Can anyone please help me here?

You can use the TSQL script below to get the Server Admin and Active Directory Admin account names.

SELECT [name], [type], [type_desc], [authentication_type], [authentication_type_desc] FROM sys.database_principals
WHERE (type = 'S' AND [name] != 'dbo' AND authentication_type = 1) OR 
(type = 'X' AND authentication_type = 4)

Important Note:

  1. You need to run the TSQL against the master system database
  2. Use the latest version of SQL Server Management Studio

Alternatively, you can get both account names from the Azure portal as shown below. 在此处输入图片说明

Reference: Controlling and granting database access

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM