Unified Operations & Dynamics AX Forum

Expand all | Collapse all

Change of AX user domain:

  • 1.  Change of AX user domain:

    TOP CONTRIBUTOR
    Posted 7 days ago
    Hello All

    We have a change of Domain for the AX users in Dynamics AX 2012. For Example from ABC\Jsmith to XYZ\JSmith

    Should we delete ABC\JSmith and import XYZ\JSmith, which I dont think good practice as there are transactions attached

    When we are importing as XYZ\JSmith user ID appears as JSmith1

    Any suggestion

    Thanks and kind regards
    AXUG Summit - Post


  • 2.  RE: Change of AX user domain:

    Posted 5 days ago
    ​Hello Nazim,

    I did a similar task in AX4, but the fields should be the same in AX2012. Important to know is that each user has a SID of active directory AD. it is a long string like S-1-5-21-4......... I guess that each Domain has own SIDs.
    What I did was to get the SIDs of the users of the NEW Domain and put it into a new staging-table, together with the new networkalias and the user-ID (which does not change). Maybe your networkalias is the same like your old ones.

    Then I updated the userinfo-table with the data from the new staging-table via SQL. Please test it in a test-system.



    update dbo.USERINFO
    set networkdomain = c.Networkdomain_new, -- = the new network domain
     SID = c.SID_new,      -- = the GUID
     networkalias = c.networkalias_new -- = the AD-user
    -- select id, networkdomain, sid, networkalias
    from dbo.USERINFO u
    inner join schebler.dbo.userconversion c
    on u.id = c.id
    and u.networkalias = c.networkalias_old





    -- check that each networkalias is unique. the query result should get no lines
    select networkalias, count(*)
    from USERINFO
    where enable = 1
    group by networkalias
    having count(*) > 1


    Kind regards,
    Katja Schebler



    ------------------------------
    Katja Schebler
    NORMA GROUP Holding GmbH
    Maintal/Germany
    ------------------------------

    AXUG Summit - Post


  • 3.  RE: Change of AX user domain:

    SILVER CONTRIBUTOR
    Posted 5 days ago
    I have the same issue in AX 2009, we are moving domains and I have to change all users to the new domain. If you delete and import new, not only do you lose the User relationship to transactions, the users would lose favorites, saved queries, usage data ect...

    We have written a job in AX to change the domain of the user. You can modify it slightly to just do specific users by adding criteria for UserInfo.NetworkAlias.

    static void MM_ChangeUserSID(Args _args)
    {
    UserInfo UserInfo;
    str alias;
    sid userSid;
    str domainName;
    xAxaptaUserManager mgr;
    xAxaptaUserDetails det;


    ttsbegin;
    breakpoint;
    while select forupdate userInfo
    where userinfo.networkDomain == 'oldnetworkdomain'
    {
    info(userinfo.sid);



    mgr = new xAxaptaUserManager();
    alias = userInfo.NetworkAlias;
    domainName = userInfo.NetworkDomain;

    // Get the single user's details from the kernel class
    det = mgr.getDomainUser(domainName, alias);

    // If Admin alias/domain are getting changed, update SID
    if(det && det.getUserCount() > 0 && det.isUserEnabled(0))
    {
    userInfo.networkDomain = 'newnetworkdomain';
    userSid = det.getUserSid(0);
    userInfo.sid = UserSid;
    userInfo.update();
    }
    info(userinfo.sid);

    }

    ttscommit;
    }


    ------------------------------
    Randy VanDeMaat
    Micro Matic USA Inc.
    Brooksville FL
    ------------------------------

    AXUG Summit - Post


  • 4.  RE: Change of AX user domain:

    TOP CONTRIBUTOR
    Posted 4 days ago
    Test this -
    Disable user. ​Change domain reference & email (could use script for mass change).
    Re-enable user. AX will search for & apply new SID.
    Retains all user last used settings, user ids, etc.
    SharePoint might be trickier. I have notes somewhere if you need.

    ------------------------------
    Mark Prouty
    Programmer / Analyst
    ANGI Energy Systems
    Janesville WI
    ------------------------------

    AXUG Summit - Post


If you've found this thread useful, dive deeper into User Group community content by role