Closed Boston-of-Gilead closed 1 year ago
@Boston-of-Gilead, according to Find-MGgraphCommand
, the command to use is Remove-MgDeviceManagementManagedDevice
:
➜ Find-MGgraphCommand -Uri "https://graph.microsoft.com/v1.0/deviceManagement/managedDevices/{id}"
APIVersion: v1.0
Command Module Method URI OutputType
------- ------ ------ --- ----------
Get-MgDeviceManagementManagedDevice DeviceManagement GET /deviceManagement/managedDevices/{managedDevice-id} IMicrosoftGraphManage…
Remove-MgDeviceManagementManagedDevice DeviceManagement DELETE /deviceManagement/managedDevices/{managedDevice-id}
Update-MgDeviceManagementManagedDevice DeviceManagement PATCH /deviceManagement/managedDevices/{managedDevice-id} IMicrosoftGraphManage…
This corresponds to the API you used in Graph Explorer - https://graph.microsoft.com/v1.0/deviceManagement/managedDevices/{<same id in $devs above>}
.
Remove-MgUserManagedDevice
, which calls DELETE /users/{user-id}/managedDevices/{managedDevice-id}
, is currently listed as supported in the service schema. However, as shown in the error message (-Debug
), the service currently returns No OData route exists that match template ~/entityset/key/navigation/key with http verb DELETE for request
when calling the API.
I'll transfer the issue to the service metadata for this to be fixed by the API owner.
Please use Remove-MgDeviceManagementManagedDevice
instead.
Issue has been transferred to https://github.com/microsoftgraph/msgraph-metadata/issues/287.
@Boston-of-Gilead, according to
Find-MGgraphCommand
, the command to use isRemove-MgDeviceManagementManagedDevice
:➜ Find-MGgraphCommand -Uri "https://graph.microsoft.com/v1.0/deviceManagement/managedDevices/{id}" APIVersion: v1.0 Command Module Method URI OutputType ------- ------ ------ --- ---------- Get-MgDeviceManagementManagedDevice DeviceManagement GET /deviceManagement/managedDevices/{managedDevice-id} IMicrosoftGraphManage… Remove-MgDeviceManagementManagedDevice DeviceManagement DELETE /deviceManagement/managedDevices/{managedDevice-id} Update-MgDeviceManagementManagedDevice DeviceManagement PATCH /deviceManagement/managedDevices/{managedDevice-id} IMicrosoftGraphManage…
This corresponds to the API you used in Graph Explorer -
https://graph.microsoft.com/v1.0/deviceManagement/managedDevices/{<same id in $devs above>}
.
Remove-MgUserManagedDevice
, which callsDELETE /users/{user-id}/managedDevices/{managedDevice-id}
, is currently listed as supported in the service schema. However, as shown in the error message (-Debug
), the service currently returnsNo OData route exists that match template ~/entityset/key/navigation/key with http verb DELETE for request
when calling the API.I'll transfer the issue to the service metadata for this to be fixed by the API owner.
Please use
Remove-MgDeviceManagementManagedDevice
instead.
That works, thanks so much!
Code I'm running:
$devs produces the Id that I want:
When I run the above code with -whatif:
When I run the code without -whatif:
Text of error:
I tried this in Graph Explorer and confirmed that "DeviceManagementManagedDevices.ReadWrite.All" is the correct permission, it ran without issue over there. The url used: https://graph.microsoft.com/v1.0/deviceManagement/managedDevices/{<same id in $devs above>}