Skip to content

Latest commit

 

History

History
98 lines (74 loc) · 3.68 KB

File metadata and controls

98 lines (74 loc) · 3.68 KB
title Delete agentUser
description Delete an agentUser object.
author yyuank
ms.reviewer iamut
ms.date 11/11/2025
ms.localizationpriority medium
ms.subservice entra-agent-id
doc_type apiPageType

Delete agentUser

Namespace: microsoft.graph

[!INCLUDE beta-disclaimer]

Delete an agentUser object.

Permissions

Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.

Permission type Least privileged permission Higher privileged permissions
Delegated (work or school account) AgentIdUser.ReadWrite.IdentityParentedBy AgentIdUser.ReadWrite.All, User.DeleteRestore.All, User.ReadWrite.All
Delegated (personal Microsoft account) Not supported. Not supported.
Application AgentIdUser.ReadWrite.IdentityParentedBy AgentIdUser.ReadWrite.All, User.DeleteRestore.All, User.ReadWrite.All

Important

The calling user must be assigned at least one of the following Microsoft Entra roles:

  • User Administrator
  • Privileged Authentication Administrator
  • Agent ID Administrator

To delete users with privileged administrator roles in delegated scenarios, the app must be assigned the Directory.AccessAsUser.All delegated permission, and the calling user must have a higher privileged administrator role as indicated in Who can perform sensitive actions.

In app-only scenarios, the User.ReadWrite.All application permission isn't enough privilege to delete users with privileged administrative roles. The agent must be assigned a higher privileged administrator role as indicated in Who can perform sensitive actions.

HTTP request

DELETE /users/microsoft.graph.agentUser/{userId}

Note: An agent user can be deleted through the standard users' endpoint as well: DELETE /users/userId. No special odata type needs to be specified in the request.

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.

Request body

Don't supply a request body for this method.

Response

If successful, this method returns a 204 No Content response code.

Examples

Request

The following example shows a request.

DELETE https://graph.microsoft.com/beta/users/microsoft.graph.agentUser/ba9a3254-9f18-4209-aeb3-9e42a35b5be4 

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]


Response

The following example shows the response.

HTTP/1.1 204 No Content