Azure AD Change Password with patch call

757 views Asked by At

I'm currently developing a web app in C#. I'm using Azure AD to store the user infomation, so I would like to be able to change the password at some point if the user wishes to do so.

Currently the way I'm changing the password is by using a http-patch call to https://graph.windows.net/{tenentId}/users/{userkey}?api-version=1.5 with a json looking like this:

{
   "passwordProfile":
   {
      "password":"Test!23456",
      "forceChangePasswordNextLogin" : false
   }
}

Last week this worked just fine. But when I tried today it didnt work. Any ideas?

1

There are 1 answers

0
Alexander Steen On BEST ANSWER

I found the error. I was using user_id as UPN and you cant use a password that have the UPN in it. So I changed the way I made the UPN and it works like a charm!