Edit

Share via


Set-AzureSubscription

Changes 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

UpdateSubscriptionByIdParameterSetName (Default)

Set-AzureSubscription
    -SubscriptionId <String>
    [-Certificate <X509Certificate2>]
    [-ServiceEndpoint <String>]
    [-ResourceManagerEndpoint <String>]
    [-CurrentStorageAccountName <String>]
    [-Context <AzureStorageContext>]
    [-Environment <String>]
    [-PassThru]
    [-Profile <AzureSMProfile>]
    [<CommonParameters>]

UpdateSubscriptionByNameParameterSetName

Set-AzureSubscription
    -SubscriptionName <String>
    [-Certificate <X509Certificate2>]
    [-ServiceEndpoint <String>]
    [-ResourceManagerEndpoint <String>]
    [-CurrentStorageAccountName <String>]
    [-Context <AzureStorageContext>]
    [-Environment <String>]
    [-PassThru]
    [-Profile <AzureSMProfile>]
    [<CommonParameters>]

AddSubscriptionParameterSetName

Set-AzureSubscription
    -SubscriptionName <String>
    -SubscriptionId <String>
    -Certificate <X509Certificate2>
    [-ServiceEndpoint <String>]
    [-ResourceManagerEndpoint <String>]
    [-CurrentStorageAccountName <String>]
    [-Context <AzureStorageContext>]
    [-Environment <String>]
    [-PassThru]
    [-Profile <AzureSMProfile>]
    [<CommonParameters>]

Description

The Set-AzureSubscription cmdlet establishes and changes the properties of an Azure subscription object. You can use this cmdlet to work in an Azure subscription that is not your default subscription or to change your current storage account. For information about current and default subscriptions, see the Select-AzureSubscription cmdlet.

This cmdlet operates on an Azure subscription object, not your actual Azure subscription. To create and provision an Azure subscription, visit the Azure Portal (https://azure.microsoft.com/).

This cmdlet changes the data in the subscription data file that you create when you use the Add-AzureAccount or Import-AzurePublishSettingsFile cmdlet to add an Azure account to Windows PowerShell.

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: Change an existing subscription1

C:\PS> $thumbprint = <Thumbprint-2>
C:\PS> $differentCert = Get-Item cert:\\CurrentUser\My\$thumbprint
C:\PS> Set-AzureSubscription -SubscriptionName ContosoEngineering -Certificate $differentCert

This example changes the certificate for the subscription named ContosoEngineering.

Example 2: Change the service endpoint

C:\PS> Set-AzureSubscription -SubscriptionName ContosoEngineering -ServiceEndpoint "https://management.core.contoso.com"

This command adds or changes a custom service endpoint for the ContosoEngineering subscription.

Example 3: Clear property values

C:\PS> Set-AzureSubscription -SubscriptionName ContosoEngineering -Certificate $null -ResourceManagerEndpoint $Null

This command sets the values of the Certificate and ResourceManagerEndpoint properties to null ($Null). This clears the values of those properties without changing other settings.

Example 4: Use an alternate subscription data file

C:\PS> Set-AzureSubscription -SubscriptionName ContosoFinance -SubscriptionDataFile C:\Azure\SubscriptionData.xml -CurrentStorageAccount ContosoStorage01

This command changes the current storage account of the ContosoFinance subscription to ContosoStorage01. The command uses the SubscriptionDataFile parameter to change the data in the C:\Azure\SubscriptionData.xml subscription data file. By default, Set-AzureSubscription uses the default subscription data file in your roaming user profile.

Parameters

-Certificate

The Set-AzureSubscription cmdlet establishes and changes the properties of an Azure subscription object. You can use this cmdlet to work in an Azure subscription that is not your default subscription or to change your current storage account. For information about current and default subscriptions, see the Select-AzureSubscription cmdlet.

This cmdlet operates on an Azure subscription object, not your actual Azure subscription. To create and provision an Azure subscription, visit the Azure Portal (https://azure.microsoft.com/).

This cmdlet changes the data in the subscription data file that you create when you use the Add-AzureAccount or Import-AzurePublishSettingsFile cmdlet to add an Azure account to Windows PowerShell.

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.

Parameter properties

Type:X509Certificate2
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

UpdateSubscriptionByIdParameterSetName
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
UpdateSubscriptionByNameParameterSetName
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Context

The Set-AzureSubscription cmdlet establishes and changes the properties of an Azure subscription object. You can use this cmdlet to work in an Azure subscription that is not your default subscription or to change your current storage account. For information about current and default subscriptions, see the Select-AzureSubscription cmdlet.

This cmdlet operates on an Azure subscription object, not your actual Azure subscription. To create and provision an Azure subscription, visit the Azure Portal (https://azure.microsoft.com/).

This cmdlet changes the data in the subscription data file that you create when you use the Add-AzureAccount or Import-AzurePublishSettingsFile cmdlet to add an Azure account to Windows PowerShell.

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.

Parameter properties

Type:AzureStorageContext
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-CurrentStorageAccountName

The Set-AzureSubscription cmdlet establishes and changes the properties of an Azure subscription object. You can use this cmdlet to work in an Azure subscription that is not your default subscription or to change your current storage account. For information about current and default subscriptions, see the Select-AzureSubscription cmdlet.

This cmdlet operates on an Azure subscription object, not your actual Azure subscription. To create and provision an Azure subscription, visit the Azure Portal (https://azure.microsoft.com/).

This cmdlet changes the data in the subscription data file that you create when you use the Add-AzureAccount or Import-AzurePublishSettingsFile cmdlet to add an Azure account to Windows PowerShell.

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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PassThru

Returns $True if the command succeeds and $False if it fails.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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.

Parameter properties

Type:AzureSMProfile
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ResourceManagerEndpoint

Specifies the endpoint for Azure Resource Manager data, including data about resource groups associated with the account.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ServiceEndpoint

The Set-AzureSubscription cmdlet establishes and changes the properties of an Azure subscription object. You can use this cmdlet to work in an Azure subscription that is not your default subscription or to change your current storage account. For information about current and default subscriptions, see the Select-AzureSubscription cmdlet.

This cmdlet operates on an Azure subscription object, not your actual Azure subscription. To create and provision an Azure subscription, visit the Azure Portal (https://azure.microsoft.com/).

This cmdlet changes the data in the subscription data file that you create when you use the Add-AzureAccount or Import-AzurePublishSettingsFile cmdlet to add an Azure account to Windows PowerShell.

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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-SubscriptionId

The Set-AzureSubscription cmdlet establishes and changes the properties of an Azure subscription object. You can use this cmdlet to work in an Azure subscription that is not your default subscription or to change your current storage account. For information about current and default subscriptions, see the Select-AzureSubscription cmdlet.

This cmdlet operates on an Azure subscription object, not your actual Azure subscription. To create and provision an Azure subscription, visit the Azure Portal (https://azure.microsoft.com/).

This cmdlet changes the data in the subscription data file that you create when you use the Add-AzureAccount or Import-AzurePublishSettingsFile cmdlet to add an Azure account to Windows PowerShell.

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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

UpdateSubscriptionByIdParameterSetName
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
AddSubscriptionParameterSetName
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-SubscriptionName

The Set-AzureSubscription cmdlet establishes and changes the properties of an Azure subscription object. You can use this cmdlet to work in an Azure subscription that is not your default subscription or to change your current storage account. For information about current and default subscriptions, see the Select-AzureSubscription cmdlet.

This cmdlet operates on an Azure subscription object, not your actual Azure subscription. To create and provision an Azure subscription, visit the Azure Portal (https://azure.microsoft.com/).

This cmdlet changes the data in the subscription data file that you create when you use the Add-AzureAccount or Import-AzurePublishSettingsFile cmdlet to add an Azure account to Windows PowerShell.

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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

UpdateSubscriptionByNameParameterSetName
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
AddSubscriptionParameterSetName
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

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. By default, this cmdlet does not return any output.