How to get the details of current user who is logged in to azure?

asdfasfawfwfwf 40 Reputation points
2024-02-06T12:14:13.8633333+00:00

How to get the details of current user who is logged in to azure through js in a local webpage?

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
2,812 questions
JavaScript API
JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
871 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan Hill 25,981 Reputation points Microsoft Employee
    2024-02-07T02:06:09.8966667+00:00

    Hello @asdfasfawfwfwf

    Use the Azure Monitor Activity Log API, https://learn.microsoft.com/en-us/rest/api/monitor/activity-logs/list?view=rest-monitor-2015-04-01&tabs=HTTP, to pull this information. Since you tagged App Serivce, I'm assuming you want to know the user(s) that have had activity on a specific app service resource. For that, you can append the resource information to the $select query parameter. Another way is https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{appname}/providers/microsoft.insights/eventtypes/management/values?api-version=2015-04-01&$filter=eventTimestamp ge '2022-01-01T00:00:00Z' and eventTimestamp le '2022-01-31T23:59:59Z'Just make sure you pass a valid bearer token in the in Authorization HTTP header.