Coder Perfect

Use @decorators in Bicep for params of type object?


I can use @decorators for some form of “validation” with a “simple” argument in Bicep, like this:

@description('Name of database administrator')
param dbAdminUsername string = 'dbadmin'

This would make the dbAdminUsername param between 3 and 20 characters long, as well as provide a description.

I’d like to “collect together” all of the database parameters I have, such as username, password, server name, database name, and so on. So here’s how I’d define an object:

param db object = {
  adminName: 'dbadmin'
  serverName: 'foo'
  size: 42
  // ...

Object-related questions:

Asked by Alexander Skwar

Solution #1

It isn’t feasible (yet). There‚Äôs ongoing discussion how to define such conditions:

Any extra information is much appreciated!

Answered by Miq

Post is based on