Microsoft 365 Defender

Community Platform

runZero integrates with Microsoft 365 Defender to allow you to sync and enrich your asset inventory. Adding your Microsoft 365 Defender data to runZero makes it easier to find assets missing EDR protection.

Getting started

To set up the Microsoft 365 Defender integration, you’ll need to:

  1. Configure Microsoft 365 Defender to allow API access through runZero.
  2. Add the Microsoft 365 Defender credential in runZero.
  3. Choose whether to configure the integration as a scan probe or connector task.
  4. Activate the Microsoft 365 Defender integration to sync your data with runZero.

Requirements

Before you can set up the Microsoft 365 Defender integration:

  • Verify that you have runZero Enterprise.
  • Make sure you have access to the Microsoft Azure portal.

Step 1: Register an Azure application for Microsoft 365 Defender API access

runZero can authenticate to the Microsoft 365 Defender API using a client secret. Register an application to configure Microsoft 365 Defender API access.

  1. Sign in to the Microsoft Azure portal.
  2. Go to Azure Active Directory > App registrations and click on New registration.
    • Provide a name.
    • Select the supported account types.
    • Optionally add a redirect URI.
  3. Click Register to register the application.
  4. Once the application is created, you should see the Overview dashboard. Note the following information:
    • Application (client) ID
    • Directory (tenant) ID
  5. From the application’s details page, go to API permissions > Add a permission.
  6. Select the second tab called APIs my organization uses to view available APIs.
  7. Select WindowsDefenderATP from the list of Microsoft APIs.
  8. Select the permissions type Application permissions to configure a client secret.
  9. Search for and select the following required permissions:
    • Windows Defender ATP API permissions:
      • Machine.Read.All
  10. Click Add permissions to save the permissions to the application.
  11. Navigate to Azure Active Directory > App registrations and select the application you created.
  12. Go to Certificates & secrets and click on New client secret.
    • Enter a description.
    • Select the expiration.
  13. Click Add to create the client secret and save the client secret value.

Step 2: Add an Azure Client Secret credential to runZero

This type of credential can be used to sync all resources in a single directory (across multiple subscriptions).

  1. Go to the Credentials page in runZero and click Add Credential.
  2. Provide a name for the credential, like Azure Client Secret.
  3. Choose Azure Client Secret from the list of credential types.
  4. Provide the following information:
    • Azure application (client) ID - The unique ID for the registered application. This can be found in the Azure portal if you go to Azure Active Directory > App registrations and select the application.
    • Azure client secret - To generate a client secret, go to Azure Active Directory > App registrations, select your application, go to Certificates & secrets and click on New client secret.
    • Azure directory (tenant) ID - The unique ID for the tenant. This can be found in the Azure portal if you go to Azure Active Directory > App registrations and select the application.
    • Select the Access all subscriptions in this directory (tenant) option to sync all resources in your directory. Otherwise, specify the Azure subscription ID - The unique ID for the subscription that you want to sync. This can be found in the Azure portal if you go to Subscriptions and select the subscription.
  5. If you want other organizations to be able to use this credential, select the Make this a global credential option. Otherwise, you can configure access on a per organization basis.
  6. Save the credential. You’re now ready to set up and activate the connection to bring in data from Azure.

Step 3: Choose how to configure the Microsoft 365 Defender integration

The Microsoft 365 Defender integration can be configured as either a scan probe or a connector task. Scan probes gather data from integrations during scan tasks. Connector tasks run independently from either the cloud or one of your Explorers, only performing the integration sync.

Step 4: Set up and activate the Microsoft 365 Defender integration to sync data

After you add your Microsoft 365 Defender credential, you’ll need to set up a connector task or scan probe to sync your data.

Step 4a: Configure the Microsoft 365 Defender integration as a connector task

A connection requires you to set a schedule and choose a site. The schedule determines when the sync occurs, and the site determines where any new Microsoft 365 Defender-only assets are created.

  1. Activate a connection to Microsoft 365 Defender. You can access all available third-party connections from the integrations page, your inventory, or the tasks page.
  2. Choose the credential you added earlier. If you don’t see the credential listed, make sure it has access to the organization you are currently in.
  3. Enter a name for the task, like Microsoft 365 Defender sync.
  4. Schedule the sync. A sync can be set to run on a recurring schedule or run once. The schedule will start on the date and time you have set.
  5. Under Task configuration, choose the site you want to add your assets to.
  6. If you want to exclude assets that have not been scanned by runZero from your integration import, switch the Exclude unknown assets toggle to Yes. By default, the integration will include assets that have not been scanned by runZero.
  7. If you want to include assets that have stopped reporting to the Microsoft 365 Defender service in your integration import, switch the Include inactive assets toggle to Yes. By default, the integration will not include assets that are marked as inactive.
  8. Activate the connection when you are done. The sync will run on the defined schedule. You can always check the Scheduled tasks to see when the next sync will occur.

Step 4b: Configure the Microsoft 365 Defender integration as a scan probe

  1. Create a new scan task or select a future or recurring scan task from your Tasks page.
  2. Add or update the scan parameters based on any additional requirements.
  3. On the Probes and SNMP tab, choose which additional probes to include, set the Defender365 toggle to Yes, and change any of the default options if needed.
  4. On the Credentials tab, set the MS365Defender toggle for the credential you wish to use to Yes.
  5. Click Initialize scan to save the scan task and have it run immediately or at the scheduled time.

Step 5: View Microsoft 365 Defender assets

After a successful sync, you can go to your inventory to view your Microsoft 365 Defender assets. These assets will have an Active Directory icon listed in the Source column.

To filter by Microsoft 365 Defender assets, consider running the following queries:

Click into each asset to see its individual attributes. runZero will show you the attributes returned by Microsoft 365 Defender.

Filtering Microsoft 365 Defender assets

An optional filter can be applied to Microsoft 365 Defender integration tasks. runZero uses Microsoft Graph $filter query paramater to filter assets. GraphQL follows the syntax <property> [operator] <value>. Multiple expressions can be combined for more complex filtering by adding an and or or between expressions.

Properties

Any property that runZero imports from Microsoft 365 Defender can be used to apply a filter. The following are some examples.

Defender Property runZero Attribute Description Example
computerDNSName @ms365defender.dev.computerDNSname The hostname of the device EXPLORER-01
osPlatform @ms365defender.dev.osPlatform The operation system of the device Windows11, Android
heatlhStatus @ms365defender.dev.heatlhStatus The health status of the Defender agent that is installed Active, Inactive
isAADJoined @ms365defender.dev.isAADJoined Boolean value specifying whether the device is registered in Azure AD true, false
managedBy @ms365defender.dev.managedBy Description of how the device is managed Intune

Operators

The following are common operators that can be used in a Microsoft 365 Defender filter.

  • Equal to (eq)
  • Not equal to (ne)
  • Has (has)
  • Less than (lt)
  • Greather than (gt)
  • Less than or equal to (le)
  • Greater than or equal to (ge)

The following are common functions that can be used in a Microsoft 365 Defender filter. Functions follow the syntax function(<property>, <value>).

  • Starts with (startswith)
  • Ends with (endswith)
  • Contains (contains)

Example Filters

The following are examples of filters that can be applied to a Microsoft 365 Defender integration.

Search Filter Description
not(osPlatform eq 'Android') Import all assets except those with an Android operating system
not(osPlatform eq 'Android') and not(osPlatform eq 'iOS') Import all assets execpt those with an Android or iOS operating system
startswith(computerDNSname, 'PROD') Import all devices with a hostname that starts with PROD
not(startswith(computerDNSname, 'DEV')) Import all devices except those with a hostname that starts with DEV

Troubleshooting

If you are having trouble using this integration, the questions and answers below may assist in your troubleshooting.

Why is the Microsoft 365 Defender integration unable to connect?

  1. Are you getting any data from the Microsoft 365 Defender integration?
    • Make sure to query the inventory rather than look at the task details to review all the data available from this integration.
    • In some cases, integrations have a configuration set that limits the amount of data that comes into the runZero console.
  2. Some integrations require very specific actions that are easy to overlook. If a step is missed when setting up the intergration, it may not work correctly. Please review this documentation and follow the steps exactly.
  3. If the Microsoft 365 Defender integration is unable to connect be sure to check the task log for errors. Some common errors include:
    • 500 - server error, unable to connect to the endpoint
    • 404 - hitting an unknown endpoint on the server
    • 403 - not authorized, likely a credential issue
Updated