msgraph-sdk-powershell icon indicating copy to clipboard operation
msgraph-sdk-powershell copied to clipboard

Update-MgDeviceManagementManagedDeviceUser (Feature Request)

Open othyssen opened this issue 3 years ago • 4 comments

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.

othyssen avatar Jul 19 '22 11:07 othyssen

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

othyssen avatar Jul 19 '22 12:07 othyssen

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.

peombwa avatar Jul 25 '22 18:07 peombwa

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.

ghost avatar Jul 29 '22 19:07 ghost

The documentation new-mgdevicemanagementmanageddeviceuserbyref isn't accessible anymore which makes it difficult to select the attributes for the hash table

othyssen avatar Jul 30 '22 15:07 othyssen

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.

peombwa avatar Dec 05 '22 19:12 peombwa

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.

ghost avatar Dec 09 '22 19:12 ghost