0

I would like to know the users and their actions on my Azure SQL Database. Is there any way to get this information?

Arul
  • 1
  • Hi Arul, If my answer is helpful for you, please mark it as answer( click on the check mark beside the answer to toggle it from greyed out to filled in.). This can be beneficial to other community members. Thank you. – Leon Yue Mar 05 '20 at 07:23

1 Answers1

0

Azure SQL database support query all the users and its username:

select name as username,
       create_date,
       modify_date,
       type_desc as type,
       authentication_type_desc as authentication_type
from sys.database_principals
where type not in ('A', 'G', 'R', 'X')
      and sid is not null
      and name != 'guest'
order by username;

We also could get all the query text history sys.query_store_query_text:

SELECT deqs.last_execution_time AS [Time]
    ,dest.TEXT AS [Query]
FROM sys.dm_exec_query_stats AS deqs
CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest
ORDER BY deqs.last_execution_time DESC

But we can't get the users and their actions(query history) on in Azure SQL Database for now. There are not documents and API support.

Hope this helps.

Leon Yue
  • 15,693
  • 1
  • 11
  • 23