Skip to content

Managed-Solution-LLC/AzureRBAC-MCP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azure RBAC Least Privilege MCP Server

An MCP (Model Context Protocol) server that helps define and enforce least-privilege access for Azure RBAC. Runs as a containerized Streamable HTTP service — fully compatible with Microsoft Copilot Studio, Claude Desktop, and any MCP client.

Tools

Tool Description
analyze_role_assignment Detects over-permissioning, privilege escalation paths, and compliance flags
recommend_roles Recommends least-privilege built-in roles for a job function or use case
generate_custom_role Generates custom role ARM JSON + Bicep with a least-privilege score
explain_permission Plain-language breakdown of any Azure permission string
list_builtin_roles Browse the role reference DB, filterable by category or risk level
list_job_profiles Lists job function profiles (vm-operator, devops-engineer, etc.)

Deploy to Azure Container Apps

Prerequisites

az login
az extension add --name containerapp
# Docker optional — the script uses ACR Tasks (cloud build, no local Docker needed)

One-command deploy

# Edit the variables at the top of the script first (resource group, ACR name, region)
chmod +x deploy/deploy.sh
./deploy/deploy.sh

The script will:

  1. Create a resource group
  2. Create an Azure Container Registry and build the image via ACR Tasks
  3. Deploy the Bicep template (Log Analytics + Container Apps Environment + Container App)
  4. Output your MCP endpoint URL

Manual step-by-step

# 1. Set your variables
RG="rg-azure-rbac-mcp"
ACR="rbacmcpacr"           # globally unique
LOCATION="westus"

# 2. Create RG + ACR
az group create -n $RG -l $LOCATION
az acr create -g $RG -n $ACR --sku Basic --admin-enabled true

# 3. Build and push image (no local Docker needed)
az acr build --registry $ACR --image azure-rbac-mcp:latest --file Dockerfile .

# 4. Update deploy/main.bicepparam with your image, then deploy
az deployment group create \
  -g $RG \
  -f deploy/main.bicep \
  -p @deploy/main.bicepparam \
  -p containerImage=$ACR.azurecr.io/azure-rbac-mcp:latest

Connect to Microsoft Copilot Studio

After deploying, your MCP URL will look like:

https://azure-rbac-mcp.<hash>.<region>.azurecontainerapps.io/mcp

Option A — Native MCP onboarding (recommended, November 2025+)

  1. Open your agent in Copilot Studio
  2. Go to Tools → Add a tool → New tool → Model Context Protocol
  3. Fill in:
    • Server name: Azure RBAC Least Privilege
    • Server description: Analyzes Azure RBAC roles for least-privilege access, recommends built-in roles, and generates custom role definitions with CMMC/HIPAA/NIST compliance guidance
    • Server URL: your MCP URL from above
    • Authentication: None (or API Key if you add auth middleware)
  4. Click Create → all 6 tools appear automatically
  5. Enable Generative Orchestration in your agent's Settings

Option B — Custom Connector (more control)

  1. Go to Power Platform portal → Custom Connectors → New custom connector → Import an OpenAPI file
  2. Upload deploy/copilot-studio-connector.yaml
  3. Update the host field with your actual Container Apps FQDN
  4. Save and publish the connector
  5. In Copilot Studio, add the connector as a tool

Local Development

npm install
npm run dev        # ts-node, hot reload
# or
npm run build && npm start

# Test the MCP endpoint
curl -X POST http://localhost:3000/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'

# Health check
curl http://localhost:3000/health

Architecture

src/
  index.ts                 ← Express + Streamable HTTP transport
  types.ts                 ← Shared interfaces
  tools/
    analyzeRole.ts         ← Over-permissioning analysis
    recommendRoles.ts      ← Use-case → role matching
    generateCustomRole.ts  ← ARM JSON + Bicep generation
    explainPermission.ts   ← Permission string decoder
  data/
    builtinRoles.ts        ← 25+ built-in roles with risk levels
    jobProfiles.ts         ← 9 job function → permission profiles
    permissionMetadata.ts  ← Risk scores for 20+ dangerous permissions

deploy/
  main.bicep               ← ACA + Log Analytics Bicep template
  main.bicepparam          ← Parameter values
  deploy.sh                ← End-to-end build + deploy script
  copilot-studio-connector.yaml ← OpenAPI spec for Power Platform connector

Transport

Client Transport Config
Copilot Studio Streamable HTTP POST to /mcp
Claude Desktop stdio See note below
curl / test Streamable HTTP POST to /mcp

Claude Desktop stdio mode: If you also want to run this locally with Claude Desktop, you can add a stdio wrapper. The HTTP server is the primary deployment target.


Compliance Coverage

Analysis and recommendations include guidance for:

  • CMMC Level 2 (AC.1.001, AC.2.005, AC.2.006, AC.3.017)
  • HIPAA (164.312(a)(1), 164.312(a)(2)(i))
  • NIST 800-171 (3.1.5, 3.1.6)
  • FedRAMP (AC-6)

About

MCP server for Azure RBAC least-privilege enforcement — analyzes role assignments, recommends minimal roles, and generates custom role definitions. Runs as a containerized Streamable HTTP service compatible with Copilot Studio, Claude Desktop, and any MCP client.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages