vagrant-azure
vagrant-azure copied to clipboard
support azure custom-script extension for windows guests
Enhancement proposal:
User Story: As a developer leveraging Windows guests OSes, I want to use vagrant to define an initial script to deliver into the VM, using Azure IaaS VM Custom Script Extension, so that I can perform bootstrap tasks on my VM.
Note: this is scoped to windows guests - should probably open a separate feature for Linux guests.
References: https://blogs.technet.microsoft.com/uktechnet/2016/02/12/create-a-custom-script-extension-for-an-azure-resource-manager-vm-using-powershell/ http://www.powershellmagazine.com/2014/04/30/understanding-azure-custom-script-extension/ https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-windows-extensions-customscript/
Proposed configuration UX (similar to vagrant-aws)
config.vm.provider :azure do |azure, override|
# specify a URI for the custom script file - takes precedence
azure.custom_script_uri = "https://github.com/Azure/vagrant-azure/tree/v2.0/example_box/scripts/bootsrap.ps1"
# alternately - specify the script in a file which we will stage to the storage account of the vm
azure.custom_script = File.read("bootstrap.ps1")
# execution command
azure.custom_script_command = "powershell.exe -ExecutionPolicy Unrestricted -File bootstrap.ps1"
end
Could that be currently done via provisioner shell?
@avishnyakov it might be able to depending on the configuration of your base image.
The Azure provisioning script provides a hook to run some script on the machine via the Azure provisioning fabric. That gets executed even if the box doesn't have an outside connection. For example, if you have an image that isn't setup for WinRM or SSH communication by default and you need to enable prior to executing Ansible provisioning.
Azure provisioning fabric showed to be slow and unreliable sometimes. Seems getting image with WinRM setup in the first place is a better option right now?
In general, should most Azure VMs already have WinRM enabled with a self signed SSL cert? If not I think using an extension is the right thing to do.
I still haven't been able to get any samples to work, I always fail at "Waiting for WinRM to become available"
My other goal is to eventually get https://github.com/PowerShell/Win32-OpenSSH deployed through an extension so that I can use Vagrant's ssh provider instead