共用方式為


New-AzsSubscription

Create or updates a subscription.

Syntax

New-AzsSubscription
   -OfferId <String>
   [-SubscriptionId <String>]
   [-DisplayName <String>]
   [-Id <String>]
   [-State <SubscriptionState>]
   [-TenantId <String>]
   [-DefaultProfile <PSObject>]
   [-Confirm]
   [-WhatIf]
   [<CommonParameters>]

Description

Create or updates a subscription.

Examples

Example 1

PS C:\> New-AzsSubscription -OfferId '/delegatedProviders/default/offers/testoffer' -DisplayName 'testsubscription' | fl *

DisplayName    : testsubscription
Id             : /subscriptions/7b9d25c5-52ea-4940-8c6a-fe6749ab2e97
OfferId        : /delegatedProviders/default/offers/testoffer
State          : Enabled
SubscriptionId : 7b9d25c5-52ea-4940-8c6a-fe6749ab2e97
TenantId       : 6ca57aaf-0074-498a-9c96-2b097515e8cb

Create a subscription.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:System.Management.Automation.SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:System.Management.Automation.PSObject
Aliases:AzureRMContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DisplayName

Subscription name.

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

-Id

Fully qualified identifier.

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

-OfferId

Identifier of the offer under the scope of a delegated provider.

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

-State

Subscription state.

Type:Microsoft.Azure.PowerShell.Cmdlets.Subscription.Support.SubscriptionState
Position:Named
Default value:Write-Output "Enabled"
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-SubscriptionId

Id of the subscription.

Type:System.String
Position:Named
Default value:$([Guid]::NewGuid().ToString())
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TenantId

Directory tenant identifier.

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

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:System.Management.Automation.SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Outputs

Microsoft.Azure.PowerShell.Cmdlets.Subscription.Models.Api20151101.ISubscription