Search code examples
powershellazurevirtual-machinepowershell-remoting

Setup new Azure Virtual machine without external tools


I'd like to automate setup of virtual machine in Azure.

  1. There are some Azure Commandlets to create new VM, setup open ports for PowerShell remoting etc.
  2. I found script how to download certificate used for remoting (http://michaelwasham.com/windows-azure-powershell-reference-guide/introduction-remote-powershell-with-windows-azure/ ), so it's possible to connect to the machine through New-PSSession -ComputerName $computer -Credential $creds -UseSSL and invoke some commands.
  3. Then I need to copy some application to the virtual machine, register that in system and run.

How can I copy the file to remote machine? There are no azure command lets to use, so I can't copy the app from blob.

Possible workarounds - install chocolatey remotely, download some command line app that fetches the file from blob etc.. Is there any better way? Even AzCopy must be uploaded to the server somehow.

PModem looked nice when I saw it some years ago, but isn't there some more official approach?

I don't won't to use any other public machine reachable from the Azure VM that can be used as file server from which the remote machine can download the files.

Also I don't want to have some prepared VHD sitting in Azure as image for new virtual that has all needed preinstalled. The app might change a lot, so this doesn't scale well.


Solution

  • You could create an Azure Files storage account. This is a kind of storage that you can mount on your VM with net use as a network drive. Then all you have to do is upload files to this storage from your dev machine (where you can use Azure cmdlets and other tools) and access these files through mounted drive on your VM.

    This way you rely only on a storage service, but you don't have to use any public machine.