Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Validate Azure configurations, ARM/Bicep templates, and resource settings before deployment
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/role-verification.md
1# Role Assignment Verification23Verify that all RBAC role assignments in the generated infrastructure are correct and sufficient before deployment. Incorrect or missing roles are a common cause of runtime failures.45## When to Verify67After build verification (step 4) and **before** recording proof (step 6). Role issues surface as cryptic auth errors during deployment โ catching them here saves debugging time.89## Verification Checklist1011Review every resource-to-identity relationship in the generated Bicep/Terraform:1213| Check | How |14|-------|-----|15| **Every service identity has roles** | Each app with a managed identity must have at least one role assignment |16| **Roles match data operations** | Use service-specific **data-plane** roles for data access (see mapping table below); use generic Reader/Contributor/Owner only for management-plane operations |17| **Scope is least privilege** | Roles scoped to specific resources, not resource groups or subscriptions |18| **No missing roles** | Cross-check app code operations against assigned roles (see table below) |19| **Local dev identity has roles** | If testing locally, the user's identity needs equivalent roles via `az login` |2021## Common Service-to-Role Mapping2223| Service Operation | Required Role | Common Mistake |24|-------------------|---------------|----------------|25| Read blobs | Storage Blob Data Reader | Using generic Reader (no data access) |26| Read + write blobs | Storage Blob Data Contributor | Missing write permission |27| Generate SAS via user delegation | Storage Blob Delegator + Data Reader/Contributor | Forgetting Delegator role |28| Read Key Vault secrets | Key Vault Secrets User | Using Key Vault Reader (no secret access) |29| Read + write Cosmos DB | Cosmos DB Built-in Data Contributor | Using generic Contributor |30| Send Service Bus messages | Azure Service Bus Data Sender | Using generic Contributor |31| Read queues | Storage Queue Data Reader | Using Blob role for queues |3233## How to Verify (Static Code Review)3435Review the generated Bicep/Terraform files directly โ do **not** query live Azure state here. For each role assignment resource in your infrastructure code:36371. Identify the **principal** (which managed identity)382. Identify the **role** (which role definition)393. Identify the **scope** (which target resource)404. Cross-check against the app code to confirm the role grants the required data-plane access4142> ๐ก **Tip:** Search your Bicep for `Microsoft.Authorization/roleAssignments` or your Terraform for `azurerm_role_assignment` to find all role assignments.4344> โ ๏ธ **Live role verification** (querying Azure for actually provisioned roles) is handled by **azure-deploy** step 8 as a post-deployment check. This step is a static code review only.4546## Decision Tree4748```49For each app identity in the generated infrastructure:50โโโ Has role assignments?51โ โโโ No โ Add required role assignments to Bicep/Terraform52โ โโโ Yes โ Check each role:53โ โโโ Role matches code operations? โ โ OK54โ โโโ Role too broad? โ Narrow to least privilege55โ โโโ Role insufficient? โ Upgrade or add missing role56โ57For local testing:58โโโ User identity has equivalent roles?59โ โโโ No โ Grant roles via CLI or inform user60โ โโโ Yes โ โ Ready for functional verification61```6263> โ ๏ธ **Warning:** Generic roles like `Contributor` or `Reader` do **not** include data-plane access. For example, `Contributor` on a Storage Account cannot read blobs โ you need `Storage Blob Data Contributor`. This is the most common RBAC mistake.6465## Record in Plan6667After role verification, update `.azure/deployment-plan.md`:6869```markdown70## Role Assignment Verification71- Status: Verified / Issues Found72- Identities checked: <list of app identities>73- Roles confirmed: <list of role assignments>74- Issues: <any missing or incorrect roles fixed>75```76