Set-AzApiManagementSubscription

Sets existing subscription details.

Syntax

Set-AzApiManagementSubscription
   -InputObject <PsApiManagementSubscription>
   [-Scope <String>]
   [-UserId <String>]
   [-Name <String>]
   [-PrimaryKey <String>]
   [-SecondaryKey <String>]
   [-State <PsApiManagementSubscriptionState>]
   [-ExpiresOn <DateTime>]
   [-StateComment <String>]
   [-PassThru]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AzApiManagementSubscription
   -Context <PsApiManagementContext>
   -SubscriptionId <String>
   [-Scope <String>]
   [-UserId <String>]
   [-Name <String>]
   [-PrimaryKey <String>]
   [-SecondaryKey <String>]
   [-State <PsApiManagementSubscriptionState>]
   [-ExpiresOn <DateTime>]
   [-StateComment <String>]
   [-PassThru]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The Set-AzApiManagementSubscription cmdlet sets existing subscription details.

Examples

Example 1: Set the state and primary and secondary keys for a subscription

$apimContext = New-AzApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
Set-AzApiManagementSubscription -Context $apimContext -SubscriptionId -0123456789 -PrimaryKey "80450f7d0b6d481382113073f67822c1" -SecondaryKey "97d6112c3a8f48d5bf0266b7a09a761c" -State "Active"

This command sets the primary and secondary keys for a subscription and activates it.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

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

-Context

Specifies a PsApiManagementContext object.

Type:PsApiManagementContext
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-DefaultProfile

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

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ExpiresOn

Specifies a subscription expiration date. The default value of this parameter is $Null.

Type:Nullable<T>[DateTime]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-InputObject

Instance of PsApiManagementSubscription. This parameter is required.

Type:PsApiManagementSubscription
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Name

Specifies a subscription name.

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

-PassThru

passthru

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-PrimaryKey

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

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

-Scope

The Scope of the Subscription, whether it is Api Scope /apis/{apiId} or Product Scope /products/{productId} or Global API Scope /apis or Global scope /. This parameter is required.

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

-SecondaryKey

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

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

-State

Specifies the subscription state. The default value of this parameter is $Null.

Type:Nullable<T>[PsApiManagementSubscriptionState]
Accepted values:Suspended, Active, Expired, Submitted, Rejected, Cancelled
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-StateComment

Specifies the subscription state comment. The default value of this parameter is $Null.

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

-SubscriptionId

Specifies the subscription ID.

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

-UserId

The owner of the subscription. This parameter is optional.

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

-WhatIf

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

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

Inputs

PsApiManagementContext

String

Nullable<T>[[Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementSubscriptionState, Microsoft.Azure.PowerShell.Cmdlets.ApiManagement.ServiceManagement, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]

Nullable<T>[[System.DateTime, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]

SwitchParameter

Outputs

PsApiManagementSubscription