編輯

共用方式為


user: changePassword

Namespace: microsoft.graph

Update the signed-in user's password. Any user can update their password without belonging to any administrator role.

This API is available in the following national cloud deployments.

Global service US Government L4 US Government L5 (DOD) China operated by 21Vianet

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 permissions Higher privileged permissions
Delegated (work or school account) Directory.AccessAsUser.All Not available.
Delegated (personal Microsoft account) Not supported. Not supported.
Application Not supported. Not supported.

HTTP request

POST /me/changePassword

Request headers

Header Value
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Content-type application/json. Required.

Request body

In the request body, provide a JSON object with the following parameters.

Parameter Type Description
currentPassword String Your current password.
newPassword String Your new password.

Response

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

Example

The following example shows a request to update your own password.

Request

POST https://graph.microsoft.com/v1.0/me/changePassword
Content-type: application/json

{
    "currentPassword": "xWwvJ]6NMw+bWH-d",
    "newPassword": "0eM85N54wFxWwvJ]"
}

Response

HTTP/1.1 204 No Content