Skip to Content
IntegrationsSaaSMicrosoft 365

Test and Troubleshoot a Microsoft 365 Integration

Fix Microsoft 365 integration setup and scan errors, and test the app registration with cnspec.

Start with the message the setup script, the integration page, or a failing check shows you, and find it below. To test the app registration and its permissions directly, scan with cnspec. To learn what each integration status means, read Integration status and troubleshooting.

Scans are paused

If a credential in the space manages the integration, Mondoo checks the credential and stops scanning when it fails. The integration page shows a Scans are paused alert with one of these messages.

The credential expired

Message: Credential "<name>" has expired. Rotate it to resume scanning.

The certificate or client secret passed its expiration date. The automated setup creates one that is valid for one year.

Fix: Create a new certificate or client secret for the same app registration, then rotate the credential. See Renew the certificate or client secret.

Microsoft Entra ID rejected the credential

Message: Credential "<name>" was rejected by the provider. Update it to resume scanning.

Microsoft Entra ID refused the credential. The client secret expired or was deleted, the certificate isn't on the app registration, or the app registration was deleted.

Fix:

  1. Open the credential in Settings > Credentials to read the reason Entra gave.
  2. Fix the app registration, or create a new certificate or client secret.
  3. Rotate the credential.

To learn more, read Manage Integration Credentials.

Setup script reports NOT DONE

The automated setup script records whether admin consent and the Global Reader assignment worked. If either failed, the end of its output says so. The Azure CLI's own error appears above it.

Message: NOT DONE: admin consent could not be granted, so the app cannot use its permissions yet.

You aren't a Global Administrator or Privileged Role Administrator, so Entra refused to grant admin consent.

Fix: Ask a Global Administrator or Privileged Role Administrator to run az ad app permission admin-consent --id <client ID>, or to select Grant admin consent on the app's API permissions page in the Microsoft Entra admin center.

Global Reader wasn't assigned

Message: NOT DONE: the Global Reader directory role could not be assigned. Mondoo needs it to read Exchange Online and Security & Compliance settings.

You aren't a Global Administrator or Privileged Role Administrator, so Entra refused the role assignment.

Fix: Ask a Global Administrator or Privileged Role Administrator to open Roles & admins > Global Reader > Add assignments in the Microsoft Entra admin center and add the app with the client ID the script printed.

You can create the integration in Mondoo before an administrator finishes these steps. Until they're done, the scan fails or the checks that need the missing access report errors (see Scan errors).

Scan errors

The app can't read your organization

Error contains: Insufficient privileges to complete the operation.

Mondoo signed in, but the app registration can't read your organization from Microsoft Graph. Admin consent for its permissions is missing, usually because a NOT DONE step or Step B of the manual setup wasn't finished.

Fix: Grant admin consent as described in Admin consent wasn't granted. In the Microsoft Entra admin center, the app's API permissions page shows a granted status for every permission once consent is in place.

Exchange Online or SharePoint Online checks are denied access

Error contains: access denied, please ensure the credentials have the right permissions in Azure AD

The app registration lacks the Global Reader directory role, or admin consent for the Exchange Online or SharePoint Online permissions.

Fix: Assign Global Reader (Step C of the manual setup) and confirm admin consent is granted.

SharePoint Online requires a certificate

Error contains: only certificate authentication is supported for fetching sharepoint online report

The integration authenticates with a client secret. SharePoint Online refuses a token issued from a client secret. Exchange Online, Teams, and the rest of the tenant scan normally.

Fix: To scan SharePoint Online, use a certificate.

  1. Add a certificate to the app registration. See Create a certificate.
  2. Add the Microsoft 365 integration again with Certificate (PEM) as the Credential type.
  3. Delete the integration that uses the client secret.

Test the Microsoft 365 configuration

To confirm that the app registration and its permissions work, test them with Mondoo's open source security scanning CLI, cnspec.

Install cnspec

From your terminal (Linux shell, macOS shell, or Azure Cloud Shell), download the latest cnspec package from https://releases.mondoo.com/cnspec/. For example (use the latest version):

wget https://releases.mondoo.com/cnspec/14.12.1/cnspec_14.12.1_linux_amd64.tar.gz
tar -xvf cnspec_14.12.1_linux_amd64.tar.gz

Scan with cnspec

Scan the platform using the open source Microsoft 365 policy bundle:

cnspec scan ms365 --certificate-path certificate.combo.pem --tenant-id YOUR-TENANT-ID --client-id YOUR-CLIENT-ID --policy-bundle https://raw.githubusercontent.com/mondoohq/cnspec/refs/heads/main/content/mondoo-m365-security.mql.yaml

You can also run a specific policy:

cnspec run ms365 -c 'microsoft.policies.identitySecurityDefaultsEnforcementPolicy["isEnabled"] == false' --certificate-path certificate.combo.pem --tenant-id YOUR-TENANT-ID --client-id YOUR-CLIENT-ID

cnspec run ms365 -c "microsoft.security.latestSecureScores.controls.one( controlName == 'MFARegistrationV2' && score == 9)" --certificate-path certificate.combo.pem --tenant-id YOUR-TENANT-ID --client-id YOUR-CLIENT-ID

For YOUR-TENANT-ID and YOUR-CLIENT-ID, substitute your information.

Pay special attention to the queries showing Error results; they can result from improper permissions.

If the certificate scan fails, try a client secret

If the scan above is unsuccessful, authenticate with a client secret instead.

  1. Create a client secret for the app registration. Follow Create a client secret and record its Value.

  2. Scan with cnspec using the client secret:

    cnspec scan ms365 --client-secret YOUR-CLIENT-SECRET-VALUE --tenant-id YOUR-TENANT-ID --client-id YOUR-CLIENT-ID --policy-bundle https://raw.githubusercontent.com/mondoohq/cnspec/refs/heads/main/content/mondoo-m365-security.mql.yaml

    For YOUR-TENANT-ID and YOUR-CLIENT-ID, substitute your Azure information. For YOUR-CLIENT-SECRET-VALUE, substitute the value you recorded.

SharePoint Online checks always report only certificate authentication is supported for fetching sharepoint online report when you scan with a client secret. Ignore that error for this test. If the rest of the scan succeeds, the issue is with your certificate. Create a new one as described in Create a certificate.

Last updated on

On this page