azure-rbac

Identify minimal Azure RBAC roles and generate custom role definitions.

Updated Apr 10, 2026
One-click install
npx skills add https://github.com/attentiondotnet/azure-skills --skill azure-rbac-attentiondotnet
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: azure-rbac
Source: https://github.com/attentiondotnet/azure-skills/tree/main/.github/plugins/azure-skills/skills/azure-rbac
Command: npx skills add https://github.com/attentiondotnet/azure-skills --skill azure-rbac-attentiondotnet

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps teams determine the minimal Azure RBAC role or create a custom role for an identity so you can grant the exact permissions required for a task while maintaining least-privilege access. It also produces the CLI commands and Bicep snippets needed to apply those role assignments and explains the permissions required to grant roles.

Core Features & Use Cases

  • Role discovery: Find the closest built-in RBAC role that matches a requested permission set.
  • Custom role generation: Produce a custom role definition when no built-in role fits the required permissions.
  • Deployment artifacts: Generate Azure CLI commands and Bicep code snippets for assigning roles and include checks for assignment prerequisites (for example, Microsoft.Authorization/roleAssignments/write).
  • Use Case: Decide which role to assign a managed identity to read blobs, generate the CLI to assign it, and provide a Bicep snippet to include the assignment in infrastructure as code.

Quick Start

Ask the skill to find the least-privilege role for a given identity and produce the CLI commands and Bicep snippet to assign it.

Frequently Asked Questions about azure-rbac

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

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

To find the least-privilege Azure RBAC role for a managed identity, analyze its required permissions and match them against built-in roles. If no built-in role fits, generate a custom role definition to grant only the exact permissions needed for the task.

How do I generate Bicep code for an Azure role assignment?

You can generate Bicep code for an Azure role assignment by defining the role assignment resource in your template. The process includes creating the necessary Bicep snippets and verifying prerequisites like having Microsoft.Authorization/roleAssignments/write permissions.

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

You should create a custom Azure RBAC role definition when no available built-in role aligns with your specific permission requirements. This ensures you maintain least-privilege access by assigning only the exact permissions needed rather than over-privileged built-in roles.

What permissions are required to assign Azure RBAC roles using CLI?

Assigning Azure RBAC roles using CLI requires Microsoft.Authorization/roleAssignments/write permissions at the target scope. The generated CLI commands include prerequisite checks to verify the calling identity has the necessary authorization to perform the role assignment.

How do I assign a least-privilege role to a service principal in Azure?

To assign a least-privilege role to a service principal in Azure, identify the minimal built-in role matching its access needs or generate a custom role. Then use Azure CLI commands to apply the role assignment and ensure the service principal has exactly the permissions required.