Set-AzDdosCustomPolicy
Updates and persists a DDoS custom policy to Azure.
Syntax
Default (Default)
Set-AzDdosCustomPolicy
-DdosCustomPolicy <PSDdosCustomPolicy>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[-AcquirePolicyToken]
[-ChangeReference <String>]
[<CommonParameters>]
Description
The Set-AzDdosCustomPolicy cmdlet persists changes made to a DDoS custom policy object back to Azure. After modifying detection rules or mitigation rules, use this cmdlet to save the changes to Azure. The policy must contain at least one detection rule or mitigation rule.
This cmdlet is typically used in a pipeline after modifying a policy object retrieved with Get-AzDdosCustomPolicy or created with New-AzDdosCustomPolicy.
Examples
Example 1: Update a DDoS custom policy by removing a detection rule
$policy = Get-AzDdosCustomPolicy -ResourceGroupName "myRG" -Name "myPolicy"
$policy = $policy | Remove-AzDdosCustomPolicyDetectionRule -Name "udpRule1"
$policy | Set-AzDdosCustomPolicy
This example retrieves a DDoS custom policy, removes a detection rule by name, and persists the changes to Azure.
Example 2: Add a detection rule and persist the updated policy
Get-AzDdosCustomPolicy -ResourceGroupName "myRG" -Name "myPolicy" |
Add-AzDdosCustomPolicyDetectionRule -Name "tcpSynRule1" -TrafficType TcpSyn -PacketsPerSecond 50000 |
Set-AzDdosCustomPolicy
This example demonstrates the full pipeline for retrieving a policy, adding a detection rule to the in-memory object, and persisting the updated policy.
Example 3: Update a DDoS custom policy using WhatIf
$policy = Get-AzDdosCustomPolicy -ResourceGroupName "myRG" -Name "myPolicy"
$policy | Remove-AzDdosCustomPolicyDetectionRule -Name "tcpRule1" | Set-AzDdosCustomPolicy -WhatIf
This example shows how to preview the changes without actually updating the policy in Azure.
Example 4: Add and persist a mitigation rule
Get-AzDdosCustomPolicy -ResourceGroupName "myRG" -Name "myPolicy" |
Add-AzDdosCustomPolicyMitigationRule -Name "udpRule" -TrafficScope Udp -UdpPacketsPerSecond 90000 |
Set-AzDdosCustomPolicy
This example adds a UDP mitigation rule to the in-memory policy and persists the updated policy.
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 to update. The object can be created with New-AzDdosCustomPolicy or retrieved with Get-AzDdosCustomPolicy.
Parameter properties
| Type: | 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 |
-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.