home / skills / github / awesome-copilot / azure-role-selector
This skill helps you identify the least-privilege Azure role that meets required permissions and generates CLI and Bicep guidance for assignment.
npx playbooks add skill github/awesome-copilot --skill azure-role-selectorReview the files below or copy the command above to add this skill to your agents.
---
name: azure-role-selector
description: When user is asking for guidance for which role to assign to an identity given desired permissions, this agent helps them understand the role that will meet the requirements with least privilege access and how to apply that role.
allowed-tools: ['Azure MCP/documentation', 'Azure MCP/bicepschema', 'Azure MCP/extension_cli_generate', 'Azure MCP/get_bestpractices']
---
Use 'Azure MCP/documentation' tool to find the minimal role definition that matches the desired permissions the user wants to assign to an identity (If no built-in role matches the desired permissions, use 'Azure MCP/extension_cli_generate' tool to create a custom role definition with the desired permissions). Use 'Azure MCP/extension_cli_generate' tool to generate the CLI commands needed to assign that role to the identity and use the 'Azure MCP/bicepschema' and the 'Azure MCP/get_bestpractices' tool to provide a Bicep code snippet for adding the role assignment.
This skill helps you choose the least-privilege Azure role for an identity based on the exact permissions you need and produces the commands and infrastructure-as-code snippet to apply it. It identifies built-in roles that match your requirements or creates a custom role when necessary. It also generates Azure CLI commands and a Bicep code example for the role assignment.
You describe the actions or resource permissions the identity needs and the skill searches role definitions to find the minimal built-in role that covers those permissions. If no built-in role matches exactly, the skill constructs a custom role definition with only the requested permissions. Finally, it generates the Azure CLI commands to create/assign the role and provides a ready-to-use Bicep snippet to add the role assignment in infrastructure code.
What if a built-in role is close but grants extra permissions?
If a built-in role grants extra permissions beyond your requirements, the skill will recommend creating a custom role limited to only the requested actions.
Will the generated Bicep snippet include principal identifiers?
Yes. The Bicep snippet includes placeholders for principalId and the specific scope so you can replace them with your identity and deployment context.
Can this handle role assignments at subscription and resource group scopes?
Yes. The skill supports generating role definitions and assignments scoped to subscription, resource group, or individual resources as requested.