๐ฑ Recipe ยท Intune & Device Management
Grant Local Administrator Rights on Entra-Joined Devices via Intune
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
Context
Why This Matters
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, the local Administrators group is managed by Entra ID during the join process โ modifications after the fact require either a directory role assignment, an Intune Account Protection policy (LocalUsersAndGroups CSP), or, ideally, Endpoint Privilege Management (EPM) for just-in-time elevation.
This recipe walks through the three common approaches, their trade-offs, and how to choose the right one for a given request. It replaces the common (but insecure) practice of directly adding users to the local Administrators group via PowerShell on the device, which is untracked and survives re-imaging.
Expected Outcomes
- The target user can perform administrative actions (install software, change system settings) on the designated Entra-joined device(s).
- The grant is tracked centrally in Entra ID or Intune โ visible, auditable, and reversible.
- You have a documented justification and scope for the grant (tenant-wide, device-scoped, or just-in-time).
- The change complies with least-privilege principles, with an expiration or review date where appropriate.
Risks & 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 via group assignment. Prefer this over the directory role when you need to limit scope.
- Endpoint Privilege Management (EPM) is the modern, preferred approach โ it grants elevation for specific executables on demand rather than standing admin rights. 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 from LSASS.
- Propagation is not instant. Directory role changes can take up to 4 hours and require sign-out/sign-in. Intune policy application depends on the next device check-in (typically 8 hours, can be forced).
- Log and review. Every local admin grant should have a ticket, a justification, and a planned expiration or quarterly review.
Do not
- Do not RDP to the device and add the user to the Administrators group manually โ the change is invisible to Intune/Entra and will be overwritten by policy.
- Do not add users to the Global Administrator or 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(s) |
| 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 |
The fastest way to get this done: just ask Dex. Copy the prompt below and paste it into your Dex conversation.
For IT Admins
Paste into Dex Pro
For End Users
How an employee would ask Dex for help
Option A โ Tenant-wide: Microsoft Entra Joined Device Local Administrator role
Use when a helpdesk or engineering group needs admin on all corporate devices.
- Sign in to the Microsoft Entra admin center as at least a Privileged Role Administrator.
- Navigate to .
- Locate Manage Additional local administrators on all Microsoft Entra joined devices and select it.
- Click Add assignments, search for the target user or group, and click Add.
- Allow up to 4 hours for propagation. The user must sign out and back into Windows for the new token (including the admin group) to take 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.
- Navigate to .
- Platform: Windows 10 and later. Profile: Local user group membership. Click Create.
- Name the policy (e.g.,
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 user(s) or group(s) that should get local admin.
- Click Next, apply scope tags if used, then assign the policy to a security group that contains the target device(s). Do not assign to All Devices.
- Review and create. The policy applies at the next device check-in (force from Company Portal or
dsregcmd /status+ sync).
Option C โ Just-in-time: Endpoint Privilege Management (EPM)
- Ensure the tenant has the Intune Suite or EPM add-on license assigned.
- In Intune, navigate to .
- 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 (e.g.,
VSCodeUserSetup-x64-*.exe) to run elevated, either automatically or with user-confirmed / support-approved flow. - Publish and assign. The user right-clicks the installer and selects Run with elevated access โ no standing admin rights required.
Option A โ Assign the directory role (Graph API)
First, ensure the role is activated in the tenant. Entra Joined Device Local Administrator role template ID is 9f06204d-73c1-4d4c-880a-6edb90606fd8.
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"
}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'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}/syncDeviceOverview
The script below performs Option B โ the recommended scoped approach. It takes a user UPN and a device name, looks up both, ensures a dedicated assignment group exists, adds the device to it, 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 - Caller is a Privileged Role Administrator or Intune Administrator
Usage
Connect-MgGraph -Scopes "DeviceManagementConfiguration.ReadWrite.All","DeviceManagementManagedDevices.Read.All","Group.ReadWrite.All","User.Read.All"
.\Grant-LocalAdmin.ps1 -UserPrincipalName user@contoso.com -DeviceName LAPTOP-001 -Justification "Install VS Code for dev work" -ExpirationDays 30The -ExpirationDays parameter records a review date in the policy description so the grant does not become permanent by neglect. Combine with a scheduled job that runs Get-MgDeviceManagementConfigurationPolicy and flags policies past their review date.
Next steps