Intune CMDB import to SN
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
Hi everyone
I’m importing Intune managed devices into cmdb_ci_computer via a Data Source (scripted) that calls Microsoft Graph:
REST Message: Azure Intune → method device_import (GET)
Endpoint used in script: https://graph.microsoft.com/v1.0/deviceManagement/managedDevices
Auth: OAuth 2.0 (Graph) with scope https://graph.microsoft.com/.default and app permissions including DeviceManagementManagedDevices.Read.All
Headers: Accept: application/json, Content-Type: application/json
Issue
Everything loads fine (paging works, fields are populated), except:
physicalMemoryInBytes is always 0
wiredIPv4Addresses is undefined
Here’s the relevant (simplified) part of the Data Source script:
(function loadData(import_set_table) {
try {
var r = new sn_ws.RESTMessageV2('Azure Intune', 'device_import');
r.setEndpoint('https://graph.microsoft.com/v1.0/deviceManagement/managedDevices');
var response = r.execute();
var parsed = new JSONParser().parse(response.getBody());
var nextPage = parsed['@odata.nextLink'];
insertToImportTable(parsed.value);
while (nextPage && nextPage.indexOf("$skiptoken") > -1) {
var q = new sn_ws.RESTMessageV2('Azure Intune', 'device_import');
q.setEndpoint(nextPage);
var parsed1 = new JSONParser().parse(q.execute().getBody());
nextPage = parsed1['@odata.nextLink'];
insertToImportTable(parsed1.value);
}
} catch (ex) {}
function insertToImportTable(arr) {
if (!arr || !arr.length) return;
for (var i = 0; i < arr.length; i++) {
import_set_table.insert({
'u_devicename': arr[i].deviceName,
'u_operatingsystem': arr[i].operatingSystem,
'u_serialnumber': arr[i].serialNumber,
'u_physicalmemoryinbytes': arr[i].physicalMemoryInBytes,
'u_wifimacaddress': arr[i].wiFiMacAddress,
// ... many other fields ...
});
}
}
})(import_set_table);
Any guidance or best practices would be appreciated.
Thanks in advance!
Linoy
