> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/adapters/m/microsoft-intune.md).

# Microsoft Intune

Microsoft Intune manages mobile devices and PCs in Microsoft 365. OctoXLabs reads managed devices from Microsoft Graph and can add installed software, MFA registration data and compliance policy status.

## Use cases

* List devices managed by Intune.

```
Adapters = microsoft-intune
```

* Find Intune devices that have not synced for 30 days.

```
Adapters = microsoft-intune AND NOT LastSeen last now-30d/d
```

## Before you begin

### Network

| Source              | Destination               | Port | Protocol |
| ------------------- | ------------------------- | ---- | -------- |
| OctoXLabs connector | login.microsoftonline.com | 443  | HTTPS    |
| OctoXLabs connector | graph.microsoft.com       | 443  | HTTPS    |

### Required permissions

| Scope or role                                                          | Permission | Needed for                                                                  |
| ---------------------------------------------------------------------- | ---------- | --------------------------------------------------------------------------- |
| DeviceManagementManagedDevices.Read.All (Microsoft Graph, application) | Read       | Managed devices and per-device installed software                           |
| DeviceManagementApps.Read.All                                          | Read       | Fetch Installed Software in Batch (Intune export job, AppInvRawData report) |
| DeviceManagementConfiguration.Read.All                                 | Read       | Fetch Compliance Policies                                                   |
| AuditLog.Read.All                                                      | Read       | Fetch MFA Data                                                              |

## Create credentials in Microsoft Intune

{% stepper %}
{% step %}

### Register an application

Sign in to the Azure Portal as an administrator, open Azure Active Directory and select App registrations > New registration. Fill in the details and select Register. Note the Application (client) ID and Directory (tenant) ID.
{% endstep %}

{% step %}

### Create a client secret

In the left menu, select Certificates & Secrets > New client secret. Select Add and copy the secret value. Skip this step if you use certificate authentication.
{% endstep %}

{% step %}

### Add API permissions

Select API Permissions > Add a permission, choose APIs my organization uses, select Microsoft Graph, then Application Permissions. Add the permissions from the table above for the options you enable. Grant admin consent.
{% endstep %}

{% step %}

### Optional, use a certificate

If your policy disallows client secrets, set Auth Type to `certificate`. Upload a PEM file (key and certificate concatenated) or a PFX file. Register the public part of the same certificate on the app registration. Enter the certificate password only for an encrypted PFX.
{% endstep %}
{% endstepper %}

{% hint style="warning" %}
The frontend instructions announce that from version 6.6.0 the per-device software fetch will be removed. Software will then be read only through the Intune Data Export API (AppInvRawData report). Grant DeviceManagementApps.Read.All before upgrading. Without it the export job fails and no software data is collected.
{% endhint %}

## Connection parameters

| Parameter                                                            | Required    | Type    | Default | Description                                                                                                                        |
| -------------------------------------------------------------------- | ----------- | ------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| Tenant ID (`tenant_id`)                                              | Yes         | String  |         | Directory (tenant) ID.                                                                                                             |
| Client ID (`client_id`)                                              | Yes         | String  |         | Application (client) ID.                                                                                                           |
| Auth Type (`auth_type`)                                              | No          | String  | secret  | `secret` or `certificate`. Certificate uses a signed JWT client assertion.                                                         |
| Client Secret (`client_secret`)                                      | Conditional | String  |         | Required when Auth Type is `secret`.                                                                                               |
| Certificate (`certificate`)                                          | Conditional | String  |         | PEM or PFX file content. Required when Auth Type is `certificate`.                                                                 |
| Certificate Password (`certificate_password`)                        | No          | String  |         | Only for an encrypted PFX.                                                                                                         |
| SSL (`is_secure`)                                                    | No          | Boolean | True    | Use HTTPS for the token request.                                                                                                   |
| Proxy (`proxy`)                                                      | No          | String  |         | Proxy as `host:port`.                                                                                                              |
| Fetch MFA Data (`fetch_mfa`)                                         | No          | Boolean | False   | Fetch MFA registration details of the users related to the devices.                                                                |
| Fetch Installed Software (`fetch_installed_software`)                | No          | Boolean | False   | Fetch installed applications for each managed device.                                                                              |
| Fetch Installed Software in Batch (`fetch_installed_software_batch`) | No          | Boolean | False   | Use the Intune Data Export API in one export job instead of one call per device. Applies only when Fetch Installed Software is on. |
| Fetch Compliance Policies (`fetch_compliance_policies`)              | No          | Boolean | False   | Attach assigned compliance policies and their status to each device.                                                               |
| Timeout (`timeout`)                                                  | No          | Integer | 60      | Seconds to wait for API responses.                                                                                                 |

## Troubleshooting

| Error message                                                           | Cause                                                                   | Fix                                      |
| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ---------------------------------------- |
| Certificate is required when auth\_type is 'certificate'.               | Auth Type is `certificate` and no certificate was uploaded.             | Upload the PEM or PFX file.              |
| Client secret is required when auth\_type is 'secret'.                  | Auth Type is `secret` and Client Secret is empty.                       | Enter the client secret.                 |
| Certificate file does not contain both a private key and a certificate. | The PFX has no private key or no certificate.                           | Use a PFX or PEM that holds both.        |
| Non-retryable status `for`                                              | Graph returned a status other than 200, 201, 202, 204, 401, 429 or 500. | Check the permissions and admin consent. |

## Change history

{% hint style="info" %}
Available starting from version 3.3.0.
{% endhint %}
