Get-AzurePublishSettingsFile

Downloads the publish settings file for an Azure subscription.

Note

The cmdlets referenced in this documentation are for managing legacy Azure resources that use Azure Service Manager (ASM) APIs. This legacy PowerShell module isn't recommended when creating new resources since ASM is scheduled for retirement. For more information, see Azure Service Manager retirement.

The Az PowerShell module is the recommended PowerShell module for managing Azure Resource Manager (ARM) resources with PowerShell.

Syntax

Get-AzurePublishSettingsFile
   [-Environment <String>]
   [-Realm <String>]
   [-PassThru]
   [-Profile <AzureSMProfile>]
   [<CommonParameters>]

Description

The Get-AzurePublishSettingsFile cmdlet downloads a publish settings file for a subscription in your account. When the command completes, you can use the Import-PublishSettingsFile cmdlet to make the settings in the file available to Windows PowerShell.

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.

When you run Get-AzurePublishSettingsFile, it opens your default browser and prompts you to sign into your Azure account, select a subscription, and select a file system location for the publish settings file. Then, it downloads the publish settings file for your subscription into the file that you selected.

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.

Security Note: Publish settings files contains credentials that are used to administer your Azure subscriptions and services. If malicious users access your publish settings file, they can 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.

This topic describes the cmdlet in the 0.8.10 version of the Microsoft Azure PowerShell module. To get the version of the module you're using, in the Azure PowerShell console, type (Get-Module -Name Azure).Version.

Examples

Example 1: Download a publish settings file

PS C:\> Get-AzurePublishSettingsFile

This command opens your default browser, connects to your Windows Azure account, and then downloads the .publishsettings file for your account.

Example 2: Specify a realm

PS C:\> Get-AzurePublishSettingsFile -Realm contoso.com -Passthru

This command downloads the publish settings file for an account in the contoso.com domain. Use a command with the Realm parameter when you sign into Azure with an organizational account, instead of a Microsoft account.

Parameters

-Environment

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.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-PassThru

Returns $True if the command succeeds and $False if it fails. By default, this cmdlet does not return any output.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Profile

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

Type:AzureSMProfile
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Realm

Specifies the organization in an organizational ID. For example, if you sign into Azure as admin@contoso.com, the value of the Realm parameter is contoso.com. Use this parameter when you use an organizational ID to sign into the Azure portal. This parameter is not required when you use a Microsoft account, such as an outlook.com or live.com account.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

Inputs

None

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

Outputs

None or System.Boolean

When you use the PassThru parameter, this cmdlet returns a Boolean value. Otherwise, this cmdlet does not return any output