Imports a publish settings file that lets you manage your Azure accounts in Windows PowerShell.


      [-Environment <String>]
      [-Profile <AzureSMProfile>]
      -PublishSettingsFile <String>


The Import-AzurePublishSettingsFile cmdlet imports a publish settings file (*.publishsettings) that contains information about your Azure accounts and saves a subscription data file on your computer. When the cmdlet completes, you can manage your Azure accounts in Windows PowerShell.

Before running Import-AzurePublishSettingsFile, run Get-AzurePublishSettingsFile, which downloads and saves the publish settings file so you can import it.

To make your Azure account available to Windows PowerShell, you can use a publish settings file or the Add-AzureAccount cmdlet. Publish settings files let you prepare the session in advance so you can run scripts and background jobs unattended. However, not all services support publish settings files. For example, the AzureResourceManager module does not support publish settings files.

Security Note: Publish settings files contain a management certificate that is encoded, but not encrypted. If malicious users access your publish settings file, they might be able to edit, create, and delete your Azure services. As a security best practice, save the file to a location in your Downloads or Documents folder and then delete it after using Import-AzurePublishSettingsFile cmdlet to import the settings.


Example 1: Import a file

PS C:\> Import-AzurePublishSettingsFile -PublishSettingsFile C:\Temp\MyAccount.publishsettings

This command imports the "C:\Temp\MyAccount.publishsettings" file.

Example 2: Import a file and save subscription data

PS C:\> Import-AzurePublishSettingsFile -PublishSettingsFile C:\Temp\MyAccount.publishsettings -SubscriptionDataFile C:\Subs\Subscriptions.xml

This command imports the "C:\Temp\MyAccountName-date-credentials.publishsettings" file and then saves the subscription data file in C:\Subs\Subscriptions.xml.

When you use the SubscriptionDataFile parameter to save your subscription data file in an alternate location, be sure to use the SubscriptionDataFile parameter of cmdlets that use subscription data file, such as Select-AzureSubscription and Remove-AzureAccount.

Required Parameters

Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional Parameters


Specifies an Azure environment.

An Azure environment an independent deployment of Microsoft Azure, such as AzureCloud for global Azure and AzureChinaCloud for Azure operated by 21Vianet in China. You can also create on-premises Azure environments by using Azure Pack and the WAPack cmdlets. For more information, see Azure Pack (

Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

Default value:None
Accept pipeline input:False
Accept wildcard characters:False



You can pipe input to this cmdlet by property name, but not by value.



This cmdlet does not generate any output.


  • A "publish settings file" is an XML file with a .publishsettings file name extension. The file contains an encoded certificate that provides management credentials for your Azure subscriptions. After you import this file, delete it to avoid security risks.
  • A "subscription data file" is an XML file that can be saved on your computer safely. By default, it's saved in your roaming user profile ($home/AppData/Roaming).