

However, we highly recommend using the Power BI activity log for the following reasons: The Power BI activity log and unified audit log both contain a complete copy of the Power BI auditing data. However, currently, for non-Power BI Fabric items, only create, read, update, and delete operations are recorded. In case you want to use an existing tool, this one is free, works on Linux and Windows, and supports multiple outputs.The procedures described in this article can also be used to track user activities on all items in the Fabric experience. You can do this in most programming/scripting languages, but for larger amounts of logs you will want to retrieve logs in parallel, or it will take a long time. Call that URL to retrieve a JSON response with the actual logs inside. Each content blob is a JSON dict, which contains a "contentUri" field. Now that you have content blobs, use them to retrieve the actual logs. In the response header check "NextPageUri" if it contains a URL, call that URL for the next page of content. This will give you a JSON response with content blobs inside. To retrieve a page of content blobs use the following URL (change bolded content to your situation): " tenant_ID/activity/feed/subscriptions/content?contentType= Audit.Exhange&startTime= T09:42:52&endTime= T08:42:52" Therefore, for each feed you would like to retrieve logs from, you must collect all the content blobs (iterating through the pages of them) and then retrieve the actual content from that blob. Individual logs live inside content blobs, which live inside pages, which live inside feeds (e.g. The POST for Exchange for example would look like: " tenant_ID/activity/feed/subscriptions/start?contentType= Audit.Exchange"ħ: You are now ready to start retrieving actual logs. The following exist: 'Audit.General', 'Audit.AzureActiveDirectory', 'Audit.Exchange', 'Audit.SharePoint', 'DLP.All'. Headers: ""Ħ: Subscribe to the audit log feeds you would like to retrieve.To obtain this send the following POST request:
#Exchange online admin audit log registration#
You will need all three.Ĥ: From within the new App Registration go to "API permissions" and add 'Application type' permissions for: 'ActivityFeed.Read' and 'ActivityFeed.ReadDlp'.ĥ: For the following steps you will need to start calling the Office API's, for which you will need a bearer token in the header. From the overview page of the App Registration also store the "Tenant ID" and "Application (Client) ID". Store it somewhere safe as it's only shown once. Manually:ġ: Enable Audit logging on the tenant if not already enabledĢ: Create an App registration in Azure AD and for getting single tenant audit logs choose "Accounts in this organizational directory only (xyz only - Single tenant)"ģ: Create a 'secret key' from within the newly created App Registration.
#Exchange online admin audit log how to#
I'll explain how to retrieve logs manually and also show a tool which already exists for this at the bottom of the post. write a script that retrieves logs for the last week, and run it at least weekly.

So is there something I'm missing here, or is there no way to programmatically retrieve all items from the Unified Audit Logs for the entire retention period? (generally 90 days).Īs far as I know the only way to do this is to use the Management API on a regular basis and output the results to some solution for long term storage (Azure Log Analytics Workspace comes to mind, or SIEM like Splunk / Graylog).

Search-UnifiedAuditLog on Exchange Online PowerShell - Microsoft themselves recommend not to use this programmatically, and I've experienced extremely unreliable results and unmanageable rate-limiting when trying to do so. Microsoft Graph - This does not contain all the relevant data - you cannot access the Unified Audit Logs directly through Graph, and the usage reports do not cover all items contained in the Audit Logs (e.g.

Microsoft 365 Management API - This contains the correct data, but is of limited usefulness for forensic investigations due to the short 7 day retention period. I have tried the following options to access these logs from a script, with no success: From the front end, these logs are available through the Office 365 Compliance Admin Center. I would like to programmatically retrieve and process all logs available from the Office 365 Unified Audit Logs for the purpose of forensic investigation.
