Azure PowerShell Getting Started Authenticate with Certificate
There are two ways you can authenticate to Windows Azure. You can store a username and password or you can use a certificate. If you want to authenticate with a password see How to: Connect to your subscription My preference is to use a certificate.
Certificate Authentication
The Windows Azure PowerShell module includes cmdlets that help you download and import the certificate.
- The Get-AzurePublishSettingsFile cmdlet opens a web page on the Windows Azure Management Portal, from which you can download the subscription information. The information is contained in a .publishsettings file.
- The Import-AzurePublishSettingsFile imports the .publishsettings file for use by the module. This file includes a management certificate that has security credentials.
Important We recommend that you delete the publishing profile that you downloaded using Get-AzurePublishSettingsFile after you import those settings. Because the management certificate includes security credentials, it should not be accessed by unauthorized users. If you need information about your subscriptions, you can get it from the Windows Azure Management Portal or the Microsoft Online Services Customer Portal.
Download and install the Windows Azure PowerShell Tools. Scroll down to Command-line Tools, under Windows PowerShell; click Install. Several components will be installed, you can take the defaults, accept the license agreement and let it go. Once done, click Finish. The Web Platform Installer will remain open allowing you to install additional components. You do not need any of them. Just click Exit
From a web browser: Sign in to the Windows Azure Management Portal (https://manage.windowsazure.com) using the credentials for your Windows Azure account.
Open the Windows Azure PowerShell console: On a computer running at least Windows 8 or Windows Server 2012, you can use the built-in Search. From the Start screen, begin typing power. This produces a scoped list of apps that includes Windows PowerShell and once installed, Windows Azure PowerShell. Click Windows Azure PowerShell to open the console window. (To pin the app to the Start screen, right-click the icon then select pin to start.)
In your PowerShell window Type the following command:
Get-AzurePublishSettingsFile
When prompted, download and save the publishing profile and note the path and name of the .publishsettings file. This information is required when you run the Import-AzurePublishSettingsFile cmdlet to import the settings. The default location and file name format is:C:\Users\<UserProfile>\Downloads\[MySubscription-…]-downloadDate-credentials.publishsettings
Type a command similar to the following, substituting your Windows account name and the path and file name for the placholders:
Import-AzurePublishSettingsFile C:\Users\<UserProfile>\Downloads\[MySubscription-…]-downloadDate-credentials.publishsettingsExample:
Import-AzurePublishSettingsFile C:\Users\CampAdmin\Downloads\BizSpark-Pay-As-You-Go-1-28-2014-credentials.publishsettings
Delete the .pushlishsettings file it is no longer needed and should not be left around to get compromised.
If you have multiple accounts you can simply login to Windows Azure with the other account credentials (step 1 above) then repeat steps 4-7 for the other accounts.
Note: If you are added to other subscriptions as a co-administrator after you import your publish settings, you’ll need to repeat this process to download a new .publishsettings file, and then import those settings. For information about adding co-administrators to help manage services for a subscription, see Add and Remove Co-Administrators for Your Windows Azure Subscriptions.
View account and subscription details
You can have multiple accounts and subscriptions available for use by Windows Azure PowerShell.
To see the available accounts, type:
Get-AzureAccount
To see subscription information, type:
Get-AzureSubscription
Getting Help
These resources provide help for specific cmdlets:
- From within the console, you can use the built-in Help system. The Get-Help cmdlet provides access to this system. The following table provides some examples of commands you can use to get Help. You can get more information from within the console by typing help.
Command Result help Describes how to use the Help system.Note: The description includes some information about Help files that does not apply to the Windows Azure module. Specifically, Help files are installed when the module is installed. They are not available for download separately. help azure Lists all cmdlets in the Windows Azure PowerShell module. help <language>-dev Lists cmdlets for developing and managing applications in a specific language. For example, help node-dev, help php-dev, or help python-dev. help <cmdlet> Displays help about a Windows PowerShell cmdlet. help <cmdlet> -parameter * Displays parameter definitions for a cmdlet. For example, help get-azuresubscription -parameter * help <cmdlet> -examples Displays the syntax and description of example commands for a cmdlet. help <cmdlet> -full Displays technical requirements for a cmdlet. - Reference information about the cmdlets in the Windows Azure PowerShell module is also available in the Windows Azure library. For information, see Windows Azure Cmdlet Reference.
For help from the community, try these popular forums:
Additional Resources
These are some of the resources available that you can use to learn to use Windows Azure and Windows PowerShell.
- To provide feedback about the cmdlets, report issues, or access the source code, see Windows Azure PowerShell code repository.
- Windows Azure Scripting Center
- To learn about the Windows PowerShell command line and scripting environment, see the TechNet Script Center.
- For information about installing, learning, using, and customizing Windows PowerShell, see Scripting with Windows PowerShell.
- For information about what scripts are and how to run them in Windows PowerShell, see Running Scripts. This article includes basic information about creating scripts and configuring your computer to run scripts.
- For information about cmdlets for Windows Azure AD, see Manage Windows Azure AD using Windows PowerShell.