I am trying to setup Azure VM's using Powershell but i wish to do it all remotely with no logging into the machine. I have been able to spin up the VM using commands like New-AzVM but now i need to run specific powershell commands e.g. Enable-WindowsOptionalFeature -Online -FeatureName IIS-ManagementConsole
I can see you can run remote scripts using the following but as this is a brand new server there are no scripts on that box to execute.
Invoke-AzVMRunCommand -ResourceGroupName $ResourceGroupName -Name $VmName -CommandId 'RunPowerShellScript' -ScriptPath '<pathToScript>' -Parameter @{"arg1" = "var1";"arg2" = "var2"}
How can i copy scripts to the server remotely so i can use the above command, or run commands without the need for a script file.