When dealing with a group of Azure IaaS VM's, starting/restarting/stopping them can require a lot of button clicking and waiting if you use the Manage Azure website. PowerShell is a much easier way to manage Azure boxes, and can be done from your work machine with an internet connection, without the use of any VPN or remoting technology.
You can start managing your VM's in Azure IaaS with these few simple steps.
4.Before using anything with the Azure PowerShell module, you'll need to get the Azure subscription object using the Get-AzureSubscription cmdlet. See an example of this below.
You may have to repeat steps 2, 3, and 4 when starting a new Azure PowerShell session.
One of the first easy things you can do with your Azure VM's is starting and stopping a group of VM's together. The script will run sequentially to start or stop these VM's. If you're like me, you've got a cluster of servers in a SQL 2012 AlwaysOn Availability Group.
You will need to change a few things in these scripts to suit your purposes:
Change "AzureAccount@hotmail.com" to your Azure account, the same one you associated with the PowerShell Azure module earlier. For MSDN-based Azure subscriptions like mine, this address was my Hotmail email address.
Change "Visual Studio Premium with MSDN" to the name of your Azure Subscription. This was the name my MSDN-based account was given by default.
Populate the $vms variable with a list of Azure VM's in the cluster you're looking to start/stop as a group, replacing "yourVMName-dom" and so forth.
Like me, I think you'll find that using PowerShell to manage your Azure IaaS VM's is much easier and faster, while also providing yet another window into the remarkable versatile world of PowerShell scripting.
Big thanks and credit for the assist on this blog post to Cody Gros, SharePoint Solutions Architect and my coworker at Sparkhound.
Information and material in our blog posts are provided "as is" with no warranties either expressed or implied. Each post is an individual expression of our Sparkies. Should you identify any such content that is harmful, malicious, sensitive or unnecessary, please contact firstname.lastname@example.org