Closed othyssen closed 1 year ago
I tried various ways in Graph Explorer with POST to have have an idea how New-MgDeviceManagementManagedDeviceUserByRef is working but I'm ending up with "An error has occurred" or sometimes with "Write requests are only supported on contained entities or navigation properties with bindings." Nice example of the request body much appreciated
Thanks for following up on this.
Unfortunately, this is one of those API that requires you to build a hash table with the id of the reference object to be added - New-MgDeviceManagementManagedDeviceUserByRef
. The examples should ideally be available in https://docs.microsoft.com/en-us/graph/api/intune-devices-manageddevice-update?view=graph-rest-beta#example as other workloads do, but this is currently not the case.
As for the errors you are getting, please open a question/ticket at https://developer.microsoft.com/en-us/graph/support to get help from the API owners/workload owner.
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.
The documentation new-mgdevicemanagementmanageddeviceuserbyref isn't accessible anymore which makes it difficult to select the attributes for the hash table
It looks like the workload owner removed the new-mgdevicemanagementmanageddeviceuserbyref
API from the service schema:
➜ Find-MgGraphCommand -Uri "/deviceManagement/managedDevices/{managedDevice-id}/users.*"
APIVersion: v1.0
Command Module Method URI OutputType Permissions Variants
------- ------ ------ --- ---------- ----------- --------
Get-MgDeviceManagementManagedDeviceUser DeviceManagement GET /deviceManagement/managedDevices/{managedDevice-id}/users IMicrosoftGraphUser {} {List}
APIVersion: beta
Command Module Method URI OutputType Permissions Variants
------- ------ ------ --- ---------- ----------- --------
Get-MgDeviceManagementManagedDeviceUser DeviceManagement GET /deviceManagement/managedDevices/{managedDevice-id}/users IMicrosoftGraphUser1 {} {List1}
Please open a question/ticket at https://developer.microsoft.com/en-us/graph/support to get help from the API owner as this is an service related question.
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.
Microsoft.Graph.Devicemanagement Version 1.10.0
While Get-MgDeviceManagementManagedDeviceUser is working like a charm to retrieve the Primary User of an Intune device, there should be a simple command available to update the primary user, like
Update-MgDeviceManagementManagedDeviceUser -ManagedDeviceId "xxxx" -UserId "yyyyy"
as mentioned in Issue #634 there is New-MgDeviceManagementManagedDeviceUserByRef available but it requires to build a hash table within the script first.