Last week Microsoft announced several fantastic updates to Windows Azure.
- Windows Azure: Backup Services Release, Hyper-V Recovery Manager, VM Enhancements, Enhanced Enterprise Management Support
- Windows Azure: Announcing release of Windows Azure SDK 2.2 (with lots of goodies)
One of the updates I’m really excited about is the new Windows Azure Active Directory authentication support in PowerShell. Previously to allow the Windows Azure PowerShell cmdlets to authenticate with Windows Azure, you’re only choice was via a management certificate. There were two options to get that certificate:
- Download a .publishsettings file and import the file (Get-AzurePublishSettingsFile and Import-AzurePublishSettingsFile)
- Create a cert yourself and configure it in PowerShell (see my previous post)
While not a bad way to go, they came with the overhead of deal with management certs.
Configuring Windows Azure Active Directory authentication in PowerShell
1) Get-AzureAccount – To start with, let’s run the Get-AzureAccount cmdlet to see what accounts are already configured. Since this is my first time, there shouldn’t be any listed.
2) Add-AzureAccount – this will open a browser dialog prompting me to authenticate with the Microsoft Account (formerly Live ID) that I want to use for managing my Windows Azure subscriptions. For me, this one Microsoft Account is a co-admin on multiple subscriptions, and just happens to be a user in multiple Windows Azure AD tenants.
3) That’s pretty much it. If I try to list all my subscriptions, I’ll can easily do that with Get-AzureSubscription. Notice how there is a “ActiveDirectoryUserId” field.
What did this actually do?
If I browse to my user profile directory (C:\Users\<username>\AppData\Roaming\Windows Azure Powershell), I can view the WindowsAzureProfile.xml file. This is the file that was updated as a result of the Add-AzureAccount cmdlet. It is basically what gets dumped when executing the Get-AzureSubscription cmdlet.
As noted here, the Windows Azure AD credentials available to PowerShell are good only for 12 hours.
See the most recent Windows Azure PowerShell change log at https://raw.github.com/WindowsAzure/azure-sdk-tools/master/ChangeLog.txt.