在部署之前验证 Azure Bicep 字符串变量的长度



类似于如何验证Bicep模块输入参数(例如允许的字符串长度(,是否可以验证字符串变量的长度?

param input1 string
param input2 string
var combo = '${input1}${input2}' 
// Validate length of 'combo' to be below or equal to 64 characters here 

原因是我希望能够在飞行前验证期间捕获过长(超过64个字符(的资源部署名称。

不确定变量是否可能,但您可以始终将combo定义为参数并添加maxLength装饰器:

param input1 string
param input2 string
@maxLength(64)
param combo string = '${input1}${input2}' 

最新更新