Change the SID / domain for a user

Basically you want to do this if you've just got a new set of databases from another site and you are locked out of AX. Just open SSMS, and run the following T-SQL.

USE MicrosoftDynamicsAX

-- DELETE FROM USERINFO WHERE ID <> 'Admin' -- do this ONLY if you want to delete the unnecessary users from the other domain

SET Name = 'YourName',
    SID = 'S-1-REPLACE',
    NetworkDomain = 'Your_Domain',
    NetworkAlias = 'Your_DomainUser'
WHERE ID = 'Admin'

How can you get very fast your SID. I prefer to do the following:
 a) open regedit.exe and navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
b) look at each key and notice the ProfileImagePath value. When that value matches your user, that is the SID you want to copy (so just copy the key you are on). Of course you need to have logged on that machine at least one time with that user in order to have a profile. (I know there are other ways to get a SID, but they all involve scripts, and wanted to keep this straightforward).


  1. I usually use another AX database and copy my SID from my user's record of table USERINFO :)

  2. Yes, that is another way to go (or you can copy your SID into a text file and store it). I like the T-SQL because it is clearly defined, and easier than telling the people what to change using the SSMS query / results editor.