Skip to content

@allowed parameter values forwarding #16984

@ikkentim

Description

@ikkentim

Is your feature request related to a problem? Please describe.
When creating a parameter, we can use @allowed(['a', 'b']) to specify allowed values.

Ideally, when a parameter is used in a resource or module where its parameter is also decorated with @allowed I would like to avoid repeating the list of allowed values, especially when the list is extensive.

@allowed(['Standard_RAGRS', 'Standard_LRS', 'Standard_GRS', 'Standard_RAGRS', 'Standard_ZRS', 'Premium_LRS']) // I'm probably missing a few
param sku string

resource storageAccount 'Microsoft.Storage/storageAccounts@2023-01-01' = {
  name: 'name'
  sku: {
    name: sku
  }
  // ...
}

Describe the solution you'd like
An implicit or explicit way to copy the allowed values of a certain property.

Possible syntax:

@allowed(allowedOf(storageAccount.sku.name))
param sku string

resource storageAccount 'Microsoft.Storage/storageAccounts@2023-01-01' = {
  name: 'name'
  sku: {
    name: sku
  }
  // ...
}

This would allow the @allowed decorator to dynamically inherit the allowed values from the resource or module property, reducing redundancy and improving maintainability.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions