Remote Server Returned Error: (400) Bad Request when Auditing SharePoint Online and Microsoft Entra ID
Symptoms
The following errors are prompted in the Health Log for your SharePoint Online or Microsoft Entra ID (formerly Azure AD) monitoring plan:
Cannot collect Azure AD audit data due to the following error:
The remote server returned an error: (400) Bad Request.
Failed to collect state-in-time snapshot data due to the following error.
The remote server returned an error: (400) Bad Request.
Causes
- The tenant name specified for the monitoring plan is incorrect.
- Netwrix Auditor uses the O365 Management API to collect events from Microsoft cloud services. The O365 API accesses
graph.microsoft.comandmanage.office.comendpoints. If unified audit is disabled for O365, the following error will be prompted when connecting to themanage.office.com/api/v1.0/endpoint:
Tenant <TenantGUID> does not exist.
Resolutions
Step 1. Review the tenant name
To ensure the tenant name is specified correctly, refer to the Microsoft article on how to Locate important IDs for a user ⸱ Microsoft 🡥. Once you've obtained the correct Tenant ID, specify it in the affected monitoring plan.
- In the main Netwrix Auditor menu, select Monitoring Plans.
- Select the affected monitoring plan, and click Edit.
- Review the items listed under the monitoring plan by clicking Edit item in the right pane and replacing the tenant name with the Tenant ID you've previously obtained.
- Once the changes are introduced and saved, click Update under the Monitoring Plan section.
Step 2. Enable unified audit for O365
Before enabling unified audit, check if the error is present in %Working Folder%\Logs\SharePoint Online Auditing\%GUID%\SpaOnline.log. If the error is present, proceed with either of the two solutions provided below. Learn more about enabling unified audit in Turn Auditing On or Off ⸱ Microsoft 🡥.
Enable unified audit via PowerShell
-
Launch elevated PowerShell v.4 and later on your Netwrix server. Run the following commands:
$UserCredential = Get-CredentialConnect-IPPSSession -Credential $O365CredConnect-ExchangeOnlineSet-AdminAuditLogConfig -UnifiedAuditLogIngestionEnabled $TrueGet-AdminAuditLogConfig | FL UnifiedAuditLogIngestionEnableOnce the
Connect-IPPSSession -Credential $O365Credline is read, a pop-up screen to log in to your Microsoft 365 account will be prompted. Use the credentials for your data collecting account. -
Wait for 24 hours and check the status of collections and reports.
In case of any further issues, submit a case with Netwrix Technical Support.
Enable unified audit via Microsoft Purview compliance portal UI
- Log in to the Purview Compliance Portal as an Office 365 admin. Refer to the following link: Purview Compliance Portal.
- In the left pane, select Solutions > Audit.
- Select the search option.
- If search is not enabled, a Start recording user and admin activity banner will be prompted. Click it to enable auditing.
Related articles
- Office 365 Management APIs ⸱ Microsoft 🡥
- Office 365 Management Activity API FAQs and troubleshooting ⸱ Microsoft 🡥
- Microsoft 365 — Turn Auditing On or Off ⸱ Microsoft 🡥
- Microsoft Purview — Audit ⸱ Microsoft 🡥
- Microsoft 365 — Permissions for Microsoft Entra ID Auditing ⸱ v10.6
- Microsoft 365 — Permissions for SharePoint Online Auditing ⸱ v10.6
- Locate important IDs for a user ⸱ Microsoft 🡥