Remove-AzApiManagementPolicy
Removes the API Management policy from a specified scope.
Syntax
RemoveTenantLevel (Default)
Remove-AzApiManagementPolicy
-Context <PsApiManagementContext>
[-PassThru]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
RemoveProductLevel
Remove-AzApiManagementPolicy
-Context <PsApiManagementContext>
-ProductId <String>
[-PassThru]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
RemoveApiLevel
Remove-AzApiManagementPolicy
-Context <PsApiManagementContext>
-ApiId <String>
[-PassThru]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
RemoveOperationLevel
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.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
RemoveApiLevel
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
RemoveOperationLevel
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
Type: SwitchParameter
Default value: False
Supports wildcards: False
DontShow: False
Aliases: cf
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Context
Specifies the instance of the PsApiManagementContext object.
Parameter properties
Parameter sets
(All)
Position: Named
Mandatory: True
Value from pipeline: True
Value from pipeline by property name: True
Value from remaining arguments: False
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure.
Parameter properties
Type: IAzureContextContainer
Default value: None
Supports wildcards: False
DontShow: False
Aliases: AzContext, AzureRmContext, AzureCredential
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: 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.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
RemoveOperationLevel
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-PassThru
Indicates that this cmdlet returns a value of $True, if it succeeds, or a value of $False, otherwise.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-ProductId
Specifies the identifier of the existing product.
If you specify this parameter, the cmdlet removes the product-scope policy.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
RemoveProductLevel
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
Parameter properties
Type: SwitchParameter
Default value: False
Supports wildcards: False
DontShow: False
Aliases: wi
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters .
Outputs