Remove-AzApiManagementPolicy

Removes the API Management policy from a specified scope.

Syntax

Remove-AzApiManagementPolicy
      -Context <PsApiManagementContext>
      [-PassThru]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzApiManagementPolicy
      -Context <PsApiManagementContext>
      -ProductId <String>
      [-PassThru]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzApiManagementPolicy
      -Context <PsApiManagementContext>
      -ApiId <String>
      [-PassThru]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzApiManagementPolicy
      -Context <PsApiManagementContext>
      -ApiId <String>
      -OperationId <String>
      [-PassThru]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Remove-AzApiManagementPolicy cmdlet removes the API Management policy from specified scope.

Examples

Example 1: Remove the tenant level policy

$apimContext = New-AzApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
Remove-AzApiManagementPolicy -Context $apimContext

This command removes tenant level policy from API Management.

Example 2: Remove the product-scope policy

$apimContext = New-AzApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
Remove-AzApiManagementPolicy -Context $apimContext -ProductId "0123456789"

This command removes product-scope policy from API Management.

Example 3: Remove the API-scope policy

$apimContext = New-AzApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
Remove-AzApiManagementPolicy -Context $apimContext -ApiId "9876543210"

This command removes API-scope policy from API Management.

Example 4: Remove the operation-scope policy

$apimContext = New-AzApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
Remove-AzApiManagementPolicy -Context $apimContext -ApiId "9876543210" -OperationId "777"

This command removes operation-scope policy from API Management.

Parameters

-ApiId

Specifies the identifier of an existing API. If you specify this parameter, the cmdlet removes the API-scope policy.

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

-Confirm

Prompts you for confirmation before running the cmdlet.

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

-Context

Specifies the instance of the 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

-OperationId

Specifies the identifier of an existing operation. If you specify this parameter with the ApiId parameter, this cmdlet removes the operation-scope policy.

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

-PassThru

Indicates that this cmdlet returns a value of $True, if it succeeds, or a value of $False, otherwise.

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

-ProductId

Specifies the identifier of the existing product. If you specify this parameter, the cmdlet removes the product-scope policy.

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

Inputs

PsApiManagementContext

String

SwitchParameter

Outputs

Boolean