Assign local admin privileges to users on Microsoft Entra joined Windows devices using directory roles, Intune Account Protection policies, or Endpoint Privilege Management.
Complexity: Intermediate. Impact: security-sensitive + endpoint-management + privileged-access + intune + entra-id.
Why use this workflow
Users occasionally need local administrator rights on their corporate Windows devices to install developer tools (Visual Studio Code, Docker, Node.js), run legacy applications that require elevation, or troubleshoot driver issues. On Microsoft Entra joined devices, Entra ID manages the local Administrators group during the join process. Changes after that require a directory role assignment, an Intune Account Protection policy (LocalUsersAndGroups CSP), or Endpoint Privilege Management (EPM) for just-in-time elevation.
This workflow covers the three common approaches, their trade-offs, and how to choose the right one for a request. It replaces the practice of adding users to the local Administrators group directly with PowerShell on the device, which is untracked and does not survive re-imaging.
Expected outcomes
- The target user can perform administrative actions (install software, change system settings) on the designated Entra-joined devices.
- The grant is tracked centrally in Entra ID or Intune, so it is visible, auditable, and reversible.
- You have a documented justification and scope for the grant (tenant-wide, device-scoped, or just-in-time).
- The change follows least-privilege principles, with an expiration or review date where appropriate.
Risks and considerations
Security considerations
- The Microsoft Entra Joined Device Local Administrator role is tenant-wide. Assigning it grants local admin on every Entra-joined device in the tenant, not just one laptop. Do not use it as a one-off fix.
- Intune Account Protection (LocalUsersAndGroups) policies are device-scoped through group assignment. Prefer this over the directory role when you need to limit scope.
- Endpoint Privilege Management (EPM) is the preferred approach for most cases. It grants elevation for specific executables on demand rather than standing admin rights. It requires an Intune Suite or EPM add-on license.
- Permanent local admin weakens endpoint security. A compromised user account with local admin can disable Defender, install persistent malware, and extract credentials.
- Propagation is not instant. Directory role changes require the user to sign out and back in. Intune policy application depends on the next device check-in, which you can force.
- Log and review. Every local admin grant should have a ticket, a justification, and a planned expiration or periodic review.
Do not
- Do not connect to the device and add the user to the Administrators group manually. The change is invisible to Intune and Entra ID and can be overwritten by policy.
- Do not add users to the Global Administrator or Microsoft Entra Joined Device Local Administrator roles to solve a single-device problem.
Required permissions
| Permission | Why it's needed |
|---|---|
| RoleManagement.ReadWrite.Directory | Activate and assign members to the Microsoft Entra Joined Device Local Administrator directory role |
| DeviceManagementConfiguration.ReadWrite.All | Create and assign Intune Account Protection / LocalUsersAndGroups configuration policies |
| DeviceManagementManagedDevices.Read.All | Look up the target user's Intune-managed device or devices |
| User.Read.All | Resolve the target user's object ID and security identifier (SID) for policy payloads |
| Group.ReadWrite.All | Create or update the security group used to scope the Intune policy assignment |
Ask Dex
Paste the prompt into a Dex conversation.
Prompt for IT admins
Grant {user} local administrator rights on their Entra-joined device {device_name} so they can install {software}. Use a scoped Intune Account Protection policy (not the tenant-wide directory role), record the justification, and set a 90-day review date.
How an end user can ask Dex
I need to install VS Code on my work laptop but I don't have permission. Can you help?
Manual steps (admin center)
Option A: Tenant-wide, Microsoft Entra directory role
Use this when a help desk or engineering group needs admin on all corporate devices.
- Sign in to the Microsoft Entra admin center as at least a Privileged Role Administrator.
- Go to Identity > Devices > All devices > Device settings.
- Select Manage Additional local administrators on all Microsoft Entra joined devices.
- Click Add assignments, search for the target user or group, and click Add.
- Ask the user to sign out and back in to Windows so the new token (including the admin group) takes effect.
Requires Microsoft Entra ID P1 or P2.
Option B: Device-scoped, Intune Account Protection policy (preferred for single-user grants)
- Sign in to the Microsoft Intune admin center.
- Go to Endpoint security > Account protection > Create Policy.
- For Platform, select Windows 10 and later. For Profile, select Local user group membership. Click Create.
- Name the policy (for example,
Local Admins - Developers) and click Next. - Add a rule:
- Local group: Administrators
- Group and user action: Add (Update)
- User selection type: Users / Groups
- Select the Entra users or groups that should get local admin.
- Click Next, apply scope tags if you use them, then assign the policy to a security group that contains the target devices. Do not assign it to All Devices.
- Review and create. The policy applies at the next device check-in.
Option C: Just-in-time, Endpoint Privilege Management (EPM)
- Make sure the tenant has the Intune Suite or EPM add-on license assigned.
- In Intune, go to Endpoint security > Endpoint Privilege Management.
- Create an Elevation settings policy and assign it to the device group to enable the EPM client.
- Create an Elevation rules policy that allows the specific installer (for example,
VSCodeUserSetup-x64-*.exe) to run elevated, either automatically or with a user-confirmed or support-approved flow. - Publish and assign the policies. The user right-clicks the installer and selects Run with elevated access. No standing admin rights are required.
Microsoft Graph API
For the directory role approach, make sure the role is activated in the tenant. The Entra Joined Device Local Administrator role template ID is 9f06204d-73c1-4d4c-880a-6edb90606fd8.
Option A, step 1: Activate the role (one time, if not already activated)
POST https://graph.microsoft.com/v1.0/directoryRoles
Content-Type: application/json
{
"roleTemplateId": "9f06204d-73c1-4d4c-880a-6edb90606fd8"
}Option A, step 2: Look up the activated role's object ID
GET https://graph.microsoft.com/v1.0/directoryRoles?$filter=roleTemplateId eq '9f06204d-73c1-4d4c-880a-6edb90606fd8'Option A, step 3: Add the user as a member
POST https://graph.microsoft.com/v1.0/directoryRoles/{roleId}/members/$ref
Content-Type: application/json
{
"@odata.id": "https://graph.microsoft.com/v1.0/directoryObjects/{userObjectId}"
}Response: 204 No Content. The user becomes local admin on all Entra-joined devices after propagation.
Option B: Create a scoped Intune Account Protection policy
Use the configurationPolicies endpoint with the windows10 platform and the LocalUsersAndGroups settings catalog template.
POST https://graph.microsoft.com/beta/deviceManagement/configurationPolicies
Content-Type: application/json
{
"name": "Local Admins - {group_name}",
"description": "Grants local admin to {user} for dev tool installation",
"platforms": "windows10",
"technologies": "mdm",
"templateReference": {
"templateId": "22968f54-45fa-486c-848e-f8224aa69772_1"
},
"settings": [ /* LocalUsersAndGroups configure action with target SID */ ]
}Assign the policy to a device group
POST https://graph.microsoft.com/beta/deviceManagement/configurationPolicies/{policyId}/assign
{
"assignments": [{
"target": {
"@odata.type": "#microsoft.graph.groupAssignmentTarget",
"groupId": "{targetGroupId}"
}
}]
}Force a device sync so the policy applies sooner
POST https://graph.microsoft.com/beta/deviceManagement/managedDevices/{managedDeviceId}/syncDevice
PowerShell
The approach below implements Option B, the recommended scoped approach. Given a user UPN and a device name, it looks up both, makes sure a dedicated assignment group exists, adds the device to that group, and creates (or updates) an Intune Account Protection policy that adds the user to the local Administrators group on that device only.
Prerequisites
- Microsoft.Graph PowerShell SDK:
Install-Module Microsoft.Graph -Scope CurrentUser - Permissions:
DeviceManagementConfiguration.ReadWrite.All,DeviceManagementManagedDevices.Read.All,Group.ReadWrite.All,User.Read.All - The caller is a Privileged Role Administrator or Intune Administrator
Connect
Connect-MgGraph -Scopes "DeviceManagementConfiguration.ReadWrite.All","DeviceManagementManagedDevices.Read.All","Group.ReadWrite.All","User.Read.All"Approach
- Resolve the user and the device with
Get-MgUserandGet-MgBetaDeviceManagementManagedDevice. - Create a dedicated security group for the grant and add the device to it.
- Create the Account Protection policy with the Graph calls shown in the previous section, and assign it to that group.
- Record a justification and a review date in the policy description, so the grant does not become permanent by neglect.
You can combine this with a scheduled job that runs Get-MgDeviceManagementConfigurationPolicy and flags policies past their review date.