The Scenario
We were running an Intune environment with just over 8,200 managed devices across three distinct business units — Corporate IT, a manufacturing floor team, and a field sales org. Each unit had its own helpdesk, its own device fleet, and its own appetite for what they considered "their" data. All on Microsoft 365 E3 with the Intune Plan 1 license, no fancy add-ons.
The problem surfaced about 14 months in. A helpdesk tech in the manufacturing group — well-intentioned, no malice — remotely wiped a corporate laptop belonging to a VP in the sales org. The device was dual-listed in a shared dynamic group because someone had used a common naming prefix. The tech had Global Helpdesk permissions, saw the device in their console view, assumed it was theirs to manage, and initiated a wipe.
That one incident forced a complete audit of our RBAC posture. What we found was uncomfortable: 23 accounts had far more Intune access than their job function required, four custom roles had never been properly scoped, and our scope tag strategy was essentially decorative — tags existed but weren't enforced through role assignments. We had the illusion of access control without the substance of it.
This post documents what we rebuilt, how we validated it, and the specific decisions that saved us from repeating the same mistakes.
Why This Matters
RBAC in Intune isn't just about keeping junior techs out of senior admin menus. At the security architecture level, it's your primary control plane for limiting blast radius when credentials are compromised. If a helpdesk account gets phished, how much damage can that actor do? With poorly scoped Intune roles, the answer is: a lot. Remote wipe. App removal. Policy reassignment. Compliance status manipulation.
The compliance angle is equally sharp. Under frameworks like ISO 27001, SOC 2, and increasingly under DORA for financial entities, you need demonstrable least-privilege access to systems that touch endpoint configuration. Auditors are asking for this now. "We use Intune" is not an answer. "We have documented role assignments, scope tag enforcement, and quarterly access reviews" is an answer.
What the official documentation glosses over:
- Scope tags are only enforced when they're assigned to both the role assignment and the resource. Tagging a device policy without including that tag in the role assignment does nothing. This trips up almost every team implementing RBAC for the first time.
- Built-in roles cannot be cloned through the UI. You have to recreate permissions manually or use Graph API to export and reimport a modified version.
- Role assignments are evaluated at the time of action, not at login. A user whose group membership changes mid-session may not see updated permissions until their token refreshes — typically 60-90 minutes.
- The Intune Service Administrator Entra ID role bypasses all Intune RBAC entirely. Any account holding that role has full Intune access regardless of what custom roles you've assigned. This is underdocumented and frequently missed in access reviews.
That last point burned us. Two of our "scoped" admins also held the Intune Service Administrator Entra role from a legacy assignment. Our carefully crafted custom roles were irrelevant for those accounts.
Root Cause Analysis
Understanding why our RBAC was broken required mapping how Intune actually evaluates permissions at runtime. The flow looks like this:
- User authenticates to Intune portal. Entra ID roles are checked first — if the account holds Global Administrator or Intune Service Administrator, evaluation stops here and full access is granted.
- If no privileged Entra role applies, Intune checks the user's assigned custom or built-in Intune roles.
- For each role assignment, Intune checks the associated scope groups (which devices/users this admin can act on) and scope tags (which tagged resources are visible).
- The effective permission set is the union of all role assignments. There is no deny mechanism — only additive grants.
This additive model is critical to understand. You cannot assign a role that removes a permission granted by another role. If a user is in two role assignments and one grants "Remote Wipe" while the other doesn't, they have Remote Wipe. Full stop. Your architecture has to account for this by ensuring overlapping assignments don't inadvertently grant escalated access.
Investigating Current Role Assignments via Graph API
Before rebuilding anything, we needed a complete picture. The Intune portal's role UI is functional but not auditable at scale. Graph API is the right tool here.
# Get all Intune role definitions (custom and built-in) GET https://graph.microsoft.com/beta/deviceManagement/roleDefinitions # Get all role assignments GET https://graph.microsoft.com/beta/deviceManagement/roleAssignments?$expand=roleDefinition # Get scope tags GET https://graph.microsoft.com/beta/deviceManagement/roleScopeTags
We wrapped this into a PowerShell audit script that exported the full RBAC posture to CSV:
Connect-MgGraph -Scopes "DeviceManagementRBAC.Read.All", "DeviceManagementConfiguration.Read.All"
# Pull all role assignments with expanded role definition and members
$assignments = Get-MgDeviceManagementRoleAssignment -ExpandProperty "roleDefinition" -All
$report = foreach ($assignment in $assignments) {
$roleName = $assignment.RoleDefinition.DisplayName
$scopeGroups = $assignment.ResourceScopes
$scopeTags = $assignment.ScopeTagIds
foreach ($memberId in $assignment.Members) {
# Resolve group members
$groupMembers = Get-MgGroupMember -GroupId $memberId -All
foreach ($member in $groupMembers) {
[PSCustomObject]@{
RoleName = $roleName
AssignmentName = $assignment.DisplayName
UserId = $member.Id
UserPrincipal = (Get-MgUser -UserId $member.Id).UserPrincipalName
ScopeGroups = ($scopeGroups -join "; ")
ScopeTagIds = ($scopeTags -join "; ")
IsBuiltIn = $assignment.RoleDefinition.IsBuiltIn
}
}
}
}
$report | Export-Csv -Path "./IntuneRBAC_Audit_$(Get-Date -Format yyyyMMdd).csv" -NoTypeInformation
Write-Host "Exported $($report.Count) role membership records."
Cross-referencing this output against Entra ID role assignments using Get-MgDirectoryRoleMember for the Intune Service Administrator and Global Administrator roles revealed our 23 over-privileged accounts immediately.
Scope Tag Validation
To confirm our scope tag enforcement suspicion, we queried a known policy and checked its tag assignment against the role assignments that should govern it:
# Check scope tags on a specific configuration profile
GET https://graph.microsoft.com/beta/deviceManagement/deviceConfigurations/{policyId}?$select=displayName,roleScopeTagIds
# Compare against role assignment scope tag IDs
GET https://graph.microsoft.com/beta/deviceManagement/roleAssignments/{assignmentId}?$select=displayName,scopeTagIds
We found 47 configuration profiles tagged with MFG-Floor that had zero corresponding role assignments including that tag. The tag existed on the resource, but no role assignment was scoped to it — meaning any Intune admin with appropriate permissions could see and modify those policies. Decorative, exactly as I described.
The Solution
We rebuilt our RBAC model around three principles: least privilege per business unit, mandatory scope tag enforcement, and quarterly automated auditing. Here's the concrete implementation.
Scope Tag Architecture
We created one scope tag per business unit plus a shared "Global-IT" tag for resources that corporate IT legitimately manages across all units:
BU-CorporateBU-ManufacturingBU-FieldSalesGlobal-IT
Every device, every configuration profile, every compliance policy, and every app assignment now requires at least one scope tag before it goes to production. We enforced this through a naming convention standard and a monthly Graph API check that reports untagged resources.
Custom Role Design
We defined three tiers per business unit. Below is the JSON structure for one of them — the Manufacturing Helpdesk role — exported via Graph and used for documentation and recreation:
{
"displayName": "MFG-Helpdesk-Tier1",
"description": "Manufacturing floor helpdesk. Device actions only. No policy modification.",
"isBuiltIn": false,
"permissions": [
{
"actions": [
"Microsoft.Intune/MobileApps/Read",
"Microsoft.Intune/ManagedDevices/Read",
"Microsoft.Intune/ManagedDevices/Sync",
"Microsoft.Intune/ManagedDevices/RestartNow",
"Microsoft.Intune/ManagedDevices/RemoteLock",
"Microsoft.Intune/Organization/Read"
],
"notActions": []
}
],
"roleAssignments": [
{
"displayName": "MFG-Helpdesk-Assignment",
"members": [""],
"resourceScopes": [""],
"scopeTagIds": [""]
}
]
}
Notice the deliberate exclusion of RemoteWipe and Retire from Tier 1. Those actions exist only in our Tier 2 role (MFG-Helpdesk-Tier2), which requires a separate Entra group with manager approval to join, enforced through Entra ID Access Reviews on a 90-day cycle.
Deploying Roles via PowerShell
Connect-MgGraph -Scopes "DeviceManagementRBAC.ReadWrite.All"
$roleBody = @{
displayName = "MFG-Helpdesk-Tier1"
description = "Manufacturing floor helpdesk. Device actions only."
permissions = @(
@{
actions = @(
"Microsoft.Intune/MobileApps/Read",
"Microsoft.Intune/ManagedDevices/Read",
"Microsoft.Intune/ManagedDevices/Sync",
"Microsoft.Intune/ManagedDevices/RestartNow",
"Microsoft.Intune/ManagedDevices/RemoteLock",
"Microsoft.Intune/Organization/Read"
)
notActions = @()
}
)
isBuiltIn = $false
} | ConvertTo-Json -Depth 5
$newRole = Invoke-MgGraphRequest -Method POST \
-Uri "https://graph.microsoft.com/beta/deviceManagement/roleDefinitions" \
-Body $roleBody \
-ContentType "application/json"
Write-Host "Created role: $($newRole.id)"
# Now create the role assignment
$assignmentBody = @{
displayName = "MFG-Helpdesk-Assignment"
members = @("")
resourceScopes = @("")
scopeTagIds = @("")
roleDefinition = @{ id = $newRole.id }
} | ConvertTo-Json -Depth 5
Invoke-MgGraphRequest -Method POST \
-Uri "https://graph.microsoft.com/beta/deviceManagement/roleAssignments" \
-Body $assignmentBody \
-ContentType "application/json"
Write-Host "Role assignment created successfully."
Validation Steps
After deployment, we validated each role using a test account in each Entra group. The checklist:
- Log into intune.microsoft.com with the test account.
- Confirm only devices in the scoped group are visible under Devices > All Devices.
- Confirm policies tagged with other business unit tags are not visible.
- Attempt a Remote Wipe action — should be absent from the action menu for Tier 1 accounts.
- Attempt to browse to Endpoint Security > Policies — should return an access denied or empty state.
- Verify via Graph API that the account's effective permissions match the role definition.
We also ran the audit PowerShell script immediately post-deployment and diff'd it against the pre-deployment export to confirm no unintended assignments existed.
For full reference on available permission strings, the Microsoft Learn RBAC documentation and the scope tags documentation are your canonical sources — just know that the Graph API permission action strings are only fully enumerable through a live GET /roleDefinitions call against your own tenant.
Scaling Considerations
At 8,200 devices, our RBAC model performs without issue. But we've since consulted on environments pushing 40,000+ devices, and a few things change at that scale.
Scope group size matters. Intune evaluates scope groups dynamically. If your scope group is a dynamic Entra group with complex membership rules and 15,000 members, the latency between a device joining that group and an admin being able to act on it through a scoped role can stretch to 24 hours in pathological cases. For large environments, prefer static scope groups updated via automated pipelines over complex dynamic rules.
Scope tag propagation is not instantaneous. When you add a scope tag to an existing policy or device configuration, it can take 15-30 minutes for that change to be reflected in all admin console views. During a migration from untagged to tagged resources, your helpdesk will see intermittent access during the transition window. Communicate this explicitly.
The 100-role-assignment limit is real. Microsoft caps Intune role assignments at 100 per tenant. In a large multi-national or heavily segmented environment, this limit becomes a hard constraint on your design. You cannot simply create a role assignment per department. You need to architect around group nesting and shared roles with careful scope tag differentiation. We've seen tenants hit this wall unexpectedly during M&A integration scenarios.
Automate the access review. At scale, manual quarterly reviews don't scale. We built a Logic App triggered monthly that runs the audit script, compares against a baseline JSON stored in a Storage Account, and posts a Teams adaptive card to the security team channel with any delta. Unreviewed deltas block a monthly compliance report sign-off. This is the only way quarterly RBAC hygiene survives operational pressure at enterprise scale.
Lessons Learned
- Scope tags without role assignment enforcement are theatre. Every implementation we've reviewed that predates 2022 has this problem. The tag exists on the resource, the role assignment doesn't include it, and every scoped admin can still see everything. Audit this first, before anything else.
- The Intune Service Administrator Entra role is an RBAC bypass and must be in scope for every access review. Your beautifully crafted custom roles are invisible to accounts holding this role. Cross-reference Intune RBAC exports against Entra ID privileged role holders as a single unified audit, not two separate processes.
- Additive permissions compound silently. A user in two role assignments accumulates permissions from both. There is no deny. This means role sprawl — adding users to role groups without removing old ones — quietly escalates privilege over time. Treat role group membership like you treat firewall rules: audit removals as carefully as additions.
- Document the permission string list for every custom role. The Intune portal shows friendly names. Graph API uses action strings like
Microsoft.Intune/ManagedDevices/RemoteWipe. Keep a maintained mapping document. When you need to reconstruct a role after a tenant migration or dispute a permission audit finding, you want this in version control, not reconstructed from memory. - Test with real accounts, not just portal inspection. We had a role that looked correctly configured in the UI but a test account could still see out-of-scope devices due to a group membership overlap we hadn't caught. The portal view of a role assignment is not a substitute for behavioral testing with a scoped account. Build this into your deployment checklist as a non-negotiable step.
RBAC in Intune is one of those controls that's easy to implement badly and hard to implement well. The tooling is capable. The Graph API surface is rich. The failure mode is almost always organizational — roles created reactively, scope tags applied inconsistently, access reviews deferred indefinitely. The technical implementation documented here took about three weeks of engineering time. The discipline to maintain it is the longer investment, and it's the one that actually determines your security posture.
For further reading on the permission model and built-in role definitions, the official RBAC reference on Microsoft Learn is accurate — just read it knowing the gaps this post describes, and test every assumption in your own tenant before you trust your architecture to it.