Launching Azure VM After Starting With PowerShell

So this morning I decided I was going to run through this blog post on understanding query plans http://sqlmag.com/t-sql/understanding-query-plans. I logged into my Azure Portal to check my balance and clicked start on the machine and then immediately clicked connect.

D’oh

image

Of course the RDP session wouldn’t open as the machine was not up so I went and made a coffee. Whilst doing that I thought of a way of doing it with PowerShell

image

A little Do Until loop on the PowerState Property 🙂

image

Of course if I was doing it all though PowerShell I would have done this

image

Please feel free to comment on this post. All comments are moderated first before appearing on the site