Edit

Remove-AzDdosCustomPolicyDetectionRule

Removes a detection rule from a DDoS custom policy.

Syntax

Default (Default)

Remove-AzDdosCustomPolicyDetectionRule
    -DdosCustomPolicy <PSDdosCustomPolicy>
    -Name <String>
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [-AcquirePolicyToken]
    [-ChangeReference <String>]
    [<CommonParameters>]

Description

The Remove-AzDdosCustomPolicyDetectionRule cmdlet removes a detection rule from a DDoS custom policy object. After removing the rule, you must use Set-AzDdosCustomPolicy to persist the changes to Azure.

This cmdlet operates on the policy object in memory before persisting changes to Azure, similar to how Remove-AzLoadBalancerRuleConfig works with load balancer configurations.

Examples

Example 1: Remove a detection rule from a DDoS custom policy

$policy = Get-AzDdosCustomPolicy -ResourceGroupName "myRG" -Name "myPolicy"
$policy = $policy | Remove-AzDdosCustomPolicyDetectionRule -Name "udpRule1"
$policy | Set-AzDdosCustomPolicy

This example retrieves a DDoS custom policy, removes the UDP detection rule from the policy object, and then persists the changes to Azure.

Example 2: Remove a detection rule using pipeline

Get-AzDdosCustomPolicy -ResourceGroupName "myRG" -Name "myPolicy" |
  Remove-AzDdosCustomPolicyDetectionRule -Name "tcpSynRule1" |
  Set-AzDdosCustomPolicy

This example demonstrates the full pipeline for retrieving a policy, removing a specific detection rule by name, and persisting the changes.

Example 3: Remove a detection rule with WhatIf

$policy = Get-AzDdosCustomPolicy -ResourceGroupName "myRG" -Name "myPolicy"
$policy | Remove-AzDdosCustomPolicyDetectionRule -Name "tcpRule1" -WhatIf

This example shows how to preview the removal of a detection rule without making any changes to the policy object in memory.

Parameters

-AcquirePolicyToken

Acquire an Azure Policy token automatically for this resource operation.

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:False
Value from remaining arguments:False

-ChangeReference

The change reference resource ID for this resource operation.

Parameter properties

Type:String
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:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
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

-DdosCustomPolicy

Specifies the DDoS custom policy object from which to remove the detection rule. The object can be retrieved with Get-AzDdosCustomPolicy.

Parameter properties

Type:Microsoft.Azure.Commands.Network.Models.PSDdosCustomPolicy
Default value:None
Supports wildcards:False
DontShow:False

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

-Name

Specifies the name of the detection rule to remove.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
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:None
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.

Inputs

Microsoft.Azure.Commands.Network.Models.PSDdosCustomPolicy

Outputs

Microsoft.Azure.Commands.Network.Models.PSDdosCustomPolicy