Import-AzurePublishSettingsFile

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Import-AzurePublishSettingsFile

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

Syntax

Parameter Set: Default
Import-AzurePublishSettingsFile [[-PublishSettingsFile] <String> ] [-SubscriptionDataFile <String> ] [ <CommonParameters>]

Detailed Description

The Import-AzurePublishSettingsFile cmdlet imports a publish settings file (*.publishsettings) that contains information about your Azure account and saves a subscription data file on your computer. It also stores a management certificate that the Azure PowerShell cmdlets can use to sign into your account on your behalf. When the cmdlet completes, you can manage your Azure accounts in Windows PowerShell.

Using Import-AzurePublishSettingsFile is a lot like logging into your account in Windows PowerShell. To log out, that is, to remove the account from Windows PowerShell, use the Remove-AzureAccount cmdlet.

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

There are two different ways to make your Azure account available to Windows PowerShell. You can use the Add-AzureAccount cmdlet, which uses Azure Active Directory (Azure AD) authentication access tokens, or Import-AzurePublishSettingsFile, which uses a management certificate. For guidance on which method to use, see "How to: Connect to your subscription" (https://azure.microsoft.com/en-us/documentation/articles/install-configure-powershell/\#Connect).

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.

Parameters

-PublishSettingsFile<String>

Specifies the full path and filename of the publish settings file. This should match the file location that you entered when prompted by Get-AzurePublishSettingsFile.

Aliases

none

Required?

false

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-SubscriptionDataFile<String>

Specifies an alternate location for the subscription data file. This parameter is optional. By default, the subscription data file is saved in your roaming user profile.

If you use this parameter to specify an alternate location for the subscription data file, be sure to use the SubscriptionDataFile parameters of cmdlets that access your account. Otherwise, the cmdlets look for your account data in the default location.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see  about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • None

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

Outputs

The output type is the type of the objects that the cmdlet emits.

  • None

    This cmdlet does not generate any output.

Notes

  • A "publish settings file" is an XML file with a .publishsettings file name extension. The file contains an encoded (but not encrypted) 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)

  • Add-AzureAccount (and the Azure AD authentication method) takes precedence over Import-AzurePublishSettings (and the management certificate method). If you use Add-AzureAccount even once on your account, the Azure AD authentication method is used and the management certificate is ignored. To remove the Azure AD token and restore the management certificate method, use the Remove-AzureAccount cmdlet.

  • The Azure PowerShell account and subscription cmdlets get their data from the subscription data file, not from the live Azure account. If you change your account or subscriptions outside of Windows PowerShell, such as by using the Azure Management Portal, run Get-AzurePublishSettingsFile and Import-AzurePublishSettingsFile again to refresh the subscription data file.

Examples

Example 1: Import a publish settings file

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

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

Example 2: Use an alternate subscription data file

This command imports the "C:\Temp\MyAccount.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.

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

Add-AzureAccount

Get-AzurePublishSettingsFile

Remove-AzureAccount

How to Install and Configure Azure PowerShell