Suddenly my application is no longer able to update phoneAuthenticationMethod when it's created on B2C.
UPDATE STEPS TO REPRODUCE ISSUE:
Enable MFA using Custom Policy starter pack from MS()
Create user in B2C and add MFA(SMS) to it using custom policy above
Get User MFA using Graph API to confirm that MFA was created
Portal:
Suddenly my application is no longer able to update phoneAuthenticationMethod when it's created on B2C.
UPDATE STEPS TO REPRODUCE ISSUE:
Enable MFA using Custom Policy starter pack from MS(https://github.com/Azure-Samples/active-directory-b2c-custom-policy-starterpack/tree/main/SocialAndLocalAccountsWithMfa)
Create user in B2C and add MFA(SMS) to it using custom policy above
Get User MFA using Graph API to confirm that MFA was created
Portal:
The error occurs if you try to update the phone method when there is no existing mobile number added to that user as authentication method.
I have one user with phone authentication method added in office phoneType as below:
When I tried to update that phone method as mobile phoneType and Id as 3179e48a-750b-4051-897c-87b9720928f7, I too got same error like this:
PATCH https://graph.microsoft.com/v1.0/users/userId/authentication/phoneMethods/3179e48a-750b-4051-897c-87b9720928f7
{
"phoneNumber": "+1 2065555554",
"phoneType": "mobile"
}
Response:
As mentioned in this MS Document,
The value of
phoneMethodIdchanges depending on phoneType you want to update:
b6332ec1-7057-4abe-9331-3d72feddfe41to update thealternateMobilephoneType.e37fc753-ff3b-4958-9484-eaa9425c82bcto update theofficephoneType.3179e48a-750b-4051-897c-87b9720928f7to update themobilephoneType.
In your case, initially fetch the list of phone methods added to user with below API call:
GET https://graph.microsoft.com/v1.0/users/userId/authentication/phoneMethods/
Response:
If mobile phoneType is not present in response, make use of POST call to add it as authentication method like below:
POST https://graph.microsoft.com/v1.0/users/userId/authentication/phoneMethods/
{
"phoneNumber": "+1 2065555554",
"phoneType": "mobile"
}
Response:
You can now update this using PATCH call as phone method of mobile phoneType is existing now:
PATCH https://graph.microsoft.com/v1.0/users/userId/authentication/phoneMethods/3179e48a-750b-4051-897c-87b9720928f7
{
"phoneNumber": "+1 2055555555",
"phoneType": "mobile"
}
Response:
To confirm that, I checked the same in Portal where phone method of mobile phoneType update successfully:

GET https://graph.microsoft.com/v1.0/users/{USERID}/authentication/phoneMethodsfirst and check what response you are getting and add it in question? – Sridevi Commented Jan 31 at 3:36