Skip to main content

Microsoft 365 | Error 401: SSO Authentication Failure When Using a Self-Managed Agent

Overview ✨

When configuring or running a Microsoft 365 Parent Inspector or its associated Child Inspectors in Liongard, inspections may fail with an HTTP 401 (Unauthorized) error while attempting to obtain a Microsoft OAuth access token.

Applies to: Microsoft 365 Parent and Child Inspectors configured using Microsoft Sign-In (SSO) and assigned to a Self-Managed Agent.

Common Error Message:

Unable to get Microsoft access_token (SSO auth). Request failed with status code 401.

This error may occur even when:

  • Microsoft Sign-In completes successfully.

  • The requested application permissions and administrative consent have been granted.

  • Multi-Factor Authentication (MFA) is successfully completed.

  • A green checkmark appears next to the Microsoft Sign-In option in Liongard.

Successful interactive authentication does not necessarily guarantee that the Inspector can obtain a valid access token during subsequent inspections.

ℹ️ This article explains why this error may occur despite successful Microsoft authentication, how the assigned Agent can affect the authentication process, and the steps required to resolve the issue.


Common Symptoms

When a Microsoft 365 Inspector configured using Microsoft Sign-In (SSO) is assigned to a Self-Managed Agent, you may encounter one or more of the following symptoms:

  • The Microsoft 365 Parent Inspector fails during scheduled or manually triggered inspections.

  • Associated Child Inspectors fail or stop collecting updated data.

  • Microsoft Sign-In completes successfully, and a green checkmark appears in the Inspector configuration.

  • Administrative consent and Multi-Factor Authentication (MFA) are completed successfully, but subsequent inspections continue to fail.

  • Re-authenticating through Microsoft Sign-In does not resolve the issue.

  • Re-granting application permissions or administrative consent does not resolve the issue.

Common Error Message

When reviewing the Inspection Logs for the affected Microsoft 365 Inspector in Liongard, you may encounter the following error:

Unable to get Microsoft access_token (SSO auth). Request failed with status code 401 calling https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/token

This error indicates that the Inspector was unable to obtain a Microsoft OAuth access token during the inspection, despite successfully completing the interactive Microsoft Sign-In process.

Additional diagnostic information may include the following Microsoft Entra ID authentication error:

401 Unauthorized 
invalid_client
AADSTS7000215: Invalid client secret provided.

Why Does This Happen?

The Microsoft 365 Inspector uses OAuth 2.0 authentication when configured through Microsoft Sign-In (SSO).

Although interactive Microsoft Sign-In may complete successfully, the Inspector must also authenticate with Microsoft Entra ID during subsequent inspections to obtain a valid access token.

Microsoft OAuth Authentication

During an inspection, the Microsoft Sign-In authentication workflow uses:

  • Refresh Token: Obtained through the initial Microsoft authentication and authorization process, allowing Liongard to request new access tokens without requiring interactive sign-in for every inspection.

  • Application Client Secret: Used to authenticate Liongard's application with the Microsoft identity platform during token requests.

Both are required for Liongard's refresh token authentication workflow.

On-Demand vs. Self-Managed Agents

For security reasons, the application credentials required by Liongard's Microsoft Sign-In authentication workflow are not made available to Self-Managed Agents.

When a Microsoft 365 Inspector configured using Microsoft Sign-In is assigned to a Self-Managed Agent, it cannot successfully complete the required application authentication process.

As a result, Microsoft Entra ID rejects the token request, causing the inspection to fail with an HTTP 401 (Unauthorized) error.

Agent Type

Microsoft Sign-In (SSO)

On-Demand Agent

Supported

Self-Managed Agent

Not supported

⚠️ Important: Microsoft 365 Inspectors configured using Microsoft Sign-In (SSO) must be assigned to an On-Demand Agent.

Re-authenticating, completing additional MFA prompts, or re-granting administrative consent will not resolve this specific Agent-related authentication failure.


Steps to Resolve

To resolve this specific Microsoft Sign-In (SSO) authentication failure, reassign the affected Microsoft 365 Inspectors from a Self-Managed Agent to a Liongard On-Demand Agent.

This allows the Inspector to use the authentication workflow required by Microsoft Sign-In while retaining its existing Single-Tenant or Multi-Tenant configuration.

Step 1: Reassign the Microsoft 365 Inspectors

ou can reassign the affected Microsoft 365 Inspectors using either of the following methods.

Option 1: Reassign Multiple Inspectors (Recommended for Bulk Updates)

  1. Log in to your Liongard instance.

  2. Navigate to Admin → Agents.

  3. Locate and select the Self-Managed Agent currently assigned to the affected Microsoft 365 Inspectors.

  4. Scroll down to the Inspectors using this Agent section.

  5. Select the affected Microsoft 365 Parent and Child Inspectors.

  6. From the Actions dropdown, select Assign to New Agent.

  7. Select the On-Demand Agent.

  8. Click Save.

Option 2: Update an Individual Inspector

  1. Log in to your Liongard instance.

  2. Navigate to Admin → Inspectors → Microsoft 365.

  3. Locate the affected Microsoft 365 Parent or Child Inspector.

  4. Click the three-dot menu (⋮) under the Actions column next to the Inspector name.

  5. Select Edit.

  6. Locate the Agent dropdown.

  7. Change the assigned Agent from the Self-Managed Agent to On-Demand.

  8. Click Save.

  9. Repeat these steps for any remaining affected Microsoft 365 Inspectors.

📌 Important: Ensure that both the Parent Inspector and its associated Child Inspectors configured using Microsoft Sign-In (SSO) are assigned to an On-Demand Agent.

Reassigning an Inspector does not require deleting or recreating the existing Inspector.

Step 2: Run the Microsoft 365 Inspectors

After reassigning the affected Inspectors to an On-Demand Agent, trigger a new inspection using either of the following methods.

Option 1: Run an Individual Inspector (Recommended for Troubleshooting)

  1. Navigate to Admin → Inspectors → Microsoft 365.

  2. Locate the affected Microsoft 365 Parent Inspector.

  3. Right-click the Play/Pause button under the Actions column next to the Inspector name.

  4. Select Debug + Clear Cache.

  5. Allow the inspection to complete.

  6. Repeat these steps for the affected Child Inspectors, if applicable.

Running an inspection using Debug + Clear Cache clears cached inspection data and enables additional diagnostic logging, which can assist with further troubleshooting if the issue persists.

Option 2: Run Multiple Inspectors (Bulk Action)

  1. Navigate to Admin → Inspectors → Microsoft 365.

  2. Select the affected Microsoft 365 Parent and Child Inspectors using the checkboxes.

  3. From the Actions dropdown, select Run Inspectors.

  4. Allow the inspections to complete.

Verify the Inspection Results

  • Confirm that the inspection status changes to Completed.

  • Verify that the previously reported HTTP 401 authentication error no longer appears in the Inspection Logs.

  • For Multi-Tenant configurations, confirm that the Parent Inspector and associated active Child Inspectors complete successfully.

  • Review the latest Data Prints to ensure Microsoft 365 data is being collected and updated across the affected environments.

Step 3: Review Conditional Access Policies (If Applicable)

If inspections continue to fail after switching to an On-Demand Agent, review the Microsoft Entra ID sign-in logs for any Conditional Access failures.

Conditional Access policies that enforce network location restrictions, device compliance, or other authentication requirements may prevent Liongard from successfully authenticating.

⚠️ Important: Liongard On-Demand Agents use dynamic AWS IP addresses. They cannot reliably be allowlisted using specific static IP addresses.

Work with your organization's Microsoft Entra ID administrator or security team to review any conflicting policies. Do not disable MFA or broadly exclude administrative accounts from Conditional Access policies.

📘 What if My Organization Requires a Self-Managed Agent?

The Microsoft Sign-In (SSO) authentication method requires an On-Demand Agent. If your organization's security or compliance policies prohibit using On-Demand Agents, contact Liongard Support to discuss available options before making changes to your Microsoft Entra ID application configuration.

‼️ Do not delete the existing Microsoft 365 Inspectors when changing Agent assignments. Deleting an Inspector removes its historical inspection data from Liongard.


Agent Compatibility & Key Considerations

The following table summarizes the differences between Agent types when running Microsoft 365 Inspectors configured using Microsoft Sign-In (SSO).

Feature / Requirement

On-Demand Agent

Self-Managed Agent

Microsoft Sign-In (SSO)

Supported

Not supported

Single-Tenant inspection using SSO

Supported

Not supported

Multi-Tenant inspection using SSO (Parent & Child Inspectors)

Supported

Not supported

Agent hosting

Liongard-managed cloud infrastructure

Partner-managed infrastructure

Agent installation and maintenance

Managed by Liongard

Managed by the partner

Application client secret management

Managed by Liongard

Not applicable to SSO

Source IP addresses

Dynamic AWS IP addresses

Dependent on the partner's network configuration

Conditional Access considerations

Review policies if authentication is restricted

Not applicable to this SSO workflow

Recommended for Microsoft 365 SSO

Yes

No

📌 Key Takeaway: Microsoft 365 Inspectors configured using Microsoft Sign-In (SSO) must be assigned to an On-Demand Agent to successfully complete the required authentication workflow.

If your organization requires Self-Managed Agents due to security or compliance policies, contact Liongard Support to discuss available options.


When to Contact Support 🦁

Contact Liongard Support if:

  • The HTTP 401 authentication error persists after reassigning the affected Inspectors to an On-Demand Agent.

  • Microsoft Sign-In completes successfully, but inspections continue to fail.

  • The Parent Inspector completes successfully, but associated Child Inspectors continue to fail with authentication errors.

  • Your organization's security or compliance policies prevent the use of On-Demand Agents.

To assist with further troubleshooting, please provide the following information:

Screenshots from Microsoft Entra ID (If Applicable)

If authentication failures persist after switching to an On-Demand Agent, please also provide:

  • Enterprise Application Permissions: Navigate to Microsoft Entra ID → Enterprise applications → Liongard application → Permissions and provide a screenshot showing the granted permissions.

  • Sign-in Logs: Navigate to Microsoft Entra ID → Monitoring & health → Sign-in logs and provide screenshots of any relevant failed authentication events.

  • Conditional Access: Provide a screenshot of the Conditional Access tab within the relevant sign-in event, showing the policies evaluated and their results.

  • Authentication Details: Screenshot of the Authentication Details tab within the relevant sign-in event.

Additional Information

  • Affected Parent and Child Inspector names or URLs.

  • Inspector configuration type (Single-Tenant or Multi-Tenant).

  • Previous and current Agent assignments.

  • Microsoft error code, Correlation ID, and Request ID, if available.

  • Any recent changes to Agent assignments, Microsoft permissions, MFA, or Conditional Access policies.

Our Support team is happy to help! 😇

💬 Start a chat with Leo (Our AI Assistant) or connect with a live Support Engineer.


References 📚

Liongard Documentation

Related Knowledge Base Articles

Microsoft Documentation

🚨 Note : We may occasionally provide links to third-party tools or resources for additional reference. These resources are offered for convenience only, and Liongard does not control, maintain, or guarantee their functionality, accuracy, or availability. Please review and use any third-party resources at your own discretion.

Did this answer your question?