使用az cli将参数传递到--custom-data Cloud Init脚本 [英] Pass parameters to --custom-data Cloud Init script using az cli
问题描述
是否可以将参数传递给云初始化脚本?试图实现这样的目标:
Is there a way to pass parameters to the cloud init script? Trying to achieve something like this:
az vm create ... --custom-data myscript.yml param1 param2
显然,可以使用如下所示的ARM模板中的变量: https://github.com/Azure/iotedge-vm-deploy/blob/master/cloud-init.txt#L44
Obviously it is possible to use variables from an ARM template like here: https://github.com/Azure/iotedge-vm-deploy/blob/master/cloud-init.txt#L44
推荐答案
恐怕您犯错了.它不是CLI命令 az vm create
的参数,而是Azure模板的变量.您可以看到变量 docs
在模板变量块中定义,当然,您可以在VM属性
I'm afraid you made the mistake. It's not the parameter for the CLI command az vm create
, it's a variable of the Azure Template. You can see the variable docs
is defined in the template variables block, and of course, you can then use it in the template for the VM property customData.
现在,CLI命令 az vm create
不支持-custom-data
的参数.您可以获取有关Azure VM的cloud-init的更多详细信息
Now the CLI command az vm create
does not support the parameters for the --custom-data
. You can get more details about the cloud-init for Azure VM here.
这篇关于使用az cli将参数传递到--custom-data Cloud Init脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!