Close Menu
Peter Klapwijk – In The Cloud 24-7Peter Klapwijk – In The Cloud 24-7
    Facebook X (Twitter) Instagram
    Peter Klapwijk – In The Cloud 24-7Peter Klapwijk – In The Cloud 24-7
    • Home
    • Intune
    • Windows
      • Modern Workplace
    • macOS
    • Android
    • iOS
    • Automation
      • Logic Apps
      • Intune Monitoring
      • GitHub
    • Security
      • Passwordless
      • Security
    • Speaking
    • About me
    Peter Klapwijk – In The Cloud 24-7Peter Klapwijk – In The Cloud 24-7
    Home»Intune»Add an Azure AD group to the local administrators group with Microsoft Intune
    Intune

    Add an Azure AD group to the local administrators group with Microsoft Intune

    Peter KlapwijkBy Peter KlapwijkApril 18, 2020Updated:October 18, 2020354 Mins Read

    This is a follow-up post on the post about managing the local administrators group – Azure AD joined devices. In that post I already showed how the local administrators group on a Windows 10 machine can be managed with Microsoft Intune (Microsoft Endpoint Manager), but I only showed how to add Azure AD user accounts to the administrators group.

    But as described on Microsoft docs, also Azure AD Groups are supported;

    The member SID can be an user account or a group in AD, Azure AD, or on the local machine.

    Even tough this Configuration Services Provider (CSP) policy is added in Windows 10 1809, I wasn`t able to get this to work with an AAD group during my previous tests (on Windows 10 1909). But as Microsoft is near the release of Windows 10 2004, I gave that OS version a try, and with succes!

    I was able to add an Azure AD group to the local administrators group of an AAD joined device, using the SID.

    This a welcome additional option on managing the local administrators group, as it simplifies managing members of the local administrators group.

    In this post I show how to add an Azure Active Directory group to the local administrators group.

    Some notes to take into account; this policy overwrites the default members of the Administrators group. By default the Global Administrator and Device Administrator (roles) are member of the local Administrators group. If you only want to add a group to the Administrators group and not want to remove the default groups, don`t forget to add the Global Administrator and Device Administrator to your policy. And add the local Administrator account to the policy, otherwise it fails.
    As these roles are added to the local Administrator group by SID, take note of these before you overwrite these.

    Get the SID of an Azure Active Directory group

    The first thing we need to have is the SID of the Azure Active Directory group. This can be done via Graph API/ Explorer or by running a PowerShell command which I found on this site.

    By using the Grap Explorer it`s very easy to find the Security identifier.
    Query the group using the Object ID and it shows the SID.

    An alternative which I actually used at first, when I wasn`t aware of the SID in Graph, was running below PowerShell command.
    It converts the object ID (in the case of the AAD group) to a SID.
    First connect to Azure AD using PowerShell:
    Connect-AZureAD

    After that run below command:

    function Convert-ObjectIdToSid
    {
        param([String] $ObjectId)
    
        $d=[UInt32[]]::new(4);[Buffer]::BlockCopy([Guid]::Parse($ObjectId).ToByteArray(),0,$d,0,16);"S-1-12-1-$d".Replace(' ','-')
    }

    Next run the conversion command. In this example I query all Azure AD groups from which the name starts with local.

    Get-AzureADGroup -SearchString "Local" | ForEach { [pscustomobject] @{ Name= $_.DisplayName; Sid=Convert-ObjectIdToSid($_.ObjectId)}}

    Note the SID of the group which you want to add to the local administrators group. In my case it`s the SID of the group Local_Admins_AAD.

    Configure the Custom Configuration profile

    • Sign-in to the Endpoint Manager admin center
    • Browse to Devices – Windows
    • On the Configurations profiles tab click + Create profile
    • Choose Windows 10 and later as Platform
    • Choose Custom as Profile type
    • Click Create
    • Give the configuration profile a Name
    • Enter a Description (optional)
    • Click the Settings tab
    • Click Add

    In the value field we set which group membership we like to manage and define the group members.
    <accessgroup desc> contains the local group SID or group name.
    <member name> contains the group members to add to the local group.

    In the example, I add the default members of the group to the policy; the local Administrator account, the Global Administrator and Device Administrator (with the SID). And I add the SID of my AAD group Local_Admins_AAD.

    Enter below information to the Row;
    Name: RestrictedGroups – ConfigureGroupMembership
    OMA-URI: ./Device/Vendor/MSFT/Policy/Config/RestrictedGroups/ConfigureGroupMembership
    Data Type: String
    Value:

    <groupmembership>
    	<accessgroup desc = "Administrators">
    		<member name = "Administrator" />
    		<member name = "S-1-12-1-2934938113-1096209395-2588194479-178906382" />
    		<member name = "S-1-12-1-766653809-1274192161-2093628596-1982031183" />
    		<member name = "S-1-12-1-3293531080-1078674397-111521436-3834162110" />
    	</accessgroup>
    </groupmembership>

    Click OK (twice) and click Create.

    Assign the profile to a security group and your ready for testing.

    The end result

    The end result is the default members are still member of the local Administrators group. Besides these accounts and SID, we now also see the extra SID of the Azure AD group. This provides the members of the AAD group local administrator rights.

    That`s it for this blog post. Thank you for reading!

    Starting with Windows 10 build 20H2 we also have a new setting LocalUsersAndGroups.

    AAD Azure AD Intune MEM Microsoft Endpoint Manager Security Windows 10
    Share. Facebook Twitter LinkedIn Email WhatsApp
    Peter Klapwijk
    • Website
    • X (Twitter)
    • LinkedIn

    Peter is a Security (Intune) MVP since 2020 and is working as Modern Workplace Engineer at Wortell in The Netherlands. He has more than 15 years of experience in IT, with a strong focus on Microsoft technologies like Microsoft Intune, Windows, and (low-code) automation.

    Related Posts

    Add a certificate to the Trusted Publishers with Intune without reporting errors

    May 31, 2022

    Manage the local administrators group with Microsoft Intune – Hybrid AAD joined Windows 10 devices

    April 13, 2020

    Create a local user account on Windows 10 with Microsoft Intune

    April 12, 2020
    View 35 Comments

    35 Comments

    1. Intune on April 20, 2020 15:22

      Hi, thx for this post. You wrote this is only for 2004. But which build? I tested it on 19041.207 without luck. Should it work there?

      Reply
      • Peter Klapwijk on April 20, 2020 15:36

        I can`t say what is officially supported, as there is no official documentation yet.
        My devices all run 10.0.19041.207 at this moment.

        Regards,

        Peter

        Reply
        • Intune on April 20, 2020 16:18

          strange, it isn’t working on my w10 machine with 10.0.19041.207. I have only applied the “Administrator” and the SID of my Local_Admin Group but not the Global Admin and Device Administrator but this should be no problem right?

          Reply
          • Peter Klapwijk on April 20, 2020 17:23

            Have not tested that setup yet. Will give it a try later, but assume that should also work.

            What I have seen is that sometimes if you sign in with an account which is member of the applied group for the first time, the administrator rights are not active. The second time you sign-in, it does work.

            Reply
            • Peter Klapwijk on April 20, 2020 18:43

              I removed the SIDs from the Global Admin and Device admin roles, everything still works fine in my tenant.

    2. Robert Folkers on April 23, 2020 13:36

      Great post Peter.
      I tried this setting on a fresh 10.0.19041.207 build and the policy sort of works.
      The Administrator group will be modified as of my policy, where I, besides the extra group, added Administrator, the Device Administrator role’s SID and the Global Administrator Role’s SID.

      The thing is, after the policy is applied, none of the users are local admin anymore, not the device admins, not the global admins and also not the users in the extra group, so I’m really curious why this does work in your setup and not in mine.

      Reply
      • Robert Folkers on April 23, 2020 14:48

        I just tried this again, but instead of using the Groupname “Administrators”, I used group SID of the “Administrators” group, since that SID is always the same: S-1-5-32-544

        Now al the users of this group have local admin permissions. ?

        Reply
        • Peter Klapwijk on April 23, 2020 19:39

          Great job Robert!
          Thanks for letting know how you have configured this, helpful for other readers.

          Reply
      • Simon on February 3, 2022 22:59

        I had several issues with this approach and prefer performing through script or proactive remediation tasks instead as have more control.

        $aadObjectID = “939e62da-dc86-4da7-af38-bc31feedc046” # AAD Group Object ID to assign

        function Convert-AzureADObjectIDToSID(){
        param([string]$objectid)
        $bytes = [Guid]::Parse($objectid).ToByteArray()
        $array = New-Object ‘UInt32[]’ 4
        [Buffer]::BlockCopy($bytes, 0, $array,0,16)
        $sid = “S-1-12-1-$array”.replace(” “, “-“)
        return $sid
        }

        $group = [ADSI]”WinNT://./Administrators,group”
        $SID = Convert-AzureADObjectIDToSID -objectid $aadObjectID
        $ismember = “False”
        @($group.Invoke(“Members”)) | ForEach-Object {
        If ($SID -match $_.GetType.Invoke().InvokeMember(“Name”, ‘GetProperty’, $null, $_, $null)) {
        $ismember = “True”
        }
        }
        If ($ismember -ne “True”) {
        $result = $group.Add(“AzureAD://$SID,group”)
        }

        Reply
        • Gustavo on May 9, 2024 22:04

          I was able to add the group to the local group, but in practice, that doesn’t work.
          I created a local group, added the Azure group as member of that, and added the local group with an ACL into a folder test. The members of the Azure groups doesn’t have access to it.

          Does it need to be installed any kind of client on Windows to allow it to get the SIDs from Azure?

          Reply
    3. Sujithkumar on July 2, 2020 15:03

      Thanks for creating such valuable post for In tune Admins, I tried this in our production, I created device configuration policies as stated in this post and pushed it to a device group contains only two devices, the policy got applied on one device and when i added a new user to the Ad Group that I added and tried to open cmd as admin unfortunately it failed saying requires elevation.

      Reply
      • Peter Klapwijk on July 5, 2020 13:50

        The policy is applied, you can see in the local group the correct SID is added as a member of the group? Restarted the device after adding the new group member?

        Reply
    4. Sujithkumar on July 5, 2020 14:08

      I actually assigned this policy for only for devices, one of the device received profile and i am able to see the groups in the local administrators group but when I try to do admin activity with one of the user who is a member of the Azure AD Group which got added in the policy.

      on another device, it doesn’t show up in the local administrators group itself.

      As suggested by you, i tried restarting the devices twice and even I did a manual sync both from the device and from the Intune portal but no luck.

      Reply
      • Peter Klapwijk on July 5, 2020 14:16

        And all these devices are running Windows 10 2004? Members of the AAD group are AAD accounts?
        If that`s the case, everything is in-place. I cannot think at something which causes this at the moment.

        Reply
    5. Sujithkumar on July 5, 2020 14:27

      Thanks for your reply!

      I think I have to update the Win Ver to 2004, the two devices are currently having 1909. I think the root cause of the issue would be the incorrect version. let me try to update both the devices to 2004 and then I will let you know.

      Reply
      • Peter Klapwijk on July 5, 2020 16:20

        Yes, it`s (at this moment) only supported on 2004. 1909 will not work with adding groups.

        Reply
    6. Pieter P. on July 14, 2020 16:01

      Hello Peter, thx for the great post. It was quite helpful. Just want to share that I used an alternative way to add the group to the local administrators. I run a simple powershell-script Add-LocalGroupMember -Group Administrators -Member S-.. For my situation this is beter because it preserves whatever already is in the administrator-group.

      Reply
    7. sanch on August 19, 2020 14:43

      Hi, thanks for your great work !

      Seems not working in 2004 build 19041.450. The SID group has been added to the local admin group by the policy but the user part of this AAD Group still doesn’t have admin rights after 3 reboots.

      Reply
      • Peter Klapwijk on August 19, 2020 15:36

        Hi Sanch,

        I did a quick test on a device with the exact same Windows build without any problems. Must say it is an existing device, where this was already tested before without any issues.

        Reply
        • sanch on August 19, 2020 15:59

          Hi Peter,

          Thanks for your reply. It’s working now ! I think the member of the AAD group wasn’t fully synced. Thanks again for this article!

          Reply
          • Peter Klapwijk on August 19, 2020 16:16

            Great to hear, it`s now also working for you!

            Reply
            • Avista on August 28, 2020 10:18

              Had the same issue, at first the local administrator group was showing the SID’s but it didn’t work, it takes a few hours to fully sync.

          • Marc on October 15, 2020 13:56

            Hey Sanch. I’ve exactly the same issue. Azure AD Group is part of the local admin group but users don’t have admin rights. They are not elevated. Do you know what to sync exactly? I’ve created the policy today.

            Reply
            • sanch on October 15, 2020 14:10

              Hey Marc ! As Avista also said, as you have the Azure AD Group synced, I think you are on the right way and that it will work in a few hours. Very frustrating but we have to be patient with this kind of policies 🙂 Let us know

            • Peter Klapwijk on October 18, 2020 09:45

              Hi guys,

              You also might be interested in the new policyhttps://inthecloud247.com/manage-local-users-and-groups-with-microsoft-intune/

            • sanch on October 19, 2020 16:16

              Hey Peter ! Thanks for the update I will test it between today and tomorrow for a new customer, I will let you know in the comment of the new article. GL HF to everyone !

    8. Marc on October 15, 2020 17:01

      Hey Sanch. Thank you very much for your quick response! Now 3 hours later it works. I’m very happy with that new feature! Would be very interesting what exactly needs which sync. BR Marc

      Reply
    9. Aaron on November 7, 2020 23:35

      The 3+ hour delay in the permissions being applied is due to the PRT needing to be refreshed to update your account entitlements. Once you’ve added the new group, you need to wait for your PRT to be refreshed (happens on sign-in after the token is >4 hours old) and then sign out and sign back in. This also applies to when you add and remove users from the group. So worst case scenario (from my testing) is that when you add someone to a new group they need to wait 4 hours until thier PRT can be refreshed and then sign out and sign in twice. Not great for more complex use cases.

      Reply
    10. Donovan Sobrero on April 7, 2021 21:12

      Does this overwrite if there is other users part of the local administrator already? how can I append without change what’s in the group already. and if I wanted to remove just one of the users in the group is that possible?

      Reply
      • Peter Klapwijk on April 7, 2021 21:42

        Donovan, have a look at the settings described in this article https://inthecloud247.com/manage-local-users-and-groups-with-microsoft-intune/. You can define a group action, in your case use Update.

        Regards,

        Peter

        Reply
    11. Mangesh D on May 25, 2021 20:34

      Hello, I have 2004 and 1909 devices. After applying the policy, AzureAD group SID gets added to ‘Remote Desktop Users’ group in both version devices.
      However, the member of AzureAD group is able to access RDP for only 2004 version, it does not work for 1909 version.

      When I use same policy to add AzureAD users to ‘Remote Desktop users’ group in 1909, it works correctly.
      Policy does work in 1909, but only for AzureAD users and not for AzureAD group.

      Is there a way to get policy worked for AzureAD group in 1909 version? Our environment has dependency for 1909 that prevent us upgrading to 2004 version.

      Reply
    12. sebus on May 27, 2021 13:03

      Never ever managed to get this working. Policy created/assigned/synced, shows Succeeded in Device config, but no members are added to the group (Administrators)
      That is just for users, NOT groups

      Reply
      • Peter Klapwijk on June 15, 2021 21:24

        Starting Windows 10 2004 it does work for groups.
        But the recommended setting to use from Windows 10 20H2 and later is LocalUsersAndGroups
        https://inthecloud247.com/manage-local-users-and-groups-with-microsoft-intune/

        Reply
    13. Bogdan on September 14, 2021 14:59

      I have added a group to Remote Desktop Users through this process and I can see the SID being added to the local Remote Desktop Users, but the RDP connection returns an error: The connection was denied because the user account is not authorized for remote login.

      If I add my user account to the Remote Desktop Users group then I can use RDP.

      Reply
      • Wichur on October 9, 2023 15:51

        Were you able finally to use AAD Group in Remote Desktop Users group ?
        Or it never worked out ?

        Reply
    Leave A Reply Cancel Reply

    Peter Klapwijk

    Hi! Welcome to my blog post.
    I hope you enjoy reading my articles.

    Hit the About Me button to get in contact with me or leave a comment.

    Awards
    Sponsor
    Latest Posts

    Create deployment ring groups for Microsoft Intune

    June 27, 2025

    Update Windows Defender during Windows Autopilot enrollments

    May 16, 2025

    Hide the “Turn on an ad privacy feature” pop-up in Chrome with Microsoft Intune

    April 19, 2025

    How to set Google as default search provider with Microsoft Intune

    April 18, 2025
    follow me
    • Twitter 4.8K
    • LinkedIn 6.1K
    • YouTube
    • Bluesky 1.5K
    Tags
    Administrative Templates Android Automation Autopilot Azure Azure AD Browser Conditional Access Edge EMS Exchange Online Feitian FIDO2 Flow Google Chrome Graph Graph API Identity Management Intune Intune Monitoring iOS KIOSK Logic Apps macOS MEM MEMMonitoring Microsoft 365 Microsoft Edge Microsoft Endpoint Manager Modern Workplace Office 365 OneDrive for Business Outlook Passwordless PowerApps Power Automate Security SharePoint Online Teams Windows Windows 10 Windows10 Windows 11 Windows Autopilot Windows Update
    Copy right

    This information is provided “AS IS” with no warranties, confers no rights and is not supported by the authors, or In The Cloud 24-7.

     

    Copyright © 2025 by In The Cloud 24-7/ Peter Klapwijk. All rights reserved, No part of the information on this web site may be reproduced or posted in any form or by any means without the prior written permission of the publisher.

    Shorthand; Don’t pass off my work as yours, it’s not nice.

    Recent Comments
    • Parth Savjadiya on Using Visual Studio with Microsoft Endpoint Privilege Management, some notes
    • Chris Johnson on Assign Deny Local Log On user right to an (Azure) AD group by using Microsoft Intune
    • Northernsky on Automatically wipe a Windows 10 device after a number of authentication failures
    • Henrik on Intune Driver update for Windows – Get applicable devices
    • Adam on Get notified on expiring Azure App Registration client secrets
    most popular

    Application installation issues; Download pending

    October 1, 2024

    Restrict which users can logon into a Windows 10 device with Microsoft Intune

    April 11, 2020

    How to change the Windows 11 language with Intune

    November 11, 2022

    Update Microsoft Edge during Windows Autopilot enrollments

    July 9, 2024
    Peter Klapwijk – In The Cloud 24-7
    X (Twitter) LinkedIn YouTube RSS Bluesky
    © 2025 ThemeSphere. Designed by ThemeSphere.

    Type above and press Enter to search. Press Esc to cancel.

    Manage Cookie Consent
    To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
    Functional Always active
    The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
    Preferences
    The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
    Statistics
    The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
    Marketing
    The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
    Manage options Manage services Manage {vendor_count} vendors Read more about these purposes
    View preferences
    {title} {title} {title}