How to update the existing User SignInName using Azure AD Graph API or Microsft Graph API?

Viewed 2972

How can I update the SignInName of an existing user in Azure AD using Microsoft Graph or Azure AD Graph Client.

Thanks!

3 Answers

Looks like it won't be possible to update SignInName through either Microsoft Graph API or Azure Graph API. It may be worth a try using PowerShell if that fits your use case (again this may or may not work). Details about each one below..

  1. Update User SignInName using Microsoft Graph API

    This isn't possible because SignInNames collection isn't even available as part of the user entity in Microsoft Graph yet.

    Here is a GitHub issue thread on this topic, look towards the end. Add signInNames property to User. #91

enter image description here

  1. Update User SignInName using Azure AD Graph API

You would be able to set the User SignInNames collection only at the time of creation of user. See the documentation mentions only POST and GET (no PATCH)

https://msdn.microsoft.com/en-us/library/azure/ad/graph/api/entity-and-complex-type-reference#user-entity

enter image description here

enter image description here

  1. Update User SignInName using PowerShell

    This may work out, but I'm not sure about it. Then again, you asked specifically for Microsoft Graph or Azure AD Graph API so your scenario may not be suited for PowerShell.

    Set-AzureADUser

enter image description here

You can PATCH the signInNames using the Azure AD Graph API (graph.windows.net) as an update.

PATCH https://graph.windows.net/{tenantId}/users/{userId}?api-version=1.6
Content-Type: application/json

BODY:
{
    "givenName": "James Wood",
    "signInNames": [
        {
            "type": "userName",
            "value": "jamesWoodUserName"
        }
    ]
}
Related