We got the new requirement to update the extension attribute on Azure AD devices.
Initially we thought that we will update the extension attribute on onpremise and thru AzureAD connect
it will replicate back to AzureAD but our assumption was wrong as extension attributes do not replicate for devices,
it replicates for user objects.
Here is the reference article:
Next problem is how to update the extension attribute directly in the cloud.
You can use Microsoft Graph SDK, I am sharing some lessons learned here; I will also share the script in future.
Lesson Number 1
DeviceID in AzureAD is same as ObjectGUID of the Computer object in Onpremise Active Directory.
Lesson Number 2
Get-MgDevice -DeviceId deviceid command will not work, instead use below command.
Get-MgDevice -Filter “DeviceId eq ‘deviceid'”
Lesson Number 3
Update-MgDevice -DeviceId deviceid command will not work, instead use id i.e. object ID instead of deviceid.
Update-MgDevice -DeviceId id
Previous lesson from another blog à
Office 365 License Report by Email V2 | Tech Wizard but sharing it here again
Get-MgDevice -All will not work with powershell 5.1, if you have large number of objects in your tenant.
You need to use powershell core v7.
I hope these all points will save you lot of time when you are designing the similar solution.
Thanks for reading ….