Skip to content

Look up existing resources by properties other than name #4917

@WhitWaldo

Description

@WhitWaldo

Is your feature request related to a problem? Please describe.
If one attempts to deploy a role assignment that already exists, the deployment will fail instead of gracefully acknowledging that the resource already exists and skipping it. If there were an "exists" method as covered in this issue, I would still have a hard time applying it to role assignments.

A role assignment has the following properties:

  • RoleAssignmentId
  • Scope
  • DisplayName
  • SignInName
  • RoleDefinitionName
  • RoleDefinitionId
  • ObjectId
  • ObjectType
  • CanDelegate
  • Description
  • ConditionVersion
  • Condition

Unfortunately, none of those are the name property that must be used to describe an existing resource in Bicep.

Describe the solution you'd like
I'd like to have some way to describe such an assignment nonetheless using any of the other properties, as in the following:

resource assignment 'Microsoft.Authorization/roleAssignments@<version>' existing = {
  DisplayName: 'MyName'
  RoleDefinitionName: 'MyRoleName'
}

Of course, this is no use until there is an exists method available, but following that, it would be an ideal to have it on the roadmap afterwards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: UpvoteThis issue requires more votes to be consideredenhancementNew feature or request

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions