Set-AzureRmApiManagementSubscription

Sets existing subscription details.

Syntax

Set-AzureRmApiManagementSubscription
   -Context <PsApiManagementContext>
   -SubscriptionId <String>
   [-Name <String>]
   [-PrimaryKey <String>]
   [-SecondaryKey <String>]
   [-State <PsApiManagementSubscriptionState>]
   [-ExpiresOn <DateTime>]
   [-StateComment <String>]
   [-PassThru]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

The Set-AzureRmApiManagementSubscription cmdlet sets existing subscription details.

Examples

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

PS C:\>$apimContext = New-AzureRmApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
PS C:\>Set-AzureRmApiManagementSubscription -Context $apimContext -SubscriptionId -0123456789 -PrimaryKey "80450f7d0b6d481382113073f67822c1" -SecondaryKey "97d6112c3a8f48d5bf0266b7a09a761c" -State "Active"

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

Required Parameters

-Context

Specifies a PsApiManagementContext object.

Type:Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementContext
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-SubscriptionId

Specifies the subscription ID.

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

Optional Parameters

-DefaultProfile

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

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ExpiresOn

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

Type:System.Nullable`1[System.DateTime]
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Name

Specifies a subscription name.

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

passthru

Type:System.Management.Automation.SwitchParameter
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
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
Accept pipeline input:True (ByPropertyName)
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
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-State

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

Type:System.Nullable`1[Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementSubscriptionState]
Parameter Sets:Suspended, Active, Expired, Submitted, Rejected, Cancelled
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
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
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Outputs

Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementSubscripition