
Explanation
Step 1: Create a config.file and save the file as Sloud-init.txt file.
Publish a custom cloud-init built image of a Linux virtual machine to Azure Stack Hub Marketplace on the integrated system.
Add Linux images to the Azure Stack Hub Marketplace
1: Create a cloud-init.txt file with your cloud-config
Step 2: Upload the file to Azure Stack Hub storage account.
2: Reference cloud-init.txt during the Linux VM deployment
Upload the file to an Azure storage account, Azure Stack Hub storage account, or GitHub repository reachable by your Azure Stack Hub Linux VM.
Step 3: Provision on Azure Stack Hub virtual machine by using Az PowerShell moduel.
You can create an Ubuntu Server 16.04 LTS virtual machine (VM) by using Azure Stack Hub PowerShell.
Make sure to reference the cloud-init.txt as a part of the -CustomData flag:
$VirtualMachine =Set-AzVMOperatingSystem -VM $VirtualMachine `
-Linux `
-ComputerName "MainComputer" `
-Credential $cred -CustomData "#include https://cloudinitstrg.blob.core.windows.net/strg/cloud-init.txt" Reference:
https://learn.microsoft.com/en-us/azure-stack/operator/azure-stack-linux?