Remotely Wipe an Intune-Managed Device via Microsoft Graph

Prev Next

Issue a factory-reset wipe command to a lost, stolen, or decommissioned Windows, iOS, or Android device enrolled in Intune.

Complexity: Intermediate. Impact: destructive + privileged + device-lifecycle + security-incident.

Why use this workflow

A remote wipe is one of the most powerful and destructive actions available to an Intune administrator. It returns a managed device to its factory default state, removing the OS configuration, user data, installed apps, and Intune enrollment. Use this workflow when:

  • A device has been reported lost or stolen and contains corporate data.
  • An employee has left the organization and their company-owned device must be reset before reassignment.
  • A device is being decommissioned or recycled and you need assurance that no residual data remains.
  • A device has been compromised (malware, unauthorized access) and you need to return it to a known-good state.

For BYOD scenarios where you only want to remove corporate data and leave personal content intact, use a retire action instead of wipe.

Expected outcomes

After completing this workflow you will have:

  • Located a specific managed device by name, serial number, or primary user.
  • Verified device ownership and the primary user before taking a destructive action.
  • Issued a remote wipe command through Microsoft Graph, the Intune admin center, or PowerShell.
  • Confirmed the command was accepted (HTTP 204 No Content).

The device starts the wipe on its next Intune check-in. You can monitor progress under Devices > All devices > select the device > Device actions status.

Risks and considerations

Destructive and largely irreversible

  • Data loss is permanent. Once the device checks in and starts the wipe, all local data, user profiles, and applications are destroyed. There is no undo.
  • Verify the target device. Device names can be similar (for example, DESKTOP-GORGEOUS-OPTIMAL458 and DESKTOP-GORGEOUS-OPTIMAL485). Confirm the device ID and primary user before sending the command.
  • Do not wipe BYOD devices. Wiping a personally owned device destroys the user's personal photos, apps, and data, and can create legal or HR exposure. Use retire instead.
  • keepUserData and keepEnrollmentData flags: choose deliberately. Setting both to false performs a full factory reset. Setting keepEnrollmentData: true preserves enrollment so the device can re-provision automatically.
  • BitLocker and FileVault recovery keys should be backed up before the wipe if there is any chance the device goes offline mid-wipe and needs recovery.
  • Approval and audit. Require ticket or manager approval before wiping company assets. All wipe actions are logged in the Intune audit log and Entra sign-in logs. Review them for compliance.

Required permissions

PermissionWhy it's needed
DeviceManagementManagedDevices.PrivilegedOperations.AllRequired to send the wipe, retire, reset, or remote lock action to a managed device.
DeviceManagementManagedDevices.Read.AllRequired to look up the device by name and read device properties before wiping.
Intune Administrator or Global Administrator roleRole-based access to execute privileged device actions in Intune.

Ask Dex

Paste the prompt into a Dex conversation.

Prompt for IT admins

Send a remote wipe to the Intune-managed device named {device_name}. Verify the device's primary user and ownership before executing, then confirm the wipe command was accepted.

How an end user can ask Dex

My work laptop was stolen - please wipe it so no one can access my company files.

Manual steps (admin center)

  1. Sign in to the Microsoft Intune admin center as an Intune Administrator or Global Administrator.
  2. Go to Devices > All devices.
  3. In the search bar, type the device name (for example, DESKTOP-GORGEOUS-OPTIMAL458). Click the device to open its overview.
  4. Verify the device details on the Overview page: confirm the Primary user, Serial number, Ownership (Corporate or Personal), and Last check-in.
  5. In the command bar at the top of the device page, click Wipe.
  6. In the Wipe pane, choose your options:
    • Wipe device, even if it is not connected to power or the internet: leave this cleared unless you want the wipe to start on a low-battery device.
    • Retain enrollment state and associated user account: select this if the device should re-enroll automatically after the reset.
  7. Click Wipe to confirm. You are prompted to re-authenticate for this privileged action.
  8. Monitor progress under Device actions status on the device overview. The status moves from Pending to Active to Complete.

Microsoft Graph API

The wipe action is a two-call flow: locate the device to retrieve its Intune object ID, then POST to the /wipe action endpoint.

Step 1: Look up the device by name

GET https://graph.microsoft.com/beta/deviceManagement/managedDevices?$filter=deviceName eq 'DESKTOP-GORGEOUS-OPTIMAL458'&$select=id,deviceName,userPrincipalName,operatingSystem,complianceState,serialNumber

Example response (abbreviated):

{
  "value": [
    {
      "id": "cea20c5f-54ee-44e6-9730-604c69a828f1",
      "deviceName": "DESKTOP-GORGEOUS-OPTIMAL458",
      "userPrincipalName": "AlexW@contoso.com",
      "operatingSystem": "Windows",
      "complianceState": "compliant",
      "serialNumber": "SN2766LUHTM"
    }
  ]
}

Step 2: Send the wipe action

POST https://graph.microsoft.com/beta/deviceManagement/managedDevices/{managedDeviceId}/wipe
Content-Type: application/json

{
  "keepEnrollmentData": false,
  "keepUserData": false,
  "useProtectedWipe": false,
  "macOsUnlockCode": null
}

A successful request returns 204 No Content. The command is queued and runs when the device next contacts Intune.

Payload parameters

  • keepEnrollmentData: true retains enrollment metadata so the device can re-provision without manual enrollment.
  • keepUserData: true keeps user accounts and data (Windows only, treated as a reset rather than a full wipe).
  • useProtectedWipe: true forces a protected wipe on supported hardware.
  • macOsUnlockCode: 6-digit PIN displayed on a wiped Mac for recovery (macOS only).

Check action status

GET https://graph.microsoft.com/beta/deviceManagement/managedDevices/{managedDeviceId}?$select=deviceActionResults

PowerShell

This example uses the Microsoft.Graph PowerShell SDK. It calls Graph directly with Invoke-MgGraphRequest.

1. Install and connect

# Install once
Install-Module Microsoft.Graph -Scope CurrentUser

# Connect with the required delegated scopes
Connect-MgGraph -Scopes "DeviceManagementManagedDevices.PrivilegedOperations.All","DeviceManagementManagedDevices.Read.All"

2. Find the device

$deviceName = "DESKTOP-GORGEOUS-OPTIMAL458"
$device = Get-MgBetaDeviceManagementManagedDevice -Filter "deviceName eq '$deviceName'"

if (-not $device) { throw "Device '$deviceName' not found." }
$device | Format-List deviceName,id,userPrincipalName,serialNumber,complianceState

3. Confirm and wipe

$confirm = Read-Host "Type WIPE to confirm wipe of $($device.deviceName)"
if ($confirm -ne "WIPE") { throw "Aborted." }

$body = @{
    keepEnrollmentData = $false
    keepUserData       = $false
}

Invoke-MgGraphRequest -Method POST `
    -Uri "https://graph.microsoft.com/beta/deviceManagement/managedDevices/$($device.id)/wipe" `
    -Body ($body | ConvertTo-Json)

Write-Host "Wipe command sent to $($device.deviceName)" -ForegroundColor Green

A 204 response means the command was accepted. The device performs the wipe on its next Intune check-in.