I am going to assume your user is admin or co-admin on Azure, or you at least have credentials for such a user. I'm also going to assume you've downloaded PowerShell for Azure and installed it.
Start by opening PowerShell for Azure.
Run this command to authenticate for the next 12 hours:
1 | Add -AzureAccount |
You will be prompted for credentials, and you need to provide the same credentials you would be using if you were authenticating against Azure.
Use this command to Start demos:
1 2 | Get -AzureService | Where-Object {$_.Label -match "AX2012R3" } | ` Foreach-Object { Start -AzureVM -ServiceName $_.ServiceName -Name "*" –Verbose } |
If you change the filter part ("AX2012R3"), you could control a subset of your services based on some naming pattern or convention.
Use this command to Stop the demos:
1 2 | Get -AzureService | Where-Object {$_.Label -match "AX2012R3" } | ` Foreach-Object { Stop -AzureVM -ServiceName $_.ServiceName -Name "*" –Force –Verbose } |
Isn't that cool?
Now for the bonus part. When you create these demos, you access them through RDP-files. Here is a PowerShell command to download the RDP-files and save them to disk:
1 2 3 4 | Get -AzureService | Where-Object {$_.Label -match "AX2012R3" } | ` Get -AzureRole -InstanceDetails | Where-Object {$_.RoleName -Match "DEMO" } | ` Foreach-Object { Get -AzureRemoteDesktopFile -ServiceName $_.ServiceName -Name $_.InstanceName ` -LocalPath ( Join-Path "C:\Temp" ($_.InstanceName + ".rdp" )) } |
Pretty neat, ey? :-)