John Yassa's Blog

Home » Microsoft Azure » How to install and configure Azure PowerShell

How to install and configure Azure PowerShell

You can use Windows PowerShell to perform a variety of tasks in Azure, either interactively at a command prompt or automatically through scripts. Azure PowerShell is a module that provides cmdlets to manage Azure through Windows PowerShell. You can use the cmdlets to create, test, deploy, and manage solutions and services delivered through the Azure platform. In most cases, you can use the cmdlets to perform the same tasks that you can perform through the Azure Management Portal. For example, you can create and configure cloud services, virtual machines, virtual networks, and websites.

Prerequisites for using Azure PowerShell

  • Azure is a subscription-based platform. This means that a subscription is required to use the platform.
  • The Azure PowerShell modules require Microsoft .NET Framework 4.5

When you install the module, the installer checks your system for the required software and installs all dependencies, such as the correct version of Windows PowerShell and .NET Framework.

How to: Install Azure PowerShell

You can download and install the Azure PowerShell modules by running the Microsoft Web Platform Installer. When prompted, click Run. The Web Platform Installer installs the Azure PowerShell modules and all dependencies. Follow the prompts to complete the installation.

The method you use to open either console depends on the version of Windows you’re running:

  • 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 returns a scoped list of apps that includes Windows PowerShell and Azure PowerShell. To open the console, click either app. (To pin the app to the Start screen, right-click the icon.)
  • On a computer running a version earlier than Windows 8 or Windows Server 2012, use the Start menu. From the Start menu, click All Programs, click Azure, and then click Azure PowerShell.

How to: Connect to your subscription

There are two ways to provide your subscription information to Windows PowerShell. You can use a management certificate that contains the information or you can sign in to Azure using your Microsoft account or an organizational account. When you sign in, Azure Active Directory (Azure AD) authenticates the credentials and returns an access token that lets Azure PowerShell manage your account.

To help you choose the authentication method that’s appropriate for your needs, consider the following:

  • Azure AD is the recommended authentication method since it makes it easier to manage access to a subscription. With the update in version 0.8.6, it enables automation scenario with Azure AD authentication as well if Organizational account is used. It works with Azure Resource Manager API as well.
  • When you use the certificate method, the subscription information is available as long as the subscription and the certificate are valid. However, this method makes it harder to manage access to a shared subscription, such as when more than one person is authorized to access the account. Also, Azure Resource Manager API doesn’t accept certificate authentication.
  1. Use the Azure AD method

    1. Open the Azure PowerShell console
    2. Type the following command:Add-AzureAccount
    3. In the window, type the email address and password associated with your account.
    4. Azure authenticates and saves the credential information, and then closes the window.
    5. Staring from 0.8.6, if you have an organizational account, you can type the following command to bypass the pop up window. This will pop up the standard Windows PowerShell credential window for you to enter your organizational account user name and password.
      $cred = Get-Credential
      Add-AzureAccount -Credential $cred
    6. If you are using this in an automation script and want to avoid any pop up window, use the following snippet
      $userName = "<your organizational account user name>"
      $securePassword = ConvertTo-SecureString -String "<your organizational account password>" -AsPlainText -Force
      $cred = New-Object System.Management.Automation.PSCredential($userName, $securePassword)
      Add-AzureAccount -Credential $cred 

  2. Use the certificate method

    1. Sign in to the Azure Management Portal using the credentials for your Azure account.
    2. Open the Azure PowerShell console
    3. Type the following command:Get-AzurePublishSettingsFile
    4. 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>\\Download\\[*MySubscription*-...]-*downloadDate*-credentials.publishsettings
    5. Type a command similar to the following, substituting your Windows account name and the path and file name for the placeholders:Import-AzurePublishSettingsFile C:\Users\<UserProfile>\Downloads\<SubscriptionName>-credentials.publishsettings


View account and subscription details

To get the available Azure accounts, type:


To get your Azure subscriptions, type:


Source:  How to install and configure Azure PowerShell


  1. […] To assign a static IP to the VM , you have first to Install Azure Powershell […]

  2. […] Source: How to install and configure Azure PowerShell […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: