-
Notifications
You must be signed in to change notification settings - Fork 40
[Enhancement] Allow for cloud-hosted userdata file #43
Description
Issue: When using a custom userdata yaml file hosted on a public web server, the -CustomUserDataYamlFile does not appear to process the URL as a valid file location.
Use Case: We would like to host the custom userdata files centrally (e.g. GitHub) for collaboration and version control purposes.
Examples Usage:
This specific example attempts to leverage GitHub Gists:
PowerShell -ExecutionPolicy Bypass -Command "& 'C:\Program Files\WindowsPowerShell\Scripts\hyperv-vm-provisioning\hyperv-vm-provisioning-master\New-HyperVCloudImageVM.ps1' -VMProcessorCount 2 -VMMemoryStartupBytes 2GB -VHDSizeBytes 60GB -VirtualSwitchName 'ConvergedSwitch' -VMVlanID '70' -VMName 'ubuntu-test' -ImageVersion '24.04' -VMGeneration 2 -KeyboardLayout en -VMMachine_StoragePath 'C:\ClusterStorage\S2D\Zane\Virtual Machines' -CustomUserDataYamlFile 'https://gist.githubusercontent.com/zanewgray/9a4cbe6904e3381b16b728b67f00056b/raw/test-vm.yaml' -Verbose"
Observed Behavior:
Formatting the CustomUserDataYamlFile location as a web URL versus a local URI appears to cause the userdata to be ignored, as the VM is still built, but without the custom userdata contents.
Running the script in -Verbose mode does not provide an indication that an error has occurred.
Hosting the same userdata yaml file locally on the Hyper-V cluster and adjusting the -CustomUserDataYamlFile parameter works as expected (userdata file is valid).
The Hyper-V servers within the cluster are able to curl the userdata URL (connectivity to the hosting site does not appear to be the issue).
Expected Behavior:
The script downloads the hosted userdata yaml file, and processes it in the same manner as a locally hosted userdata yaml file.