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»Restrict which users can logon into a Windows 10 device with Microsoft Intune
    Intune

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

    Peter KlapwijkBy Peter KlapwijkApril 11, 2020Updated:January 25, 2021283 Mins Read

    Today a short article in which I show how we can restrict which users can logon into a Azure AD joined Windows 10 device with Microsoft Intune.

    Intune or Azure Active Directory don`t provide an out-of-the-box solution for this, but with a custom Intune profile we can do the job.

    My first thought was to remove Authenticated Users from the build-in Users group with the Configuration Service Provider (CSP) policy ConfigureGroupMembership and add the Azure AD users which are allowed to sign-in to the device to the Users group.
    I was successful in removing Authenticated Users and adding the AAD users, but other users where still able to sign-in to the device.

    At that moment I realized, I already used such a solution for a Windows 10 kiosk device, which is described here. Here I restricted the logon rights to only local accounts by using CSP policy AllowLocalLogon (User Right to Sign In Locally).

    After some testing I was able to add multiple Azure AD account to the AllowLocalLogon setting, which prohibits other users from logging on into the Windows device.

    Configure the Custom Configuration profile

    To achieve the required restrictions, we use the CSP policy AllowLocalLogon. To deploy the policy setting to a Intune managed device, we need to use a 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

    Information needed to create the OMA-URI and additional information can be found on Microsoft Docs here.
    In the value field, we need to enter the accounts which we allow to sign-in to the device. Where the documentation describes the CDATA tag <![CDATA[…]]> needs to be used, this gives an error in the Intune portal (even though the policy is applied with success). You can just add the account in the value field.
    When you add multiple accounts, the accounts should be separated with &#xF000; when using the CDATA tag. When we don`t use the CDATA tag, we need to convert &#xF000; via for example this tool. The outcome (square box), can be used as a separator.

    Enter below information to the policy;
    Name: UserRights – AllowLocalLogOn
    OMA-URI: ./Device/Vendor/MSFT/Policy/Config/UserRights/AllowLocalLogOn
    Data Type: String
    Value:
    AdministratorsAzureAD\demo.user@peterklapwijk.com

    Click OK (twice) and click Create.

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

    End-user experience

    As soon as the policy is applied to the device, we can see in the MDMDiagnostics log the settings are successfully applied.

    And when a user tries to sign in to the Windows 10 device, which is not granted the User Right to Sign In Locally (AllowLocalLogOn), he is prohibited and receives this error message.
    The sign-in method you`re trying to use isn`t allowed. For more info, contact your network administrator.

    That`s it for this post, thank you for reading!

    If you`d like to read how we can create a local user account with Intune, read this post.

    Thanks to Mark Thomas for the workaround mentioned on Twitter.

    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

    Assign Deny Local Log On user right to an (Azure) AD group by using Microsoft Intune

    June 1, 2022

    Getting started with Windows Autopilot

    October 5, 2020

    Manage the local administrators group with Microsoft Intune – Azure AD joined Windows 10 devices

    April 14, 2020
    View 28 Comments

    28 Comments

    1. AustinVSCM on April 20, 2020 18:30

      I like your method – I was wondering if this could be reversed. If I wanted to restrict a group from logging into certain computers?
      I have a group of shared temp accounts, I want them to only be able to sign into certain computers. So maybe a domain wide config that “excludes” this particular group of users?? Is that possible?

      Reply
      • Peter Klapwijk on April 20, 2020 19:53

        I was not successful in adding an Azure AD group to this policy, so I have no solution for that at the moment.

        Reply
        • Helmer on May 7, 2020 15:19

          Hi Peter,

          You could try to add the AAD group to a ‘local group’ (as described here : https://inthecloud247.com/add-an-azure-ad-group-to-the-local-administrators-group-with-microsoft-intune/) and then add that local group to the policy.

          Reply
          • Peter Klapwijk on May 8, 2020 20:44

            Hi Helmer,

            I tried that. The AAD group is added to the local group, the local group is assigned the AllowLocalLogon right, but still it didn`t work.
            The member of the AAD group isn`t allowed to logon. Just as a test is also added an AAD user to the same local group and that account was allowed to logon.
            Probably something isn`t working in the nesting chain with AAD group, the members and the local right.

            Reply
            • Jon on September 28, 2022 20:23

              Hi Peter,

              I am not sure the exact value that needs to go in it says AdministratorsAzureAD\user@xyz.com. What is the question mark symbol betweek Administrators and AzureAD and can I specify this policy as user@xyz.com or how do I do this for all user? Let us say I login to the device as User1 and User3 my User1 is jon.doe@xyz.com and User3 is don.king@xyz.com.

              How would I put this value for all users? I do not want to be specific and it cannot be as it has to be generic for all users. I hope I am clear in that I asking for?

    2. Operator on April 24, 2020 10:39

      Would I have to deploy a separate policy for each machine?

      Reply
      • Peter Klapwijk on April 25, 2020 09:38

        Depends on what you want to accomplish. PLease be more specific in your question.

        Reply
    3. Guy on May 13, 2020 14:33

      Hi Peter,
      I followed your guidelines but I am unable to access with any user .
      our local admin is being renamed to something else and I replace the line Administrator to admin-temp but I cannot login with it .
      What I am missing ?

      Reply
      • Peter Klapwijk on May 13, 2020 20:18

        Hi Guy,

        I wouldn`t remove the administrators group from the setting. As your admin-temp is member of that, he should be able to logon to the device.
        If that works fine, add an user (or group) next to the administrators group and try to logon. If it doesn`t work, you`re at least able to sign-in with an administrator account and able to review the event logs.

        Reply
    4. Pablo on June 19, 2020 23:09

      I want to do a 1 to 1 configuration, that is, assign only one user to a laptop, I have 10 users and 10 laptops. I have to create a personalized profile for each user?

      Reply
      • Peter Klapwijk on June 23, 2020 11:04

        Yes. Seems no way to use some variable or only allow the primary user to sign-in.

        Reply
        • Tobias on June 22, 2022 14:58

          Do you have any solutions for this? I don’t want to create a personalized profile for each user tbh
          i can grab the user sid with a powershell script, that’s no problem. but how to automate config-profile & oma-uri settings? any ideas?

          Reply
    5. Pablo on July 2, 2020 01:13

      Hi, thanks for your response.

      that how can I do it ??? I think it can be with OMA-URI AllowLocalLogOn but I am not very clear how to do it. You can help?

      Reply
    6. Maurice on November 12, 2020 12:33

      Is there any option to perform this for an AzureAD group? Nesting does not work and I have a situation where 300 users are allowed to logon and all others not.
      The idea to add the primary user would be a perfect solution. Perhaps with an Powershell that runs on first logon?

      Reply
      • Peter Klapwijk on November 14, 2020 09:35

        I think you end up doing so with a PowerShell script to only allow the primary user to sign in. You can deploy it with Intune or use Endpoint Analytics for this.

        Reply
    7. Dan on May 17, 2021 14:25

      Since using this, The kioskuser0 account is not permitted login and the kiosk configuration doesn’t work. Please can you advise what needs to be added to allow that user to login? I’ve tried .\kioskuser0 but then i receive an error message in the oma-uri policy application.

      Reply
      • David on March 7, 2023 19:45

        I am getting the same error message. Were you able to resolve this issue? If so, can you let me know what method was used? Thank you!

        Reply
    8. ferlop84 on June 14, 2021 19:07

      Hi Peter
      Is it mandatory to add the AAD prefix before the user to have it working?
      Thanks

      Reply
      • Peter Klapwijk on June 15, 2021 20:50

        Hi,

        Yes, it is.

        Regards,

        Peter

        Reply
    9. Tobias S. on July 16, 2021 11:01

      Hello Peter,

      I have problems with the mentioned decoding. It does not recognize the  that I set in between the characters. Any idea how to fix this separator issue? I tried it in Chrome and in Edge to make sure it has nothing to do with how the Browser recognizes the character.

      Reply
    10. Dino Maglinte on February 3, 2022 17:20

      So how would you undo this profile? It looks like this method removes Administrators, Backup Operators, Guest, and Users groups from the Allow Log On Locally policy on the computer and adds in the user accounts you specify in the profile. I tried to go into the Local Security Policy and re-add those local groups, but it doesn’t find them. Once I remove this profile from the computer, I am unable to login with any user and my only option is autopilot reset.

      Reply
    11. Rigor Mortis on July 11, 2022 08:11

      Nice Post. I tried it with our environment and confirmed this works. However, I am getting the error 0x87d1fde8 even if I use the CDATA or not. Hopefully, you can help me how to resolve the reporting error. Thank you.

      Reply
    12. Remy Rouinvy on July 18, 2022 11:52

      Hi

      Do you know if this works on Windows Holographic ?
      I’ve tried but have no success at all, the policy doesn’t seem to be affected to the device on Intune..

      Reply
    13. Tony on January 12, 2023 23:17

      Your method leaves out assignments.
      We have 400 laptops and want to limit the logins to ONLY the primary user.

      So this method suggests we need 400 profiles and 400 groups containing one laptop each.

      Wow! MS really need to provide a proper solution.

      Reply
    14. Adrian Nagy on June 21, 2023 18:53

      Hi Peter,

      Thank you for this; it really helped me. But the question is, how do we reverse this? E.g., we only allow user1@aad.com to log in and block everyone else, let’s say user2@aad.com; how do we revert this to allow user2@aad.com to log in again after being blocked by this?

      Reply
    15. Juan Zapata on November 9, 2023 18:23

      Hello Peter. Can this be applied to a group as well? Meaning, allow local account to login and anybody in group “CloudAdmins” and restrict anyone else from logging in?
      Also, can the message “The sign-in method you’re using….” be customized to say something different?

      Reply
      • Devin on January 26, 2024 16:55

        I also need a way to apply this to a specific group, rather than each machine and individual user. I have 61 machines that I need to restrict login to with any account other than the ones in a specific group, and don’t want to go through and create a configuration profile for each one

        Reply
        • Suzane on May 14, 2024 15:51

          Intune has this built in now. No need to create a custom profile. https://www.petervanderwoude.nl/post/restricting-the-local-log-on-to-specific-users/ You can point to groups instead of users. Just add one user or group per line and you will be fine.

          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

    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

    Using Windows Autopilot device preparation with Windows 365 Frontline shared cloud PCs

    April 13, 2025

    Using Visual Studio with Microsoft Endpoint Privilege Management, some notes

    April 8, 2025
    follow me
    • Twitter 4.8K
    • LinkedIn 6.1K
    • YouTube
    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
    • Peter Klapwijk on Using Windows Autopilot device preparation with Windows 365 Frontline shared cloud PCs
    • John M on Using Windows Autopilot device preparation with Windows 365 Frontline shared cloud PCs
    • Christoffer Jakobsen on Connect to Azure file shares with Microsoft Entra Private Access
    • Ludo on How to block Bluetooth file transfer with Microsoft Intune
    • RCharles on Automatically configure the time zone (during Autopilot enrollment)
    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
    © 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}