In order to do anything advanced in Windows Azure you will need to use Microsoft’s Powershell.
This includes things such as managing multiple access keys for virtual networks or simply assigning a static IP address to a VM.
You will need to download and install “Microsoft Azure PowerShell” CMDLETS. Although once you have installed the CMDLETS you can access the commands from any powershell console, we recommend launching the dedicated Azure Powershell console this will limit the commands to azure specific commands.
The CMDLETS and console can be downloaded and installed via the Web Platform Installer
Solution 1 (The AD Method)
In this solution you simply authenticate to Azure using PowerShell via a single PowerShell command.
- Open “Microsoft Azure PowerShell” console in an elevated state.
- Type the following command: Get-AzurePublishSettingsFile.
- This will prompt you to enter login details for your Azure subscription account.
Once you have logged in you have successfully connected PowerShell to Azure.
Solution 2 (Certificate Method)
This method requires you create a “publishSettingFile” from the Azure management portal (using PowerShell) then import that file into PowerShell.
- Sign in to account on the Azure Management Portal.
- Open the Azure PowerShell console in an elevated state.
- Type the following command:Get-AzurePublishSettingsFile
- If you are logged into you azure account a download will launch in your web browser. To avoid issues when multiple browsers are installed. make sure you log into Azure portal using your “Default” web browser.
- Save the publishing profile file.
- Type the following command substituting the path for the location of where you saved the publishing profile file:Import-AzurePublishSettingsFile C:\Users\<UserProfile>\Downloads\<SubscriptionName>-credentials.publishsettings
Confirm account and subscriptions available to PowerShell
Command to list all accounts and subscriptions available.
Set Default Azure subscription
Use the following command to set a default Azure subscription
Select-AzureSubscription -default [subscriptionName]
Substitute [subscriptionName] for the name of a subscription you wish to make default. you can get the “subscriptionName” value by using the command:
Set the current working subscription
If you have multiple subscriptions you can switch between them using the following command:
Select-AzureSubscription -current [subscriptionName]
Substitute [subscriptionName] for the name of a subscription you wish to set as current. You can get the “subscriptionName” value by using the command: