Set-​Azure​Subscription

Creates or changes an Azure subscription.

Syntax

Set-AzureSubscription
   [-Certificate <X509Certificate2>]
   [-Context <AzureStorageContext>]
   [-CurrentStorageAccountName <String>]
   [-Environment <String>]
   [-PassThru]
   [-Profile <AzureSMProfile>]
   [-ResourceManagerEndpoint <String>]
   [-ServiceEndpoint <String>]
   -SubscriptionId <String>
   [<CommonParameters>]
Set-AzureSubscription
   [-Certificate <X509Certificate2>]
   [-Context <AzureStorageContext>]
   [-CurrentStorageAccountName <String>]
   [-Environment <String>]
   [-PassThru]
   [-Profile <AzureSMProfile>]
   [-ResourceManagerEndpoint <String>]
   [-ServiceEndpoint <String>]
   -SubscriptionName <String>
   [<CommonParameters>]
Set-AzureSubscription
   -Certificate <X509Certificate2>
   [-Context <AzureStorageContext>]
   [-CurrentStorageAccountName <String>]
   [-Environment <String>]
   [-PassThru]
   [-Profile <AzureSMProfile>]
   [-ResourceManagerEndpoint <String>]
   [-ServiceEndpoint <String>]
   -SubscriptionId <String>
   -SubscriptionName <String>
   [<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.

Required Parameters

-SubscriptionId
Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-SubscriptionName
Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional Parameters

-Certificate
Type:X509Certificate2
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Context
Type:AzureStorageContext
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-CurrentStorageAccountName
Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters: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 (http://www.microsoft.com/server-cloud/products/windows-azure-pack/default.aspx).

Type:String
Position:Named
Default value:None
Accept pipeline input:False
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
Accept pipeline input:False
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
Accept pipeline input:False
Accept wildcard characters:False
-ResourceManagerEndpoint

Specifies the endpoint for Azure Resource Manager data, including data about resource groups associated with the account. For more information about Azure Resource Manager, see Azure Resource Manager Cmdlets (http://go.microsoft.com/fwlink/?LinkID=394765) and Using Windows PowerShell with Resource Manager (http://go.microsoft.com/fwlink/?LinkID=394767).

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ServiceEndpoint
Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
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. By default, this cmdlet does not return any output.