Renamed AD users' accounts, now some SQL Servers can't get info

  • Ah sorry, posted answer in other forum...

    The OS reboot solved everything, the SQL service reboot changed nothing.

    -----

    Renamed 3 more accounts today.

    Last week, netguys created copies of 2 of them with newnames.

    I deleted those 2 before proceeding.

    The one that never had a newname account is perfect. SQL Server recognizes it instantly.

    The other 2, SQL Server does not recognize, and when I select the newnames from AD, the New Login window replaces the newname w/ the oldname.

    I think the problem lies somewhere the Access Control tokens? I need to know if there is some way to force an update for the newnames.

    P

  • schleep (7/13/2012)


    Ah sorry, posted answer in other forum...

    The OS reboot solved everything, the SQL service reboot changed nothing.

    Excellent, that was what I was hoping.

    Renamed 3 more accounts today.

    Last week, netguys created copies of 2 of them with newnames.

    I deleted those 2 before proceeding.

    The one that never had a newname account is perfect. SQL Server recognizes it instantly.

    The other 2, SQL Server does not recognize, and when I select the newnames from AD, the New Login window replaces the newname w/ the oldname.

    I think the problem lies somewhere the Access Control tokens? I need to know if there is some way to force an update for the newnames.

    P

    Force an update where? In SQL Server?

    The GUI may be playing games. I would try using T-SQL to create new logins.

    What is created when you run this?

    CREATE LOGIN [domain\Newname] FROM WINDOWS;

    If you already created the login using the GUI using oldname then you can try this:

    ALTER LOGIN [domain\oldname] WITH NAME = [domain\Newname];

    I just picked up this capability of ALTER LOGIN on another thread recently where it had to do with migrating users to a new domain, but it may work for you since the idea is the same. The idea being that the newname AD account has multiple SIDs associated with it since it was renamed. Prior to the rename it was named oldname and had one SID, oldSID. Then you renamed it and now it's named newname and has a new SID, newSID. But, AD is smart and it tucks oldSID into a collection on the AD object called SID History and can therefore serve auth requests for oldname/oldSID because it finds it in the SID history for newname. SQL Server may have a hold of oldSID but renaming the LOGIN per the above ALTER may work because oldSID is in the SID History of newname.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • I mentioned the login thing by way of illustrating the persistence of the oldnames.

    I don't want logins for individuals at all; they should have access by way of their group memberships.

    SQL Server is not able to resolve their newnames at all, and thus won't let them login.

    ---------------

    Are you sure a new sid is created on a rename? From MS:

    • Because it retains its security identifier (SID), a renamed user account retains all its other properties, such as its description, password, group memberships, user environment profile, account information, and any assigned permissions and rights.

    I'm wondering if the problem is the newname AD accounts that were created by copying the oldname accounts. That would generate a new sid. More from MS:

    ...Microsoft provides the ClonePrincipal API. When you create a new account, the API automatically adds the old account’s SID to the SID History attribute of the new account. The security logic that creates the user's access token then adds the content of the SID History attribute to the token. As a result, when the user logs on to the new infrastructure by using his or her new account, the access token will refer to the new SID and to the old SID. The user can then seamlessly access resources secured with the old SID hosted in the old infrastructure.

    And then when I delete the cloned newname account, and rename the oldname account, might that be where the confusion creeps in? But that doesn't completely explain why I only have problems on one server...

    If I could find a way to see the sidhisory table, I could rule this in/out.

  • schleep (7/15/2012)


    I mentioned the login thing by way of illustrating the persistence of the oldnames.

    I don't want logins for individuals at all; they should have access by way of their group memberships.

    SQL Server is not able to resolve their newnames at all, and thus won't let them login.

    ---------------

    Are you sure a new sid is created on a rename? From MS:

    • Because it retains its security identifier (SID), a renamed user account retains all its other properties, such as its description, password, group memberships, user environment profile, account information, and any assigned permissions and rights.

    URL please.

    'Retaining' may be a key definition here given the context. Retaining may imply it is kept as the current SID, but not necessarily. It may mean that a new current SID is created and the previous one is retained in SID History. I see conflicting info about this and have no way to test or check it out at the moment. My virtual home lab complete with an AD forest with domain trusts and such is still only on the drawing board 😀

    Here is one detailed account of an issue with SIDs after renaming AD accounts: SQL Active Directory User ID SID Mismapings[/url]

    The only thing I'll say about the article is that the technique at the end about scripting out perms and recreating the login with the new name may not be necessary in all cases should ALTER LOGIN WITH NAME work as advertised.

    I'm wondering if the problem is the newname AD accounts that were created by copying the oldname accounts. That would generate a new sid. More from MS:

    ...Microsoft provides the ClonePrincipal API. When you create a new account, the API automatically adds the old account’s SID to the SID History attribute of the new account. The security logic that creates the user's access token then adds the content of the SID History attribute to the token. As a result, when the user logs on to the new infrastructure by using his or her new account, the access token will refer to the new SID and to the old SID. The user can then seamlessly access resources secured with the old SID hosted in the old infrastructure.

    And then when I delete the cloned newname account, and rename the oldname account, might that be where the confusion creeps in? But that doesn't completely explain why I only have problems on one server...

    The fact that some servers function and some do not is indeed odd.

    If I could find a way to see the sidhisory table, I could rule this in/out.

    The article linked to above shows you how to see the SID of a login using PsGetSid. I have not used it, but it may report history also or lead you to another executable in the same suite that can.

    Worst case if you run out of options you may need to script out the perms for these problematic SQL Server Logins, drop them, and re-add them just to clear the slate.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • Here's a link to the MS site. That bit about retaining properties I quoted also appears elsewhere on the site.

    https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/lsm_rename_user.mspx?mfr=true

    We're going to mass-update the rest of that group tonight, bounce the server one more time, and be done with it. The 6 we've already done don't appear to be suffering any ill-effects.

    The rest of our users have never had longname accounts, and so far renaming their oldname accounts has been seamless.

    Thanks for bashing your head against that wall with me on this one. 🙂 It`s better than doing it alone.

    P

  • Heh, not sure I have been banging my head, just picking up some breadcrumbs here and there. I really need to get my virtual lab off the drawing board. Being an active observer of sorts helps me learn. Passive observers may be picking up a thing or two as well which is also important, so thanks for continuing to post. And because I have been in your shoes I can agree 100% it is nice not to go it alone 🙂

    It is still unclear as to whether the SID is retained as current or whether it is added to SID history and a new current is issued. In theory however, it should not make one bit of difference. PsGetSid may settle that issue though, if you have a few moments to try it out on an account before and after a rename.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • I will do that before and after psgestid.

    I read just enough about the messing with SIDHistory yesterday to put the fear of the almighty into me -- get it wrong and it's a "Resume-Generating Event", per Mr. McGlone:

    http://blogs.technet.com/b/ashleymcglone/archive/2011/11/23/how-to-remove-sid-history-with-powershell.aspx

    Also, don't have the ActiveDirectory module for Powershell yet, so I can't use those cmdlets.

  • That single line of PowerShell is a "resumé-generating-event". DO NOT RUN THIS LINE IN YOUR ENVIRONMENT IF YOU WANT TO KEEP YOUR JOB. Wiping SID history for every user all at once is not a best practice (in case you were wondering).

    Thanks for passing that along. not a best practice he says 😛 Monday made better.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • Well I can confirm the SIDs before and after a rename are identical.

    I think I can also say that SIDhistory is not part of the problem. I found an app, ADFind, which purports to display the SIDhistory by user. I did not see any multi-row entries -- not entirely sure I saw any entries.

    But an SIDhistory appears to be a product of domain migrations...

    Anyway, we have our workaround, and I've voluntold my colleagues that we all have to take turns bouncing servers late in the evening.

    P

  • Excellent, thanks for confirming that the SID did not change. That is useful info. So to recap, after renaming an AD account that was part of an AD group setup as a SQL Server Login some SQL Servers required a reboot before they were able to authenticate the now-updated AD account. Once the reboot was complete the AD account with the now-updated name became fully functional in the same way it was prior to the rename.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • I just came across this post as I'm having similar issues. This is on SQL 2005, but I also have an AD user account that was renamed, and the old name is still appearing in some places. However, for us it does seem to work for some applications.

    Basically any connections will use the old name (select suser_name() displays the old name), but it does connect successfully. For example, SSMS would have no trouble connecting, although a trace would show the old name being used. We do have one application that parses suser_name, and this fails because it displays the old name.

    Additionally, I've found that disabling the SQL login, having the user attempt to connect (it fails because the account is disabled), and then trying it again works. However, this only lasts until the next day.

    I'm going to try bouncing the server the next time I get a chance, but it would be great to figure out the cause of this.

  • Coming from the AD administrator's role, sounds to me like it may be SQL related. In previous posts, it's been shown that power-cycling the server fixes the issue. To verify it is a SQL issue, SHIFT-righ-click the Command icon on the SQL server, choose "Run as different user", then enter the user's logon credentials.

    Note when renaming a user account in AD, the SID does not change and the user's logon credentials do not change- only the display name. Was the logon credentials changed as well?

    SharePoint is similar in this case- I think it's V2007, it stores AD user credentials not by SID but by name. If you then rename the user, they lose access. Pretty stupid setup considering the product comes from the same company who created the OS and the AD!

  • Hi Julian,

    Our situation was a little different.

    Before we embarked on the renaming method for converting accounts, we had planned to clone the accounts -- creating new ones as copies of the old ones. We did this for a subset of our users. We then deleted the cloned accounts, and renamed the existing accounts, modifying the display name, the samaccountname, and UPN. It was these accounts that were not recognized by one of our SQL Servers.

    And it was very strange: I would go into SQL Server, Security, logins, new login, browse to their newname account in AD, click on OK, and their oldname would populate the login box, even though there was no trace of the oldname in AD.

    The user accounts that were never cloned experienced no problems whatsover, they were able to resume work immediately.

    I agree that it must be SQL related, as not all our SQL Servers behaved this way; only that one box required the reboot.

    Cheers!

    P

  • Yes, our situation was slightly different in that we just renamed an account, but it sounds like the symptoms were the same. I found, when selecting from sys.server_principals, that the user name and SID were all correct (showed new name, and SID never changed). The strange part was that the user displayed the old name in traces at first. When you add in the fact that disabling and re-enabling the account fixes it temporarily, then it does seem to be something with how SQL Server is retaining that information. However, it's possible the OS SQL is running on has a part in passing this old information.

    I rebooted our server last night, and I should find out soon if it's fixed, so hopefully I can add one to the "reboot fixes it" column. It'll still bother me not knowing what the root cause of this is though...

  • I should have mentioned again that our users are in AD groups, and it's the groups that have logins.

    And again, not all members within the same group experienced difficulties, only those whose accounts had been cloned to newname, that cloned account then deleted, then the oldname account renamed to newname.

    This suggests to me that SQL Server was caching something somewhere...

Viewing 15 posts - 16 through 30 (of 33 total)

You must be logged in to reply to this topic. Login to reply