I'm trying to spin up VM with cloud-init using Azure SDK. Script is based on this example: https://github.com/Azure-Samples/virtual-machines-python-manage/blob/master/example.py I have added following:
with open(cloudinit, "r") as cl:
clcont=cl.read()
# CUSTOM_DATA=base64.b64encode(clcont.encode('utf-8')).decode('ascii')
CUSTOM_DATA=clcont
Next in the function create_vm_parameters
added:
'custom-data': CUSTOM_DATA
I have tried following examples:
- passed base64, base64 ascii decoded as well as plain script context.
- provide
custom-data
inos_profile
as well as separated block.
When trying to spin up vm with az cli
, the cloud-init script works fine.
Do you have any ideas how to make it work with python sdk? Perhaps I am adding it in the incorrect section while creating the vm parameters?