Microsoft Intune Executor¶
Category: Endpoint Security
Script: ms_intune.py
Integration: REST API (Microsoft Graph, OAuth2)
Faraday Plugin: Raw JSON
Website: https://www.microsoft.com/en-us/security/business/microsoft-intune
Description¶
Imports the managed devices of a Microsoft Intune tenant into Faraday. Each device becomes a host, and each non-compliant device gets a vulnerability that describes its compliance problem.
Prerequisites¶
- A Microsoft Entra ID (Azure AD) app registration with a client secret
- The application permissions
DeviceManagementManagedDevices.Read.AllandDeviceManagementConfiguration.Read.All, with admin consent granted - Network access to
login.microsoftonline.comandgraph.microsoft.com
Configuration¶
Environment Variables (Setup)¶
| Variable | Required | Description |
|---|---|---|
AZURE_TENANT_ID |
Yes | Directory (tenant) ID of the Entra ID tenant |
AZURE_CLIENT_ID |
Yes | Application (client) ID of the app registration |
AZURE_CLIENT_SECRET |
Yes | Client secret of the app registration |
These variables are also accepted as execution arguments, so a single run can override them.
Execution Arguments¶
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
INTUNE_COMPLIANCE_STATE_FILTER |
string | No | Only import devices in this compliance state: compliant, nonCompliant or unknown (default: all) |
INTUNE_PLATFORM |
string | No | Only import devices of this platform: windows, macos, ios or android (default: all) |
INTUNE_MIN_SEVERITY |
string | No | Minimum severity to import: info, low, medium, high or critical (default: info) |
YAML Configuration Example¶
executors:
ms_intune:
repo_executor: ms_intune.py
max_size: 65536
varenvs:
AZURE_TENANT_ID: "<azure_tenant_id>"
AZURE_CLIENT_ID: "<azure_client_id>"
AZURE_CLIENT_SECRET: "<azure_client_secret>"
params:
INTUNE_COMPLIANCE_STATE_FILTER:
mandatory: false
type: string
base: string
INTUNE_PLATFORM:
mandatory: false
type: string
base: string
INTUNE_MIN_SEVERITY:
mandatory: false
type: string
base: string
How It Works¶
- Requests a token from
login.microsoftonline.com/{AZURE_TENANT_ID}/oauth2/v2.0/token(client credentials, scopehttps://graph.microsoft.com/.default) - Reads
deviceManagement/managedDevicesfrom Microsoft Graph v1.0, following the next-page links.INTUNE_COMPLIANCE_STATE_FILTERandINTUNE_PLATFORMare sent to Graph as an OData$filter. - Reads the compliance policies and the device configurations (with their assignments) and adds them as references
- Creates one host per device, and one vulnerability for every device that is not compliant:
- Severity:
nonCompliantanderrorare high,conflictis medium,inGracePeriodis low,unknownandconfigManagerare info - Status: open for non-compliant states
- Severity:
- Drops vulnerabilities below
INTUNE_MIN_SEVERITY
Notes¶
- Compliant devices are still imported as hosts, without vulnerabilities.
- The host IP is the device's IPv4 address when Intune reports one, otherwise
0.0.0.0. The description holds the device ID, user, operating system, model, serial number, compliance state and last sync time. - The setup variables can also be passed as execution arguments.
- The shared agent parameters (
AGENT_CONFIG_*tags and severity filters) are not applied by this executor. UseINTUNE_MIN_SEVERITYto filter by severity.