Skip to content

Microsoft 365 Authentication

DRACO authenticates to Microsoft 365 with an application registration (app-only authentication).

Common Setup

Authentication Methods Overview

Required Permissions

To run the full DRACO provider, including PowerShell checks, two types of permission scopes must be set in Microsoft Entra ID.

Application Permissions for App-Only Authentication

When using service principal authentication, add these Application Permissions:

Microsoft Graph API Permissions:

  • AccessReview.Read.All: Required for entra_access_review_guest_users_configured and entra_access_review_privileged_roles_configured checks. A Microsoft Entra ID P2 or Microsoft Entra ID Governance license is also required.
  • AuditLog.Read.All: Required for Entra service.
  • Directory.Read.All: Required for all services.
  • OnPremDirectorySynchronization.Read.All: Required for entra_seamless_sso_disabled check (hybrid deployments).
  • Policy.Read.All: Required for all services.
  • RoleManagementPolicy.Read.Directory: Required for entra_pim_global_administrator_approval_required and entra_pim_privileged_role_administrator_approval_required checks. A Microsoft Entra ID P2 or Microsoft Entra ID Governance license is also required.
  • SecurityIdentitiesHealth.Read.All: Required for defenderidentity_health_issues_no_open check.
  • SecurityIdentitiesSensors.Read.All: Required for defenderidentity_health_issues_no_open check.
  • SharePointTenantSettings.Read.All: Required for SharePoint service.
  • ThreatHunting.Read.All: Required for Defender XDR checks (defenderxdr_endpoint_privileged_user_exposed_credentials, defenderxdr_critical_asset_management_pending_approvals).
  • DeviceManagementServiceConfig.Read.All: Required for Intune device management settings used by entra_conditional_access_policy_mdm_compliant_device_required check.
  • DeviceManagementConfiguration.Read.All: Required for Intune device compliance policies used by entra_conditional_access_policy_mdm_compliant_device_required check.
  • DeviceManagementManagedDevices.Read.All: Required for Intune managed devices used by entra_conditional_access_policy_mdm_compliant_device_required check.

External API Permissions:

  • Exchange.ManageAsApp from external API Office 365 Exchange Online: Required for Exchange PowerShell module app authentication. The Global Reader role must also be assigned to the app.
  • application_access from external API Skype and Teams Tenant Admin API: Required for Teams PowerShell module app authentication.

Note

Directory.Read.All can be replaced with Domain.Read.All for more restrictive permissions, but Entra checks related to DirectoryRoles and GetUsers will not run. If using this option, you must also add the Organization.Read.All permission to the application registration for authentication.

Note

These permissions enable application-based authentication methods (client secret and certificate). Using certificate-based authentication is the recommended way to run the full M365 provider, including PowerShell checks.

Step-by-Step Permission Assignment

Create Application Registration

  1. Access Microsoft Entra ID.

Overview of Microsoft Entra ID

  1. Navigate to "Applications" > "App registrations".

App Registration nav

  1. Click "+ New registration", complete the form, and click "Register".

New Registration

  1. Go to "Certificates & secrets" > "Client secrets" > "+ New client secret".

Certificate & Secrets nav

  1. Fill in the required fields and click "Add", then copy the generated Value (shown once): it is the Client secret you enter in DRACO.

New Client Secret

Grant Microsoft Graph API Permissions

  1. Open API permissions for the DRACO application registration.

API Permission Page

  1. Click "+ Add a permission" > "Microsoft Graph" > "Application permissions".

Add API Permission

  1. Search and select the required permissions:

  2. AccessReview.Read.All: Required for entra_access_review_guest_users_configured and entra_access_review_privileged_roles_configured checks. A Microsoft Entra ID P2 or Microsoft Entra ID Governance license is also required

  3. AuditLog.Read.All: Required for Entra service
  4. Directory.Read.All: Required for all services
  5. OnPremDirectorySynchronization.Read.All: Required for entra_seamless_sso_disabled check (hybrid deployments)
  6. Policy.Read.All: Required for all services
  7. RoleManagementPolicy.Read.Directory: Required for entra_pim_global_administrator_approval_required and entra_pim_privileged_role_administrator_approval_required checks. A Microsoft Entra ID P2 or Microsoft Entra ID Governance license is also required
  8. SecurityIdentitiesHealth.Read.All: Required for defenderidentity_health_issues_no_open check
  9. SecurityIdentitiesSensors.Read.All: Required for defenderidentity_health_issues_no_open check
  10. SharePointTenantSettings.Read.All: Required for SharePoint service

Permission Screenshots

Application Permissions

  1. Click "Add permissions", then click "Grant admin consent for <your-tenant-name>".

Grant PowerShell Module Permissions

  1. Add Exchange API:

  2. Search and select "Office 365 Exchange Online" API in APIs my organization uses.

Office 365 Exchange Online API

  • Select "Exchange.ManageAsApp" permission and click "Add permissions".

Exchange.ManageAsApp Permission

  • Assign Global Reader role to the app: Go to Roles and administrators > click here for directory level assignment.

Roles and administrators

  • Search for Global Reader and assign it to the application.

Global Reader Role

  1. Add Teams API:

  2. Search and select "Skype and Teams Tenant Admin API" in APIs my organization uses.

Skype and Teams Tenant Admin API

  • Select "application_access" permission and click "Add permissions".

application_access Permission

  1. Click "Grant admin consent for <your-tenant-name>" to grant admin consent.

Grant Admin Consent

Final permissions should look like this:

Final Permissions

Certificate-based authentication replaces the client secret with an X.509 certificate that signs Microsoft Entra ID tokens for the DRACO application registration.

This is the recommended approach for production environments because it avoids long-lived secrets, supports the full provider (including PowerShell checks), and simplifies unattended automation. Microsoft also recommends certificate credentials for app-only access, see Manage certificates for applications.

Generate the Certificate

The service principal needs a certificate that contains the private key locally (for DRACO) and the public key uploaded to Microsoft Entra ID. The following commands show a secure baseline workflow on macOS or Linux using OpenSSL:

# 1. Create a private key (keep this file private; do not upload it to the portal)
openssl genrsa -out dracom365.key 2048

# 2. Create a self-signed certificate valid for two years
openssl req -x509 -new -nodes -key dracom365.key -sha256 -days 730 -out dracom365.cer -subj "/CN=DracoM365Cert"

# 3. Package the key and certificate into a passwordless PFX bundle for DRACO
openssl pkcs12 -export \
  -out dracom365.pfx \
  -inkey dracom365.key \
  -in dracom365.cer \
  -passout pass:

Warning

Guard dracom365.key and dracom365.pfx. Only upload the .cer file to the Entra ID portal. Rotate or revoke the certificate before it expires or if there is any suspicion of exposure.

If an internal certificate authority is preferred, replace step 2 with a CSR workflow and import the signed certificate instead.

Upload the Certificate to Microsoft Entra ID

  1. Open Microsoft Entra ID > App registrations > the DRACO application.
  2. Go to Certificates & secrets > Certificates.
  3. Select Upload certificate and choose dracom365.cer.
  4. Confirm the certificate appears with the expected expiration date.

After the certificate is in place, encode the PFX file as Base64 (macOS/Linux example):

base64 -i dracom365.pfx -o dracom365.pfx.b64
cat dracom365.pfx.b64 | tr -d '\n'

Copy the resulting single-line Base64 string (or the contents of dracom365.pfx.b64) for the next step.

Provide the Certificate to DRACO

Paste the Base64-encoded PFX in the Certificate Content field when configuring the Microsoft 365 provider in DRACO.

Store the PFX file itself securely (or delete it): DRACO keeps the content encrypted.

Note

Do not mix certificate authentication with a client secret. Provide either a certificate or a secret to the application registration and DRACO configuration.

Application Client Secret Authentication

Authenticate using a Microsoft Entra application registration with a client secret (tenant ID, client ID and client secret). This is helpful for initial validation or temporary access. Plan to transition to certificate-based authentication to remove long-lived secrets and keep full provider coverage in unattended environments.

Note

To scan every M365 check, ensure the required permissions are added to the application registration. Refer to the PowerShell Module Permissions section for more information.

If the external API permissions described above are not added, only checks that work through Microsoft Graph will be executed. This means that the full provider will not be executed.

Enter the Credentials in DRACO

Use the shared permissions and credentials above, then complete the Microsoft 365 provider form in DRACO. The platform persists the encrypted credentials and supplies them during scans.

  1. Select App Certificate Credentials.
  2. Enter the tenant ID and application (client) ID.
  3. Paste the Base64-encoded certificate in Certificate Content.

This method keeps all Microsoft 365 checks available, including PowerShell-based checks.

Application Client Secret Authentication

  1. Select App Client Secret Credentials.
  2. Enter the tenant ID and application (client) ID.
  3. Enter the client secret.