PowerTip: Connect to Azure to Leverage PowerShell Cmdlets


Summary: Learn how to use the Microsoft Azure cmdlets to connect to an Azure subscription.

Hey, Scripting Guy! Question I downloaded the Azure PowerShell cmdlets, and I when I run them, they produce an
           error. How do I authenticate to Microsoft Azure from the cmdlets?

Hey, Scripting Guy! Answer Use a combination of two cmdlets (Get-AzurePublishSettingsFile and Import-AzurePublishSettingsFile)
           your first time:

Get-AzurePublishSettingsFile

This prompts for authentication to Azure and prompts you to save a file on your local drive.
The file extension is .publishsettings.

Then run:

Import-AzurePublishSettingsFile filename.publishsettings

Now you can access your default Azure subscription from Windows PowerShell.

Note Please store this file in a secure location because it provides authentication to Azure.

Comments (0)

Skip to main content