amachanic/sp_whoisactive

Login_name not useable in Azure SQL DB for Managed Identities

ryandevries opened this issue · 1 comments

For connections made from other MS services using managed identities, the login_name is two guids separated by an @. The first is the guid of the application ID , and the second is the guid of the tenant ID. Would be cool to pull the name of the managed identity instead. I'm not sure how to get the tenant id, but to get the application ID from converting the sid from sys.database_principals:

DECLARE @tenantID uniqueidentifier = '<guid>' SELECT Name, LOWER(CONCAT(CAST([sid] AS uniqueidentifier), '@', @tenantID)) AS GUID FROM sys.database_principals WHERE type = 'E'

@ryandevries we haven't heard back from you in a while about working on this, so I'm going to close it out for now. if you decide you want to work on it in the future, let us know and we'll re-open it for you. Thanks!