Service Graph Connector for Microsoft Intune - Retrieving Mac Addresses
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2023 09:46 AM - edited 11-21-2023 07:58 AM
Hi, this is not a question but an answer to a problem that I experienced when working in the "Service Graph Connector for Microsoft Intune" plugin. I don’t have the ability to post articles but in the event anyone else ran into this issue, I wanted to provide a solution.
I’m not sure if anyone else has run into this, but the out-of-box “computer” action for this plugin which pulls in the list of attributes for Intune Computers does not work for pulling in Mac Addresses.
When loading in test records for the import, I observed that the ethernetMacAddress attribute was not being populated for records.
In the Intune Admin Center in our environment, however, the field is populated for Computer records.
Without going down too much of the rabbit hole, I discovered that the issue was indeed with the API itself. Here are the PowerShell steps I took to determine this. (The Graph Explorer API was also useful: https://developer.microsoft.com/en-us/graph/graph-explorer)
1) In Powershell, I ran the following command:
Install-Module -Name Microsoft.Graph.Intune
2) To connect to our Intune Instance I used the below command. Which of course prompts for credentials. It is best if you have an account with admin/read access to Intune devices and properties, of course.
Connect-MSGraph
3) To get the attributes of a device I used the following command:
Get-IntuneManagedDevice -filter "deviceName eq '{deviceName}'" | GET-MSGraphAllPages
As you can see, no value is returned for ethernetMacAddress.
Eventually, I read through the Microsoft Graph API documentation at https://learn.microsoft.com/en-us/graph/api/resources/intune-devices-manageddevice?view=graph-rest-1... and noticed the following:
I believe this explains why the ethernetMacAddress attribute/field values for each record is not populated during the Intune import. It appears to be an inherent limitation of the API, one which the ServiceNow plugin does not account for (please correct me if I am mistaken).
Here is the solution I implemented. There may be a more optimal way to perform this, but this has worked for us:
1) Created a custom action with the Intune connectionalias and Intune Device ID as inputs. Initially, we were not populating the Intune Device ID on computer records, but decided to do so as part of the import as a read only field so we can pass it back to Intune to retrieve Mac Addresses for devices.
2) Created a REST step that selects the ethernetMacAddress value of a single Intune Device passed.
Get command: https://graph.microsoft.com/beta/deviceManagement/manageddevices('$DeviceID')?`$select=ethernetMacAddress
3) I have a Flow that executes after the Intune Import is completed that then checks for devices updated by Intune and updates their Mac Addresses accordingly using the above custom action. I will not show the Script step but it adds colons in the Mac Address as we need it to be a specific syntax. The GET request only returns it as a string of alphabetic and numeric values. But the same goes for the managedDevice entity for the wiFiMacAddress attribute.
If I have provided incorrect information, please correct me if I am wrong. I do not see anything in the Intune plugin that addresses the above limitation, however. I may be missing something as I have not seen anyone else post about this. It would surprise me if I am the first. In the event that others have run into this and simply not posted, however, I hope this saves you some time. And if it is an issue that everyone experiences, perhaps this can be addressed in an update by whoever maintains the "Service Graph Connector for Microsoft Intune" plugin.
- 5,597 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thursday
Not sure if the ethernetMacAddress is still an issue now but I've noticed something similar with the Get managedDevice - Microsoft Graph beta | Microsoft Learn in the documentation it says that this will return the osBuildNumber but as you mentioned above it always come back as null.
We raised a ticket with Microsoft (because this is an issue with their API) and they basically said "to bad so sad" which is not great and had to setup something similar to what you have.
It's quite crazy that this is an issue though and also from a licensing perspective being charged per call, having to send a call for each individual device is ridiculous.
