< Back

New-AzureRmApiManagementSubscription

Tue Jan 29, 2019 9:30 pm

NAME New-AzureRmApiManagementSubscription



SYNOPSIS

Creates a subscription.





SYNTAX

New-AzureRmApiManagementSubscription -Context <PsApiManagementContext> [-DefaultProfile <IAzureContextContainer>] -Name <String> [-PrimaryKey

<String>] -ProductId <String> [-SecondaryKey <String>] [-State {Suspended | Active | Expired | Submitted | Rejected | Cancelled}] [-SubscriptionId

<String>] -UserId <String> [<CommonParameters>]





DESCRIPTION

The New-AzureRmApiManagementSubscription cmdlet creates a subscription.





PARAMETERS

-Context <PsApiManagementContext>

Specifies a PsApiManagementContext object.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-DefaultProfile <IAzureContextContainer>

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



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Name <String>

Specifies the subscription name.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-PrimaryKey <String>

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.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-ProductId <String>

Specifies the ID of the product to which to subscribe.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-SecondaryKey <String>

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

characters long.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-State <PsApiManagementSubscriptionState>

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



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-SubscriptionId <String>

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



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-UserId <String>

Specifies the subscriber ID.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

None

This cmdlet does not accept any input.





OUTPUTS

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







NOTES









Example 1: Subscribe a user to a product



PS C:\\>$apimContext = New-AzureRmApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"

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



This command subscribes an existing user to a product.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... bscription

Get-AzureRmApiManagementSubscription

Remove-AzureRmApiManagementSubscription

Set-AzureRmApiManagementSubscription