azure-rbac-role-matching
Skill2 starsChanged 8 months agoMITView on GitHub
Recommend the least-privilege Azure built-in RBAC roles for one or more requested operations. Use this whenever users ask what role to assign, how to minimize Azure permissions, or which built-in role is the smallest safe match for a service principal, managed identity, app, or operator workflow.
- Installs packages
In this repository2 other files it gives its agents.
- .squad/copilot-instructions.mdCopilot instructions
- {skill-name}Skill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 5 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Use this skill when you need least-privilege built-in Azure RBAC role candidates from a set of requested operations and can work from …
- Distinctive: line 37
Use the permission metadata to keep control-plane and data-plane checks separate.
- Distinctive: line 38
Keep only roles that grant every requested permission.
- Distinctive: line 52
After installation, invoke the skill directly from the Copilot CLI agent.
- Very specific: line 56
Use when integrating the matcher into your own scripts or Node.js tooling:
- Distinctive: line 72
Use the shared matcher directly when integrating this skill into another agent flow:
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Use When
Use this skill when you need least-privilege built-in Azure RBAC role candidates from a set of requested operations and can work from checked-in snapshot data.
- Find the smallest built-in role that covers one or more exact operations.
- Validate or compare least-privilege role recommendations before assignment.
- Recommend role candidates for service principals, managed identities, automation, or CI/CD jobs.
- Explain why a broad role appears and surface smaller non-privileged alternatives first.
Do Not Use When
- You need custom role JSON generation.
- You need live scope reasoning (resource group vs subscription), PIM, ABAC, or deny assignment analysis.
- You need runtime authorization validation against Azure APIs.
Inputs
- one or more Azure permission strings, such as
Microsoft.Support/services/read
Workflow
- Load
references/data/roles-extended.jsonandreferences/data/permissions.json. - Evaluate each requested permission with wildcard allow/deny logic:
actionsnotActionsdataActionsnotDataActions
- Use the permission metadata to keep control-plane and data-plane checks separate.
- Keep only roles that grant every requested permission.
- Rank matches by
matchingPermissionsTotalascending, while treating0as an unknown-coverage edge case and pushing those candidates later. - Flag roles as privileged when they also grant
Microsoft.Authorization/roleAssignments/write.
The canonical implementation seam is scripts/lib/rbac.js. The sample CLI wrapper is scripts/match-roles.js.
Install and Run
Copilot CLI plugin (primary path)
/plugin install kdcllc/azure-rbac-role-matching-skillAfter installation, invoke the skill directly from the Copilot CLI agent. The skill runs entirely offline — no live Azure API calls are made at install time or at match time.
npm (library / CLI path)
Use when integrating the matcher into your own scripts or Node.js tooling:
npm install azure-rbac-role-matching-skill
npx azure-rbac-role-match Microsoft.Support/services/readFor a global install:
npm install -g azure-rbac-role-matching-skill
azure-rbac-role-match Microsoft.Support/services/readAgent Integration
Use the shared matcher directly when integrating this skill into another agent flow:
const {
loadExtendedRolesPayload,
loadPermissionIndex,
rankRoles,
} = require('azure-rbac-role-matching-skill');
const [payload, permissionIndex] = await Promise.all([
loadExtendedRolesPayload(),
loadPermissionIndex(),
]);
const matches = rankRoles(
['Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read'],
payload.roles,
permissionIndex
);Outputs
- ranked built-in role candidates
matchingPermissionsTotalfor each candidate- privileged-role flag
- custom-role guidance when no built-in role covers every requested permission
Boundaries
- The corpus is snapshot-based, not live.
- Shipping through a root
plugin.jsondoes not change runtime behavior — the matcher always runs offline against checked-in snapshot data. - This skill covers Azure built-in roles only. Custom role JSON generation is out of scope.
- This repo does not validate scope-specific access behavior.
- This repo does not handle deny assignments, PIM, ABAC, or broader governance logic.
matchingPermissionsTotalis a size heuristic, not a security score.- The result list is recommendation guidance, not an enforcement decision.
Validation
npm run validate
npm run match -- Microsoft.Support/services/read
npm pack --dry-runReferences
README.md— package overviewreferences/ALGORITHM.md— matcher and ranking detailsreferences/DATA-REFRESH.md— snapshot refresh processreferences/OPERATOR-GUIDE.md— human workflow and interpretation guidance
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

