Update-MgUser Throws 405 MethodNotAllowed

Rudhin Menon 0 Reputation points
2025-02-10T02:48:06.9+00:00

Executed the following command to update user attribute:

Update-MgUser -UserId "user id here" -JobTitle "New Job Title"

The command returns the following error:

Update-MgUser_UpdateExpanded:

Status: 405 (MethodNotAllowed)

ErrorCode: UnknownError

Date: 2025-02-10T02:38:40

Headers:

Vary : Accept-Encoding

Strict-Transport-Security : max-age=31536000

request-id : 56b586fa-2808-475d-9751-d47a669f931a

client-request-id : cb4694e1-44fb-4417-97e6-b85ea939fd57

x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Canada Central","Slice":"E","Ring":"3","ScaleUnit":"000","RoleInstance":"TO1PEPF00004DFA"}}

Date : Mon, 10 Feb 2025 02:38:40 GM

User logged in in PowerShell has the following roles:

Application Administrator

Attribute Assignment Administrator 

Attribute Definition Administrator

Cloud Application Administrator

Global Administrator

User Administrator

Graph API Permissions are as follows:

CustomSecAttributeAssignment.ReadWrite.All

Directory.AccessAsUser.All

User.Read

User.ReadWrite.All

Please let me know what am I missing here. Thanks.

Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Saranya Madhu-MSFT 2,375 Reputation points Microsoft External Staff
    2025-02-10T05:23:00.7366667+00:00

    Hi Rudhin Menon,

    Thanks for reaching out to Microsoft!

    405 Error indicates that the HTTP method in the request isn't allowed on the resource.

    As mentioned in the document, if you are using personal Microsoft account then the account must be tied to a Microsoft Entra tenant to update your profile with the User.ReadWrite delegated permission on a personal Microsoft account.

    Also test the API in postman application by using your personal Microsoft account credentials.

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.