I'm not entirely sure where you've gotten stuck or what specifically you're trying to accomplish, but I'll give it a shot anyway...
Remote Desktop
Just for kicks, let's start with remoting in to the VM. I've spun up a VM using the Azure portal. The portal asks for a username and password to be specified. Obviously, the simplest way to remote in would be using the 'Connect' button after selecting an instance of your VM:
From there you could input your credentials, log in to the VM, and open up PowerShell.
That's a bad way of taking care of it, but it is the most straightforward.
PowerShell Remoting
Starting a remote PowerShell session could be a little quicker and involve less GUI. For a quick one-liner, try this:
Enter-PSSession -ConnectionUri (Get-AzureWinRMUri) -SessionOption (New-PSSessionOption -SkipCACheck) -Credential (Get-Credential)
You'll be prompted for the service name (in my case, rtannerf) and credentials. I opted to ignore the self-signed certificate rather than importing it.
You can also use Invoke-Command
:
Invoke-Command –ConnectionUri $uri –Credential $cred –ScriptBlock { "do u liek mah hat!?" | Out-File C:\hello.txt }
More on this here. You could expand upon this and use PowerShell to both deploy your VMs and run scripts against them once deployment is finished. Might want to take a look at the Azure Management cmdlet reference page.
This approach seems a little clunky to me, but if you need to kick off just a few VMs it might work out fine for you.
Deploying via Images
If you need a heavier touch than is appropriate for Invoke-Command
, you may want to look in to deploying images. Short version is you'll prepare an image the way you would just about any other Windows image, upload it to a storage account in Azure, and use the management console to add the VHD to your images. There's a short guide here.
It sounds to me like this will be the way you want to approach your problem. You could use startup scripts and whatnot to get the machine in to the state you want, but it's probably better to cut to the chase and simply deploy an image that's configured exactly how you need it.