Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

Set-AzureSubscription

Set-AzureSubscription

microsoft.windowsazure.commands.profile.dll, microsoft.windowsazure.commands.dll

Synopsis

Creates or changes an Azure subscription

Syntax

Set-AzureSubscription [-SubscriptionName] [-Certificate] [-ServiceEndpoint] [-ResourceManagerEndpoint] [-CurrentStorageAccountName] [-Environment] [-PassThru] [-SubscriptionDataFile] [<CommonParameters>]

Set-AzureSubscription [-SubscriptionName] [-SubscriptionId] [-Certificate] [-ServiceEndpoint] [-ResourceManagerEndpoint] [-CurrentStorageAccountName] [-Environment] [-PassThru] [-SubscriptionDataFile] [<CommonParameters>]

Set-AzureSubscription [-SubscriptionId] [-Certificate] [-ServiceEndpoint] [-ResourceManagerEndpoint] [-CurrentStorageAccountName] [-Environment] [-PassThru] [-SubscriptionDataFile] [<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.9 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

-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

0

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

-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

0

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

-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

-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

-Environment <String>

Aliases

None

Required?

false

Position

named

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-PassThru <SwitchParameter>

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

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

true

Position

named

Default value

None

Accept pipeline input?

true (ByPropertyName)

Accept wildcard characters?

false

Input Type

None

Return Type

None or System.Boolean

Notes

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.

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

PS C:\> 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.

PS C:\> 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.

PS C:\> 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.

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

Online Version
Add-AzureAccount
Get-AzureSubscription
Import-AzurePublishSettingsFile
Remove-AzureSubscription
Select-AzureSubscription