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

Creates a subscription.

Syntax

New-AzureRmApiManagementSubscription
   -Context <PsApiManagementContext>
   [-SubscriptionId <String>]
   -Name <String>
   -UserId <String>
   -ProductId <String>
   [-PrimaryKey <String>]
   [-SecondaryKey <String>]
   [-State <PsApiManagementSubscriptionState>]
   [-InformationAction <ActionPreference>]
   [-InformationVariable <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

-InformationAction

Specifies how this cmdlet responds to an information event.The acceptable values for this parameter are:- Continue

  • Ignore
  • Inquire
  • SilentlyContinue
  • Stop
  • Suspend
Type:ActionPreference
Aliases:infa
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InformationVariable

Specifies an information variable.

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