Skip to content

@onlyIfNotExists() doesn't check for existing role assignments #18454

@lbruck95

Description

@lbruck95

Is your feature request related to a problem? Please describe.
We have written a bunch of Bicep code over the past 2 years and the one problem we consistently run into is conflicts on role assignments in our templates because the role assignment already exists. Many of these role assignments were created when the resource was created with ARM templates in the past. Now, when creating with our Bicep templates, the GUID is different and the deployment fails because their is a conflict on the role assignment. When I heard about @onlyIfNotExists(), I thought it was the solution to this problem but unfortunately after testing, it doesn't look like it works this way.

Describe the solution you'd like
We would like the @onlyIfNotExists() decorator to check if a role assignment already exists for the same identity, role, and scope as an existing role assignment. It would only deploy if it did not exist. This would make our deployments much smoother.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions