Azure / Azure/bicep-registry-modules
[AVM Module Issue]: userAssignedManagedIdentities error out in avm/ptn/lz/sub-vending
- Dominant language
- Bicep
- Stars
- 736
- Forks
- 564
- Avg merge
- 3d 15h
- Merged PRs (30d)
- 30
Description
### Check for previous/existing GitHub issues
- [x] I have checked for previous/existing GitHub issues
### Issue Type?
Bug
### Module Name
avm/ptn/lz/sub-vending
### (Optional) Module Version
0.5.2
### Description
When specifying userAssigedManagedIdentities property, it fails when assigning multiple roles to a single identity as follows:
``` bicep
...
userAssignedIdentityResourceGroupName: 'rg-${appName}-id-${environmentShort}-${location}'
userAssignedIdentitiesResourceGroupLockEnabled: false
userAssignedManagedIdentities: [
{
location: location
name: 'uami-${appName}-devops-${environmentShort}'
roleAssignments: [
{
definition: '/providers/Microsoft.Authorization/roleDefinitions/'
description: 'Role 1'
relativeScope: '' // subscription scope
}
{
definition: '/providers/Microsoft.Authorization/roleDefinitions/'
description: 'Role 2'
relativeScope: '' // subscription scope
}
]
}
]
```
The above code fails with the error: `Deployment template validation failed: 'The template reference 'createUserAssignedManagedIdentity[1]' is not valid: could not find template resource or resource copy with this name. Please see https://aka.ms/arm-function-reference for usage details.'."`
The code works if I only assign one role. It seems that the underlying code is iterating the managed identity with wrong index.
Thank you in advance for looking into it.
### (Optional) Correlation Id
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.