Closed CloudViking86 closed 2 years ago
I am also trying to find out how to set the primary user. While Get-MgDeviceManagementManagedDeviceUser returns the current primary user, the first guess would be to use the respective New or Update, but the documentation of those seems to point out to managing the actual user object instead of linking the user to the device.
The example referred to in the original question shows a Graph API POST to deviceManagement/managedDevices('$IntuneDeviceId')/users/`$ref
Is there any solution or workaround for setting the primary user except of course doing the API call directly?
Hello everybody :)
Using the Find-MgGraphCommand I was able to find New-MgDeviceManagementManagedDeviceUserByRef that call POST /deviceManagement/managedDevices/{managedDevice-id}/users/$ref
Can you validate whether you can set primary user?
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.
PowerShell: v.5.1 Microsoft.Graph: v.1.5.0 Schema: BETA
What I am trying to do: When enrolling a computer using a "WCD"-package (ppkg / provisioning package) and the user is scoped to be auto-enrolled into Intune then the device is listed with a "Primary User" of "NONE" in Intune since the device is enrolled by a package / bulk-enrollment.
This in turn blocks the device to receive apps / configurations etc. which are scoped to certain users since the device lacks a owner / primary user.
What I've tried:
Error:
So using the "beta"-schema I can see that "userId" is "Read-Only"; https://docs.microsoft.com/en-us/graph/api/intune-devices-manageddevice-update?view=graph-rest-beta whereas in the "v.1.0"-schema it is not; https://docs.microsoft.com/en-us/graph/api/intune-devices-manageddevice-update?view=graph-rest-1.0
If I look at this example here; https://github.com/microsoftgraph/powershell-intune-samples/blob/5a78ad3562e8ca16fdc79993ce9afb5b1830890f/ManagedDevices/Win10_PrimaryUser_Set.ps1#L346 the operation is "POST" opposed to "PATCH" so it should then according to the "legend" here; https://docs.microsoft.com/en-us/graph/powershell/navigating#command-verbs it should then be a command something like: "New-MgDeviceManagementManagedDevice" since "New" = "POST" where "Update" = "PATCH"?
But the actual graph api reference indicate "PATCH"; https://docs.microsoft.com/en-us/graph/api/intune-devices-manageddevice-update?view=graph-rest-beta https://docs.microsoft.com/en-us/graph/api/intune-devices-manageddevice-update?view=graph-rest-1.0
So TL;DR: How do I set the "Primary User" for a Intune-device using the MS.Graph-module?
Thanks! AB#9105