Azure Graph API transaction

(Neusoft)龍 挙兵(Ryuu.Kixyoheyi) 121 Reputation points
2022-01-28T08:55:02.17+00:00

Hello,

I using Azure AD(free) to store user login information.
When I want change user's password in my application by application way(appID, appSecurity).
But changePassword not support application way.
So I send two graph api: first delete user, second add user.
But how can I keep the two times call all success or all failure. (in a transaction)
User user = graphServiceClient.users(id).buildRequest().get();
// first : delete the user
graphServiceClient.users(id).buildRequest().delete(user);

// second: add user
PasswordProfile passwordProfile = new PasswordProfile();
passwordProfile.forceChangePasswordNextSignIn = true;
passwordProfile.password = "Abc,123.";
user.passwordProfile = passwordProfile;
graphServiceClient.users(id).buildRequest().post(userInfo);

Best wishes.

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,389 questions
{count} votes

Accepted answer
  1. James Hamil 21,546 Reputation points Microsoft Employee
    2022-02-01T22:18:20.477+00:00

    Hi @Anonymous , your workaround method seems a bit complicated. We should try to get changePassword working for you instead. Have you made sure that you have the appropriate permissions for this?

    Directory.AccessAsUser.All  
    

    Unless you're using the unsupported types, which I assume you are? Are you just trying to change the users passwords? Have you looked into SSPR? If not, please let me know what your use case is and I can find a better solution for you.

    Best,
    James


0 additional answers

Sort by: Most helpful