Skip to content

Intune Asset Type PR Review

Ed Mozley edited this page Nov 14, 2026 · 1 revision

Intune gives each asset a type from what its device is - PR review

PR #339 by vsc55 Β· Closes #336 Β· Built on #338 (review) Β· Verdict: merge, with fixes Β· 5.3.0

An asset the Intune sync created had no type - createDiscoveredAsset() is given a hostname, make, model, OS and serial, never a type - so on an install fed by Intune most assets had no icon and nothing to group or report on by type. Intune does know: Graph sends chassisType with every managed device. Asset types are each install's own (Laptop here, PortΓ‘til there), so nothing is hard-coded: Assets β†’ Settings β†’ Intune maps each kind of device to one of the install's types, and the sync gives each asset with no type the one its device's kind is mapped to. User page: Assets. Internals: Asset reconciliation - Developer Guide Β§6d.

What was checked

Question Result
Can a type somebody chose be changed? No - intuneApplyAssetTypes() reads only assets with asset_type_id IS NULL, and writes through AssetsService::updateFields(), so each type given is in the asset's history
An asset whose devices disagree? Gets nothing - every device of the asset must say the same kind
When chassisType is unknown? Only iOS, iPadOS and Android fall back on their operating system (Other mobile device); a Windows, macOS or Linux machine could be a laptop or a desktop, so it gets no kind rather than a guess
Devices synced before the new column? Read from raw_json (COALESCE(d.chassis_type, JSON_EXTRACT(raw_json, '$.chassisType')))
Can it give an asset a type its company cannot use? Not after the merge - see fix 1
Can a failed load wipe the mapping? Not after the merge - see fix 2
Who can create types? Create needs the asset-types permission as well as the Intune one (api/intune/type_map.php)

On the test install: tests/intune-asset-type.php 41 checks (29 in the PR as submitted): every chassisType, the OS fallback, the suggestions, creating the missing types, company scope, and never overwriting a chosen type.

What was changed on merge

  1. Company scope. The mapping offers and keeps only the types the Intune company can use - global types it has not hidden, and its own (intuneAssetTypesFor(), as the asset types list resolves them) - and applying it checks each asset's own company, so another company's private type, or a global one the asset's company has hidden, is never given.
  2. Save sends the mapping only once it has loaded, so a failed load cannot save it as empty.
  3. Suggestions are offered, not chosen. The PR pre-selected a type whose name matched a kind. Each row now shows Suggested: PortΓ‘til with a Use button; nothing is chosen for you, and nothing is saved until Save.
  4. Create keeps the choices on screen that are not saved yet, instead of reloading over them.
  5. Wording. Create the missing types became Create (the house rule: one-word buttons), with the hint explaining it and saying iOS, iPadOS and Android devices get the Other mobile device type when Intune does not know.
  6. Names. Plurals such as Phones, Smartphones and Mobile devices are recognised, and names are lower-cased multibyte-safe (mb_strtolower).
  7. save_system_settings.php normalises intune_type_map: only known kinds with positive ids are stored, anything else dropped.
  8. Tests: tests/intune-asset-type.php 29 β†’ 41 checks.
  9. Changelog ids renumbered to #2930 (the feature) and #2931 (the merge fixes); #338's row keeps Database Verification fills it in as intune.
  10. Translations of the new strings into the eight maintained languages; this write-up, the user page, the developer guide, a Feature Bingo card and vsc55's entry on the Contributors page.

Decided

  • When Intune does not know what a device is, only iOS, iPadOS and Android fall back on their operating system. A computer is never guessed (Ed, 2026-11-14).
  • A type somebody chose is never overwritten, whatever Intune says - the sync only fills an empty one (Ed, 2026-11-14).
  • Suggestions are shown with a Use button, not pre-selected - a person confirms each one (Ed, 2026-11-14).

Worth knowing

  • Create can reuse a hidden global type. When no usable type matches a kind, Create looks for a global type of the same name and, finding one, switches it back on and maps it - but if the Intune company has hidden that global type, the mapping then keeps nothing for that kind (intuneTypeMap() drops types the company cannot use). The kind shows No type again after Create. The fix is to skip a hidden match and create a new type, or unhide it for the Intune company; not done in this merge.
  • New types Create makes are global (every company sees them), because the mapping is install-wide.
  • Nothing happens until somebody maps a kind. An upgraded install behaves exactly as before until the mapping is saved.
  • Needs Database Verification for intune_devices.chassis_type; until then the kind is read from raw_json.

FreeITSM

Getting Started

Modules

Multi-tenancy (planned)

Responses to feedback

Blue sky thinking

Bugs resolved

Pull requests

Links

Clone this wiki locally