Set-AzureSubscription

Updated: May 12, 2014

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

Set-AzureSubscription

Creates or changes an Azure subscription

Syntax

Parameter Set: CommonSettings
Set-AzureSubscription [-SubscriptionName] <String> [-Certificate <X509Certificate2> ] [-CurrentStorageAccountName <String> ] [-PassThru] [-ResourceManagerEndpoint <String> ] [-ServiceEndpoint <String> ] [-SubscriptionDataFile <String> ] [-SubscriptionId <String> ] [ <CommonParameters>]

Parameter Set: ResetCurrentStorageAccount
Set-AzureSubscription [-SubscriptionName] <String> [-PassThru] [-SubscriptionDataFile <String> ] [ <CommonParameters>]




Detailed Description

The Set-AzureSubscription cmdlet establishes and changes the properties of an Azure subscription. You can use this cmdlet to create a new subscription or change the properties of an existing subscription.

To create a new subscription, select a unique name for the value of the SubscriptionName parameter. To change an existing subscription, use the SubscriptionName parameter to identify the subscription.

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.1 version of the Microsoft Azure PowerShell module. To find out the version of the module you're using, from the Azure PowerShell console, type (get-module azure).version.

Parameters

-Certificate<X509Certificate2>

Specifies a management certificate for the subscription. Management certificates are X.509 certificates that are saved as .cer files and uploaded to the Azure Management Portal. The certificate, including its private key, must be installed on the local computer, either in the current user's personal certificate store, or the local machine’s personal certificate store.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-CurrentStorageAccountName<String>

Designates the specified storage account as the "current" storage account for the subscription. Enter the storage account name. The parameter value is case-sensitive. Wildcard characters are not permitted.

This parameter does not create a storage account; it just associates the storage account with the subscription. To create a storage account, use the New-AzureStorageAccount cmdlet.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PassThru

Returns True ($true) if the operation succeeds and False ($false) if it fails. By default, this cmdlet does not return any output.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ResourceManagerEndpoint<String>

Sets or changes the endpoint for Azure Resource Manager data to the specified value.

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


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-ServiceEndpoint<String>

Sets or changes the custom service endpoint for the management service to the specified value.

The service endpoint is the Azure management API endpoint in the Azure environment. You can create custom service endpoints and set a different service endpoint for each subscription.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-SubscriptionDataFile<String>

Specifies the path and filename of an alternate subscription data file. This parameter is optional. By default, Set-AzureSubscription gets and changes data in the default subscription data file in your roaming user profile. Use this parameter if you used the SubscriptionDataFile parameter in Add-AzureAccount or Import-AzurePublishSettingsFile to specify an alternate (non-default) location for this file.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SubscriptionId<String>

Specifies the ID of the subscription. To get the subscription ID of an existing Azure subscription, use the Get-AzureSubscription cmdlet.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-SubscriptionName<String>

Specifies the subscription name. If an Azure subscription with this name does not exist, this parameter creates a new subscription with the specified name. If the subscription exists, this parameter identifies the subscription and uses the other property values to change it.

To get the names of existing Azure subscriptions, use the Get-AzureSubscription cmdlet.


Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see  about_CommonParameters (http://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 or System.Boolean

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


Examples

Example 1: Create a new subscription

These commands create the ContosoTest subscription in the default subscription data file. The commands add a management certificate and subscription ID for the new subscription.

When you run the Set-AzureSubscription command, the cmdlet looks for a subscription with the name "ContosoTest". If it doesn't find one, it creates a new subscription with the specified values.


PS C:\> $thumbprint = <Certificate Thumbprint>PS C:\>$myCert = Get-Item cert:\\CurrentUser\My\$thumbprint PS C:\>Set-AzureSubscription -SubscriptionName ContosotTest -Certificate $myCert -SubscriptionID 12345

Example 2: Change an existing subscription

These commands are very similar to the commands in Example 1. However, because the SubscriptionName parameter now identifies an existing subscription, Set-AzureSubscription uses the remaining parameters to change the values of the existing subscription rather than creating a new subscription


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

Example 2: Change the service endpoint

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


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

Example 3: Clear property values

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.


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

Example 4: Use an alternate subscription data file

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.


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

Related topics

Show: