Azure / Azure/azure-dev

[Issue] `azd provision --preview` does not display Role Assignment resources

Open
#6,688 5 comments 0 reactions 1 assignee Claimed by @hemarina View on GitHub
area/bicep area/provisioning customer-reported enhancement need-upvotes needs-team-attention
Dominant language
Go
Stars
569
Forks
364
Avg merge
2d 19h
Merged PRs (30d)
136

Description

- [x] Make sure you've installed the latest version using [instructions](https://github.com/Azure/azure-dev?tab=readme-ov-file#installupgrade-azure-developer-cli)

**Output from `azd version`**
```
azd version 1.23.3 (commit c53baf4180b8636f4366cd9d9f621755db75f370)
```

**Describe the bug**
`azd provision --preview` does not display `Microsoft.Authorization/roleAssignments` resources, even though the ARM what-if API correctly returns them.

Running `az deployment sub what-if` shows the Role Assignment as "Create", but `azd provision --preview` shows no output for the same resource.

**To Reproduce**
1. Create a Bicep file with a subscription-scoped role assignment:
```bicep
targetScope = 'subscription'

resource roleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(subscription().id, 'reader-role')
properties: {
principalId: ''
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'acdd72a7-3385-48ef-bd42-f606fba81ae7')
principalType: 'ServicePrincipal'
}
}
```
2. Run `azd provision --preview`
3. Role assignment is not displayed

**Expected behavior**
Role Assignment should be displayed similar to other resources:
```
Create : Role Assignment :
```

**Root Cause Analysis**
`AzureResourceTypeRoleAssignment` is defined in `azure_resource_types.go` but has no corresponding case in `GetResourceTypeDisplayName()`, causing `manager.go` to skip displaying it.

**Environment**
* Language: Bicep
* OS: Linux (Ubuntu)

**Additional context**
- Similar issue was reported and fixed for Automation Accounts in #4965 / PR #5378
- `azd down` now uses dynamic resource display names (PR #6452), but `azd provision --preview` still uses static mapping

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.