An API that connects multiple Microsoft services, enabling data access and automation across platforms
Microsoft Graph API - Error on device wipe via PowerShell
I want to be able to wipe devices via the Microsoft Graph API PowerShell SDK. I delegated the permission required (according to learn.microsoft) to an App Registration. I connected to the API via that app using the following command:
Connect-MgGraph -ClientId $ClientID -TenantId $TenantID -Certificate $Cert
This works well. What doesn't is the wipe device command. According to the docs, the command should be Clear-MgDeviceManagementManagedDevice -ManagedDeviceId {My Device ID}.
Before running the wipe device command I wanted to test the API. So I traid calling the command: Invoke-MgDownDeviceManagementManagedDeviceShut -ManagedDeviceId.
When I run this I get the following error:
Welcome To Microsoft Graph!
Invoke-MgDownDeviceManagementManagedDeviceShut_Down1:
C:\Users\Xishie\Documents\graph-tmp\msgraphtest.ps1:21:1
Line |
21 | Invoke-MgDownDeviceManagementManagedDeviceShut -ManagedDeviceId "b999 …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| { "_version": 3, "Message": "An error has occurred - Operation ID (for customer support): 00000000-0000-0000-0000-000000000000 - Activity ID:
| afc33d8c-ad8a-40a5-a878-fc3c1299ebc1 - Url:
| https://fef.msub01.manage.microsoft.com/DeviceFE/StatelessDeviceFEService/deviceManagement/managedDevices('{MyDeviceID}')/microsoft.management.services.api.shutDown?api-version=2022-07-29", "CustomApiErrorPhrase": "", "RetryAfter": null, "ErrorSourceService": "", "HttpHeaders": "{}" }
I get the same error from running the Clear-MgDevice command. I don't how to continue from here, the error is not really helpful and I'm lost. I would appreciate any help.
Thanks,
Xishie