Azure Custom Role Designer
A powerful CLI tool for platform engineers to create, update, and manage Azure custom roles with granular control over permissions.
Features
- Create roles from scratch - Start with an empty role definition
- Cherry-pick permissions - Select specific permissions from existing roles
- Merge permissions - Combine permissions from one or more existing roles with filtering capabilities
- Remove permissions - Filter and exclude specific permissions with advanced filtering
- Filter by string - Search permissions by action name pattern
- Filter by type - Separate control and data plane permissions
- Persist roles - Save and load role definitions locally and to Azure
Installation
Option 1: Install from the repository (Recommended)
# Clone/navigate to the project
cd azure-custom-role-tool
# Install in development mode
pip install -e .
# Or install normally
pip install .
Option 2: Install with all dependencies
pip install azure-custom-role-tool
Option 3: Install from source with all requirements
git clone <repo-url>
cd azure-custom-role-tool
pip install .
Quick Start
Using the installed command
# Check version
azure-custom-role-tool --version
# Interactive mode
azure-custom-role-tool
# Or use specific commands
azure-custom-role-tool create --name "My Custom Role" --description "Custom role for my team"
azure-custom-role-tool merge --roles "devops-developer,reader" --filter "Storage"
azure-custom-role-tool remove --filter "Delete"
Using the module directly
# Check version
python -m azure_custom_role_tool --version
# Run as module
python -m azure_custom_role_tool
# Or use the module in your Python code
from azure_custom_role_tool import RoleManager, PermissionFilter, __version__
print(f"Using Azure Custom Role Tool v{__version__}")
manager = RoleManager()
role = manager.create_role("MyRole", "My custom role")
Usage
Interactive Mode
Run the tool without arguments or use the console command to enter console mode:
azure-custom-role-tool console
This launches an interactive menu where you can:
- Create a new role
- Load an existing role
- Merge permissions
- Remove permissions
- Filter and view permissions
- Save/publish the role
Interactive Features:
- Command History: Use arrow keys (↑/↓) to navigate through previous commands
- Persistent History: Command history is saved to
~/.azure-custom-role-tool-historyand persists across sessions - Context Help: Type
help <command>to see detailed help for any command - State Preservation: The current role remains loaded across multiple commands within the session
Command Line Mode
# Create a new role
azure-custom-role-tool create --name "Name" --description "Description" --subscription-id xx-xx-xx
# Start from existing role
azure-custom-role-tool load --name "existing-role"
# Merge multiple roles
azure-custom-role-tool merge --roles role1,role2,role3 --filter "Storage" --filter-type control
# Remove permissions
azure-custom-role-tool remove --filter "*/Delete/*" --filter-type data
# List available roles
azure-custom-role-tool list
# View role details
azure-custom-role-tool view --name "role-name"
# Save role locally
azure-custom-role-tool save --name "role-name" --output roles/my-role.json
# Publish to Azure
azure-custom-role-tool publish --name "role-name"
Configuration
Create a .env file for Azure authentication:
AZURE_SUBSCRIPTION_ID=your-subscription-id
AZURE_TENANT_ID=your-tenant-id
AZURE_CLIENT_ID=your-client-id
AZURE_CLIENT_SECRET=your-client-secret
Or use Azure CLI authentication (default).
File Structure
azure-custom-role-tool/
├── custom_role_designer.py # Main CLI tool
├── role_manager.py # Role management logic
├── permission_filter.py # Filtering and search
├── azure_client.py # Azure SDK integration
├── requirements.txt # Dependencies
├── roles/ # Local role definitions
├── examples/ # Example role definitions
└── tests/ # Unit tests
Architecture
Role Definition Schema
Roles are stored as JSON files conforming to Azure custom role definition format:
{
"Name": "Custom Role Name",
"IsCustom": true,
"Description": "Role description",
"Type": "CustomRole",
"Permissions": [
{
"Actions": ["Microsoft.Storage/*/read"],
"NotActions": ["Microsoft.Storage/*/delete"],
"DataActions": ["Microsoft.Storage/storageAccounts/blobServices/containers/blobs/*"],
"NotDataActions": []
}
],
"CreatedOn": "2024-01-01",
"UpdatedOn": "2024-01-01"
}
Permission Type Classification
- Control Plane: Management operations (e.g.,
Microsoft.Compute/virtualMachines/start/action) - Data Plane: Data operations (e.g.,
Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read)
Examples
See the examples/ directory for pre-built roles like:
devops-developer.json- DevOps developer permissionsjunior-developer.json- Junior developer restricted permissionssenior-developer.json- Senior developer full permissions
Contributing
For issues or feature requests, open a GitHub issue.
License
MIT - Paulo Correia
Metadata
Release files for azure-custom-role-tool 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| azure_custom_role_tool-1.0.0.tar.gz | 42.6 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| azure_custom_role_tool-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 65.7 kB
Release files / azure_custom_role_tool-1.0.0.tar.gz
| Download URL | azure_custom_role_tool-1.0.0.tar.gz |
|---|---|
| Size | 42.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f45a60824190e3bcd2d94853644fdc8b336fec49a479145c5aaf4caffb8fb812
|
|
BLAKE2b-256 checksum How to use checksums |
e0760967a73de275bfc8a319d52ec70b74b045c13c09bf9620626a670ed41386
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 25, 2026.
Transparency logRelease files / azure_custom_role_tool-1.0.0-py3-none-any.whl
| Download URL | azure_custom_role_tool-1.0.0-py3-none-any.whl |
|---|---|
| Size | 23.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
48af915073b815583bb2f2f947a8c710910e6d02d519bf389c760775ab2070d5
|
|
BLAKE2b-256 checksum How to use checksums |
9e03f8685d758d242c11f93281184ee114b5ad720ed34b5a9b5336a202958a9d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 25, 2026.
Transparency logSecurity for azure-custom-role-tool 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for azure_custom_role_tool-1.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 25, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.