Azure is in the cloud, PowerShell is on my machine, between the two lie vast oceans and dragons.
What is a developer to do, to use PowerShell to work with Azure?
Here is what you do,
Install Windows Azure PowerShell Start WebPI, search for “Windows Azure PowerShell” – choose to add and install it.
Run Windows Azure PowerShell This is easy, click on start (or whatever the hell you do in Windows 2012), and search for Windows Azure PowerShell.
Connect your subscription
- Run Get-AzurePublishSettingsFile, which will launch your browser, ask you to login, and download a .publishsettings file. Save this somewhere because you’re going to need it in the next step.
- Run Import-AzurePublishSettingsFile, and pass in the .publishsettings file you just downloaded. Read important note about the publish settings file.
- You should be all set now, run Get-AzureSubscription to verify that your susbcription is loaded.
You can now merrily run Azure commandlets.
Sometimes (quite often), you may have more than one subscription associated with your live id. In that scenario, you can use following commandlets
- Set-AzureSubscription commandlet to specify the default susbcription.
- Select-AzureSubscription commandlet to select a different one.
- Remove-Subscription to .. I’ll let you guess this one.
Important note about the publish settings file,
There are 2 things you should keep in mind about the publish settings file.
- First, delete this file soon as you have used it because it contains enough security info in it, that if I gained access to your azure subscription, I could party at your expense.
- Don’t get in the bad habit of downloading the publish settings file all the time. Every time you download it, it generates and stores a cert and you have a limit of 10