Remove-AzureRmApiManagementPolicy

Removes the API Management policy from a specified scope.

Syntax

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

Description

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

Examples

Example 1: Remove the tenant level policy

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

This command removes tenant level policy from API Management.

Example 2: Remove the product-scope policy

PS C:\>$apimContext = New-AzureRmApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
PS C:\>Remove-AzureRmApiManagementPolicy -Context $apimContext -ProductId "0123456789"

This command removes product-scope policy from API Management.

Example 3: Remove the API-scope policy

PS C:\>$apimContext = New-AzureRmApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
PS C:\>Remove-AzureRmApiManagementPolicy -Context $apimContext -ApiId "9876543210"

This command removes API-scope policy from API Management.

Example 4: Remove the operation-scope policy

PS C:\>$apimContext = New-AzureRmApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
PS C:\>Remove-AzureRmApiManagementPolicy -Context $apimContext -ApiId "9876543210" -OperationId "777"

This command removes operation-scope policy from API Management.

Required 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
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Context

Specifies the instance of the PsApiManagementContext object.

Type:Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementContext
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
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
Accept pipeline input:True (ByPropertyName)
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
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:System.Management.Automation.SwitchParameter
Aliases:cf
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-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
-PassThru

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

Type:System.Management.Automation.SwitchParameter
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-WhatIf

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

Type:System.Management.Automation.SwitchParameter
Aliases:wi
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False

Outputs

Boolean