I connect Azure SQL Server using a user assigned managed identity from a webapp. This works fine so fare, and our logging process shall log all activities of this app (and others) in the database.
To determine the username of the current acting user, i can usuallly use in any stored procedure something like
SELECT @ORIGINAL_LOGIN()
which will return the username of the connected user.
The username of the managed identity is in my case "octservice". But when "octservice" connects, and i log its activities, the @ORIGINAL_LOGIN() Function does not returns its username, it returns something like ClientID@TenantID from the Azure AD.
How can i anyway determine the username, like it appears in SSMS ? The ClientID@TenantID is not the USER_ID of this user.

