Skip to content

Commit 547da57

Browse files
{AzureFrontDoor} fixes #20870 Adding Tag parameter to New-AzFrontDoorWafPolicy (#20908)
* {AzureFrontDoor} fixes #20870 Adding Tag parameter to New-AzFrontDoorWafPolicy fixes #20870 Adding Tag parameter to New-AzFrontDoorWafPolicy This PR Allow the passing of tags when creating a new Azure Front Door Waf Policy resource. Currently, tags can be added in the portal but not via powershell for the FrontDoor WAF policy. * Update ChangeLog.md * Update src/FrontDoor/FrontDoor/ChangeLog.md Co-authored-by: Beisi Zhou <zhoubeisi@gmail.com> * Update src/FrontDoor/FrontDoor/Cmdlets/NewFrontDoorWafPolicy.cs Co-authored-by: Beisi Zhou <zhoubeisi@gmail.com> * Update NewFrontDoorWafPolicy.cs * Updating the help docs New-AzFrontDoorWafPolicy.md --------- Co-authored-by: Beisi Zhou <zhoubeisi@gmail.com>
1 parent d7880ae commit 547da57

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

src/FrontDoor/FrontDoor/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Fixed New-AzFrontDoorWafPolicy cmdlet to support adding Tags for the Azure Frontdoor waf policy
2122

2223
## Version 1.9.0
2324
* Allowed rule engine action creation without RouteConfigurationOverride for `New-AzFrontDoorRulesEngineActionObject`.

src/FrontDoor/FrontDoor/Cmdlets/NewFrontDoorWafPolicy.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
using System.Linq;
2424
using System.Management.Automation;
2525
using System.Text;
26+
using System.Collections;
2627

2728
namespace Microsoft.Azure.Commands.FrontDoor.Cmdlets
2829
{
@@ -90,7 +91,13 @@ public class NewFrontDoorWafPolicy : AzureFrontDoorCmdletBase
9091
/// </summary>
9192
[Parameter(Mandatory = false, HelpMessage = "Custom Response Body")]
9293
public string CustomBlockResponseBody { get; set; }
93-
94+
95+
/// <summary>
96+
/// The tags to associate with the Front Door Waf Policy.
97+
/// </summary>
98+
[Parameter(Mandatory = false, HelpMessage = "The tags associate with the Front Door Waf Policy.")]
99+
public Hashtable Tag { get; set; }
100+
94101
/// <summary>
95102
/// Defines if the body should be inspected by managed rules. Possible values include: 'Enabled', 'Disabled'
96103
/// </summary>
@@ -118,6 +125,7 @@ public override void ExecuteCmdlet()
118125
}
119126
var updateParameters = new Management.FrontDoor.Models.WebApplicationFirewallPolicy
120127
{
128+
Tags = Tag?.ToDictionaryTags(),
121129
Location = "global",
122130
CustomRules = new Management.FrontDoor.Models.CustomRuleList()
123131
{

src/FrontDoor/FrontDoor/help/New-AzFrontDoorWafPolicy.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Create WAF policy
1616
New-AzFrontDoorWafPolicy -ResourceGroupName <String> -Name <String> [-EnabledState <PSEnabledState>]
1717
[-Mode <String>] [-Customrule <PSCustomRule[]>] [-ManagedRule <PSManagedRule[]>] [-RedirectUrl <String>]
1818
[-CustomBlockResponseStatusCode <Int32>] [-CustomBlockResponseBody <String>] [-RequestBodyCheck <String>]
19-
[-Sku <String>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
19+
[-Tag <Hashtable>] [-Sku <String>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
2020
```
2121

2222
## DESCRIPTION
@@ -192,6 +192,21 @@ Accept pipeline input: False
192192
Accept wildcard characters: False
193193
```
194194
195+
### -Tag
196+
The tags associate with the FrontDoor WAF Policy.
197+
198+
```yaml
199+
Type: System.Collections.Hashtable
200+
Parameter Sets: (All)
201+
Aliases:
202+
203+
Required: False
204+
Position: Named
205+
Default value: None
206+
Accept pipeline input: False
207+
Accept wildcard characters: False
208+
```
209+
195210
### -ResourceGroupName
196211
The resource group name
197212

0 commit comments

Comments
 (0)