Skip to content

Custom decorators #2922

@tsujp

Description

@tsujp

Is your feature request related to a problem? Please describe.

Current decorators provide basic restriction over parameters but more advanced decorators are required to prevent separation of concerns over resource requirements. Example:

adminPassword on Microsoft.Compute/VirtualMachines has the following requirements:

Complexity requirements: 3 out of 4 conditions below need to be fulfilled
Has lower characters
Has upper characters
Has a digit
Has a special character (Regex match [\W_])

Disallowed values: "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" 

The only thing you can currently do in a Bicep template is verify the minimum and maximum length with @minLength() and @maxLength().

If more default decorators existed to verify regex or custom decorators were possible then checks could be made pre-deployment on the requirements of the password in this case.

Describe the solution you'd like

User defined functions accessible as decorators might be the sole solution, relevant issues:

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions