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.