使用 Azure Python Compute SDK 创建虚拟机时如何指定 Cloud-Init

How to Specify Cloud-Init When Creating A Virtual Machine with the Azure Python Compute SDK

当我使用 Azure Python SDK 创建并启动它时,我正在寻找 运行 linux 虚拟机上的启动脚本。我应该怎么做?

您可以在虚拟机 os_profile 中添加 cloud-init 作为 custom_data 的值。但正如 属性 所示:

Specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes.

它的值应该是一个base-64编码的字符串。您可以从另一个 .

如何做到这一点