Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Deploy applications and infrastructure to Azure using Copilot-guided workflows and Azure MCP
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/live-role-verification.md
1# Live Role Verification23Query Azure to confirm that provisioned RBAC role assignments are correct and sufficient for the application to function. This complements the static role check in azure-validate by validating **live Azure state**.45## How It Differs from azure-validate's Role Check67| Check | Skill | What It Verifies |8|-------|-------|-----------------|9| **Static** | azure-validate | Generated Bicep/Terraform has correct role assignments in code |10| **Live** | azure-deploy (this) | Provisioned Azure resources actually have the right roles assigned |1112Both checks are needed because:13- Bicep may be correct but provisioning could fail silently for roles14- Manual changes or policy enforcement may alter role assignments15- Previous deployments may have stale or conflicting roles1617## When to Run1819After deployment verification (step 7). Resources are now provisioned, so live role assignments can be queried.2021## Verification Steps2223### 1. Identify App Identities2425Read `.azure/deployment-plan.md` to find all services with managed identities. Then query Azure for their principal IDs:2627```bash28# App Service29az webapp identity show --name <app-name> -g <resource-group> --query principalId -o tsv3031# Container App32az containerapp identity show --name <app-name> -g <resource-group> --query principalId -o tsv3334# Function App35az functionapp identity show --name <app-name> -g <resource-group> --query principalId -o tsv36```3738### 2. Query Live Role Assignments3940Use MCP tools to list role assignments for each resource **and identity** (using the `principalId` from step 1):4142```43azure__role(44command: "role_assignment_list",45scope: "<resourceId>",46assignee_object_id: "<principalId>"47)48```4950Or via CLI:5152```bash53az role assignment list --scope <resourceId> --assignee-object-id <principalId> --output table54```5556### 3. Cross-Check Against Requirements5758For each identity, verify the assigned roles match what the app needs:5960| App Operation | Expected Role | Scope |61|---------------|---------------|-------|62| Read/write blobs | Storage Blob Data Contributor | Storage account |63| Generate user delegation SAS | Storage Blob Delegator | Storage account |64| Read secrets | Key Vault Secrets User | Key Vault |65| Send messages | Azure Service Bus Data Sender | Service Bus namespace |66| Read/write documents | Cosmos DB Built-in Data Contributor | Cosmos DB account |6768### 4. Check for Common Issues6970| Issue | How to Detect | Fix |71|-------|---------------|-----|72| Role assigned at wrong scope | Role on resource group but needed on specific resource | Reassign at resource scope |73| Generic role instead of data role | `Contributor` assigned but no data-plane access | Replace with data-plane role (e.g., `Storage Blob Data Contributor`) |74| Missing role entirely | No assignment found for identity on target resource | Add role assignment to Bicep and redeploy |75| Stale role from previous deployment | Old principal ID with roles, new identity without | Clean up old assignments, add new ones |7677## Decision Tree7879```80Resources provisioned?81├── No → Skip live check (nothing to query yet)82└── Yes → For each app identity:83├── Query role assignments on target resources84├── Compare against expected roles from plan85│ ├── All roles present and correct → ✅ Pass86│ ├── Missing roles → ❌ Fail — add to Bicep, redeploy87│ └── Wrong scope or generic roles → ⚠️ Warning — fix and redeploy88└── Record results in deployment verification89```9091## Record in Deployment Verification9293Add live role verification results to the deployment log in `.azure/deployment-plan.md`:9495```markdown96### Live Role Verification97- Command: `az role assignment list --scope <resourceId> --assignee-object-id <principalId>`98- Results:99- <identity> → <role> on <resource> ✅100- <identity> → missing <expected-role> on <resource> ❌101- Status: Pass / Fail102```103