azure-role-selector

Recommends least-privilege Azure RBAC roles and generates Terraform role assignments.

Updated Sep 10, 2026
One-click install
npx skills add https://github.com/serpro-workshop-fortaleza/sifap-modernization-paula --skill azure-role-selector-serpro-workshop-fortaleza
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: azure-role-selector
Source: https://github.com/serpro-workshop-fortaleza/sifap-modernization-paula/tree/main/.github/skills/azure-role-selector
Command: npx skills add https://github.com/serpro-workshop-fortaleza/sifap-modernization-paula --skill azure-role-selector-serpro-workshop-fortaleza

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Choosing the right Azure RBAC role is error-prone: teams often over-assign broad roles like Owner or Contributor, creating security risk. This Skill recommends the most restrictive built-in role for an identity's required actions and expresses the assignment as Terraform. ## Core Features & Use Cases - Least-privilege role selection: Maps required control-plane and data-plane actions to the narrowest built-in Azure role at the tightest scope. - Terraform output: Generates ready-to-commit azurerm_role_assignment blocks, plus azurerm_role_definition when a custom role is genuinely needed. - Use Case: A managed identity needs to read blobs from one storage account. The Skill recommends Storage Blob Data Reader scoped to that account, not Contributor at the subscription, and outputs the Terraform to apply it. ## Quick Start Ask which Azure role to assign to a managed identity that needs read-only access to a specific storage account, and request the assignment as Terraform.

Frequently Asked Questions about azure-role-selector

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I choose the least-privilege Azure RBAC role for a managed identity?

List the exact actions the identity must perform, separating control-plane actions from data-plane dataActions, then find the built-in role covering them with the least excess. Assign it at the narrowest scope, preferring resource over resource group over subscription.

How do I create an Azure role assignment in Terraform?

Use the azurerm_role_assignment resource with scope, role_definition_name, and principal_id arguments. For custom roles, define an azurerm_role_definition with explicit permissions and assignable_scopes, then reference it in the assignment.

When should I create a custom Azure role definition instead of a built-in role?

Create a custom role only when no built-in role covers the required actions without excessive permissions. The custom definition should list only the necessary actions and dataActions with an explicit assignable_scopes list.

Why should I avoid assigning Owner or Contributor to workload identities?

Owner and Contributor include Microsoft.Authorization/* permissions, letting the identity grant itself more access. Assigning them at subscription or management-group scope to a workload identity creates a serious privilege-escalation risk.

Does this Skill support Bicep or ARM templates for role assignments?

Bicep and ARM output is out of scope for this kit's deliverables. The Skill produces Terraform azurerm_role_assignment resources, using Bicep tooling only optionally for exploration or comparison.