Azure / Azure/bicep

Linter: add rule for correct format of dynamic userAssignedIdentities

Open
#8,651 2 comments 0 reactions 0 assignees View on GitHub
enhancement story: linter rules
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 21m
Merged PRs (30d)
79

Description

**Describe the solution you'd like**
When using a userAssignedIdentity, the key of the key/value pair is commonly an expression. When using a param/var for this key name, it must be interpolated. This isn't common knowledge (or intuitive) so many users (including myself) get it wrong, even after the first time. I missed this and have seen other users miss it as well, so figured it was time for a linter rule.

Incorrect:
```bicep
userAssignedIdentities: {
userAssignedResourceId: {}
}
```

Correct
```bicep
userAssignedIdentities: {
'${userAssignedResourceId}': {}
}
```

Contributor guide

Open the contributing guide

Research direction

Start with the issue's Incorrect and Correct Bicep examples, focusing on dynamic userAssignedIdentities keys supplied through a parameter or variable. Done means the linter reports the un-interpolated form and accepts the interpolated form; the issue does not name implementation files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
devtools
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.