Add/Update authentication/phoneMethods is not working through Graph API

Ganesh Jagdale 71 Reputation points
2022-04-27T08:07:15.993+00:00

Hi MS team,
As updating authentication/phonemethods for MFA is not avaialbe in MS graph 1.0 so I am trying to beta api.
According document https://learn.microsoft.com/en-us/graph/api/authentication-post-phonemethods?view=graph-rest-beta&tabs=http, when I am calling the API with below url
https://graph.microsoft.com/**beta**/users/70ee3214-3b2f-41f9-8d35-3d64083b4771/authentication/phoneMethods/3179e48a-750b-4051-897c-87b9720928f7

with PUT , I am getting below responce
{
"error": {
"code": "badRequest",
"message": "The requested authentication method id of [3179e48a-750b-4051-897c-87b9720928f7] was not found for this user, and so it cannot be updated",
"innerError": {
"message": "The requested authentication method id of [3179e48a-750b-4051-897c-87b9720928f7] was not found for this user, and so it cannot be updated",
"date": "2022-04-27T08:04:31",
"request-id": "034e1d8b-f1ec-479f-ae51-5c0d17eb2057",
"client-request-id": "6b06369d-ca36-d13c-11ec-6952ea5f7454"
}
}
}

And with POST ,
{
"error": {
"code": "UnknownError",
"message": "{\"Message\":\"No HTTP resource was found that matches the request URI 'https://mface.windowsazure.com/odata/users('70bd3214-3b2f-41f9-8d35-3d64083b4771%40bbfb17a3-e6e2-4186-a75e-4a8197406887')/authentication/phoneMethods('3179e48a-750b-4051-897c-87b9720928f7')'.\",\"MessageDetail\":\"No type was found that matches the controller named 'users'.\"}",
"innerError": {
"date": "2022-04-27T07:59:37",
"request-id": "706f7b77-be58-4226-a288-841657dd7a86",
"client-request-id": "c910545b-0765-115c-3128-d29329f1058e"
}
}
}

Anything I am missing here to call this graph api . Please help

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

Accepted answer
  1. Bhanu Kiran 3,616 Reputation points
    2022-04-27T09:37:28.613+00:00

    Hi @Ganesh Jagdale ,

    The document you are referring to is a POST method not PUT. Therefore you are getting a badRequest error

    The endpoint used in document uses POST https://graph.microsoft.com/beta/users/{id}/authentication/phoneMethods : whereas you have added an ID at the end of phoneMethods, which is why you are getting the error as Unknown Error.

    196933-attachment-ci.png

    Hope this helps.

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

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. CarlZhao-MSFT 46,376 Reputation points
    2022-04-27T10:39:56.1+00:00

    Hi @Ganesh Jagdale

    You need to add phone authentication for your users before you can update phone numbers.

    1.Add phone authentication first, if you add phone authentication for other users, then you can't use Graph Explorer, should use postman to call api. Before that, make sure you have granted UserAuthenticationMethod.ReadWrite.All application permissions to your app. Note: If your user already has a phone number you cannot add it again.

    196928-image.png

    2.Update phone number:

    196929-image.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

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.