Forum Discussion

josvds's avatar
josvds
Brass Contributor
Dec 28, 2021

Local administrator priviliges not working after adding security group to local admin group

We have a couple of notebooks and added both of them to a Azure tenant. They are both belonging to a group which has a policy configured to set "RestrictedGroups – ConfigureGroupMembership" (like in https://www.inthecloud247.com/add-an-azure-ad-group-to-the-local-administrators-group-with-microsoft-intune/).

 

We are expierencing a strange problem, because I have registerd one device and a colleage antoher laptop with his account. I registered my laptop before configuring this policy and he did it after configuring this policy.

 

Now he can logon to both laptops and use "Run as Administrator". But for me I can only use "Run as Administrator" on his device (I logged on the first time there after the policy has set) but on my device its not receiving the "Administrator" role, while my colleague is inside the same group and he is "Administrator" on my device.

 

Is there some caching or something we have to refresh/update?

  • josvds's avatar
    josvds
    Brass Contributor
    After removing my profile from Windows and login again, I did get the administrator priviliges.. We still would like to know how to fix this without removing the profile, because when promoting a existing user to Admin, we don't want to remove the entire profile.
    • 🙂 Good afternoon.. Normally I am expecting the question reversed... How to make sure my end user doesnt get local admin privileges.

      But looking back at your question, it was fixed after removing the user profile (and deleting the registry hive for that user?)

      Wouldnt it be better to use the local users and groups option?

      https://docs.microsoft.com/en-us/windows/client-management/mdm/policy-csp-localusersandgroups
      Like I am also describing in this blog

      https://call4cloud.nl/2021/04/dude-wheres-my-admin/

      Also there are better option available to elevate yourself to admin, when needed.. Like i am also mentioning in the blog above.
      • josvds's avatar
        josvds
        Brass Contributor
        Thanks Rudy for your feedback. We are working in a big tenant which contains multiple organizations. We manage a couple of organizations within this tenant and would like to set a resetricted group of users who can execute local-admin applications.

        So we have created a "localadmin" security group in Azure. We have created a profile which uses the settings you wrote in "Restricted Groups" to only allow this group to be able to run local admin functions.

        This is working pretty well, but we noticed that after setting this. The user who was already logged on to the system, didn't get the access, while new users logging on to the device are getting local admin priviliges (when they are part of the group).

        After removing my user profile from the device and login again, I gained administrator priviliges. So looked to be some caching or something. So because it can happen more often that a employee is becoming IT contact and involves to local-admin for a group of devices. We don't want to delete his profile to make sure he becomes admin on his local device.

        So what could cause this and is there a way to enforce a refresh of detection for "local admin" priviliges?
  • BrettR20's avatar
    BrettR20
    Brass Contributor

    For those that stumble across this in the future, I had the same issue. Was using PIM with a customer, elevated to "Microsoft Entra Joined Device Local Administrator" but the device wasn't picking this up, even after an hour.

     

    I then found this:

    https://www.jeffgilb.com/managing-local-administrators-with-azure-ad-and-intune/

     

    Particularly this section:

    "If the account had previously logged into the device when you assign device administrator permissions, the account won’t be an admin until a new Azure AD primary refresh token is issued—AND when the user logs off and back on to get the new token. This could take up to four hours, but in my testing it never took that long."

     

    Following that link took me here:

    https://learn.microsoft.com/en-us/entra/identity/devices/concept-primary-refresh-token

     

    The Primary Refresh Token needed to be refreshed. There aren't any fantastic ways to do it, but that page says changing the login password and logging in again will refresh it. So I changed my password in M365, logged out and back into Windows 11 with the new password, and bingo – local admin.

    If I waited 4 hours for the refresh, probably would have been fine, but I didn't have 4 hours to wait. Not an ideal solution, but it may help others.

Resources