New-​Azure​Rm​Api​Management​Subscription

Creates a subscription.

Syntax

New-AzureRmApiManagementSubscription
   -Context <PsApiManagementContext>
   -Name <String>
   [-PrimaryKey <String>]
   -ProductId <String>
   [-SecondaryKey <String>]
   [-State <PsApiManagementSubscriptionState>]
   [-SubscriptionId <String>]
   -UserId <String>
   [<CommonParameters>]

Description

The New-AzureRmApiManagementSubscription cmdlet creates a subscription.

Examples

Example 1: Subscribe a user to a product

PS C:\>New-AzureRmApiManagementSubscription -Context $apimContext -UserId "777" -ProductId "999"

This command subscribes an existing user to a product.

Required Parameters

-Context

Specifies a PsApiManagementContext object.

Type:PsApiManagementContext
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Name

Specifies the subscription name.

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

Specifies the ID of the product to which to subscribe.

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

Specifies the subscriber ID.

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

Optional Parameters

-PrimaryKey

Specifies the subscription primary key. If this parameter is not specified the key is generated automatically. This parameter must be 1 to 300 characters long.

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

Specifies the subscription secondary key. This parameter is generated automatically if it is not specified. This parameter must be 1 to 300 characters long.

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

Specifies the subscription state. The default value is $Null.

Type:PsApiManagementSubscriptionState
Parameter Sets:Suspended, Active, Expired, Submitted, Rejected, Cancelled
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-SubscriptionId

Specifies the subscription ID. This parameter is generated if not specified.

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

Outputs

Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementSubscription