我想从Azure资源pipe理器快速入门模板部署一个模板。
其中的许多模板都有一个在模板文件中指定的默认值(例如这个azuredeploy.json ):
"ouPath": { "type": "string", "defaultValue": "", "metadata": { "description": "Specifies an organizational unit (OU) for the domain account. Enter the full distinguished name of the OU in quotation marks. Example: 'OU=testOU; DC=domain; DC=Domain; DC=com" } },
但是,相应的azuredeploy.parameters.json不会定义ouPath值。
当我在Azure CLI调用中的--parameters-file中指定文件时:
azure group deployment create "${resource_group_name}" "${deployment_name}" --template-uri "${template_uri}" --parameters-file ${parameters_file}
我收到一个错误:
info:执行命令组部署create
错误:模板和部署“参数”对象长度不匹配
部署参数文件没有定义{ouPath}。
错误:错误信息已被logging到/Users/techraf/.azure/azure.err
错误:组部署创build命令失败
如果我定义将这个值明确地添加到parameters.json文件中,则部署工作正常。
主要问题:
上面的Azure存储库中的示例( parameters.json .json)绝对数量没有显式指定值,这让我想,必须有一种方法告诉Azure使用默认值,而不是在parameters.json中提供它。
有没有办法避免使用Azure CLI添加在模板文件中定义的具有defaultValue的值?
附加问题:
更糟糕的是,在上面给出的例子中,默认值是空的,如果我在parameters.json指定了一个空值:
"ouPath": { "value": "" },
我得到了一个交互式提示值。
我怎样才能避免呢?
看来这是Azure CLI 0.10.5中的一个错误。
虽然发行说明没有明确提到这个问题,但问题并没有发生在0.10.6上。