Skip to content

[FEATURE REQUEST] Optional pre-enrollment inventory sync (Autopilot / Apple DEP / corporate identifiers) #35

Description

@brngates98

Problem or use case

intune2snipe currently only creates/updates Snipe-IT assets for devices that already show up in GET /deviceManagement/managedDevices — i.e. devices that have actually enrolled in Intune. There's no visibility into hardware that's been purchased and is sitting in inventory but hasn't been unboxed/enrolled yet:

  • Windows devices registered in Windows Autopilot but never enrolled
  • iOS/iPadOS/macOS devices assigned via Apple Business Manager / Apple School Manager (DEP) but not yet enrolled
  • Any platform (including Android) staged via Intune's manually-uploaded corporate device identifiers (serial/IMEI allowlist)

For orgs that want full asset-lifecycle tracking in Snipe-IT — from "we bought it" through "it's deployed to a user" — this is a real gap. The goal is "ultra completeness": a Snipe-IT asset should exist for a device the moment it's known to the organization, not just once someone unboxes it.

Proposed solution

Add an optional pending-enrollment inventory pre-sync, in the same shape as the Entra user pre-sync added in #33 (disabled by default, env-var gated, runs as an independent pass that doesn't change existing behavior when off).

New env vars (proposed):

Variable Purpose
SNIPEIT_TRACK_PENDING_ENROLLMENT Set to true to enable the pre-enrollment inventory pass (default: false)
SNIPEIT_STATUS_PENDING_ENROLLMENT Status label for placeholder assets (default: Pending Enrollment, auto-created like the other lifecycle statuses)
SNIPEIT_PENDING_ENROLLMENT_SOURCES Comma list of sources to pull from: autopilot, dep, corporate (default: all three)

Data sources (Microsoft Graph, beta unless noted):

  1. Windows AutopilotGET /deviceManagement/windowsAutopilotDeviceIdentities (already fetched today for lifecycle reconciliation, just not used to create assets). Also carries groupTag and purchaseOrderIdentifier, currently unused.
  2. Apple DEP/ABMGET /deviceManagement/depOnboardingSettings (one per Apple token — Business Manager and School Manager tokens can coexist, so iterate all) → .../importedAppleDeviceIdentities. Gives serialNumber, platform, enrollmentState, isSupervised, discoverySource.
  3. Manually-staged corporate identifiersGET /deviceManagement/importedDeviceIdentities. Cross-platform (this is the practical Android story — Google's zero-touch portal itself isn't reachable via Graph, but IMEI/serials uploaded to Intune's corporate identifier list are).

All three expose a serial (or IMEI) plus an enrollmentState (unknown/notContacted/pendingReset/failed/blocked/enrolled) and platform — a consistent, minimal shape.

Sync behavior:

For each identifier from an enabled source where enrollmentState != "enrolled" and no existing Snipe asset matches the serial, create a minimal placeholder asset: serial, platform-derived category, status Pending Enrollment, no checkout. Because the existing sync_device flow already matches assets by serial number on every run, this requires no new dedup logic — the day the device actually enrolls in Intune, the normal sync finds the placeholder by serial and fills in the rest (model, user, custom fields, checkout) in place.

Symmetrically, if a placeholder's serial later disappears from its source (order canceled, device returned) while still un-enrolled, archive it the same way reconcile_missing_devices already does for devices leaving Intune.

Smaller, related wins to fold in if we're touching this area:

  • Map Autopilot groupTag → Snipe location/department (auto-provision based on deployment group) and purchaseOrderIdentifier → Snipe's built-in order_number field.
  • A few more managedDevice properties as optional custom fields via the existing generic mapping mechanism (isEncrypted, jailBroken, totalStorageSpaceInBytes, physicalMemoryInBytes, deviceRegistrationState) — cheap since the custom-field plumbing already exists.

Permissions: Likely reuses the DeviceManagementServiceConfig.Read.All scope already required for Autopilot (same Intune "Enrollment" permission category as importedDeviceIdentities and depOnboardingSettings) — needs verification against current Graph docs at implementation time.

Alternatives considered

  • Do nothing / require devices to be manually pre-created in Snipe-IT before enrollment — defeats the purpose of automated sync and is the same friction [FEATURE REQUEST] Optional Entra user sync before asset sync #33 was trying to remove on the user side.
  • Only support Windows Autopilot (data we already fetch) — cheaper, but explicitly not "ultra complete" since it ignores Apple DEP/ABM and the cross-platform corporate-identifiers path, which is the intent here.

Primary area

Microsoft Graph / Intune

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions