Skip to content

Commit 967dc47

Browse files
Gizachew-EshetieGizachew Eshetie
andauthored
Enable udp log optimization (Azure#19428)
* Added EnableUDPLogOptimization parameter to Firewall cmdlet * Updated help markdown * Rerun the pipeline Co-authored-by: Gizachew Eshetie <[email protected]>
1 parent 6da94da commit 967dc47

File tree

8 files changed

+2316
-6
lines changed

8 files changed

+2316
-6
lines changed

src/Network/Network.Test/ScenarioTests/AzureFirewallTests.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,14 @@ public void TestAzureFirewallCRUDIdentifyTopFatFlow()
160160
{
161161
TestRunner.RunTestScript("Test-AzureFirewallCRUDIdentifyTopFatFlow");
162162
}
163-
163+
164+
[Fact]
165+
[Trait(Category.AcceptanceType, Category.CheckIn)]
166+
[Trait(Category.Owner, NrpTeamAlias.azurefirewall)]
167+
public void TestAzureFirewallCRUDEnableUDPLogOptimization()
168+
{
169+
TestRunner.RunTestScript("Test-AzureFirewallCRUDEnableUDPLogOptimization");
170+
}
171+
164172
}
165173
}

src/Network/Network.Test/ScenarioTests/AzureFirewallTests.ps1

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1914,3 +1914,48 @@ function Test-AzureFirewallCRUDIdentifyTopFatFlow {
19141914
Clean-ResourceGroup $rgname
19151915
}
19161916
}
1917+
1918+
<#
1919+
.SYNOPSIS
1920+
Tests AzureFirewall EnableUDPLogOptimization
1921+
#>
1922+
function Test-AzureFirewallCRUDEnableUDPLogOptimization {
1923+
$rgname = Get-ResourceGroupName
1924+
$azureFirewallName = Get-ResourceName
1925+
$resourceTypeParent = "Microsoft.Network/AzureFirewalls"
1926+
$___location = Get-ProviderLocation $resourceTypeParent "eastus"
1927+
1928+
$vnetName = Get-ResourceName
1929+
$subnetName = "AzureFirewallSubnet"
1930+
$publicIpName = Get-ResourceName
1931+
1932+
try {
1933+
# Create the resource group
1934+
$resourceGroup = New-AzResourceGroup -Name $rgname -Location $___location
1935+
1936+
# Create the Virtual Network
1937+
$subnet = New-AzVirtualNetworkSubnetConfig -Name $subnetName -AddressPrefix 10.0.0.0/24
1938+
$vnet = New-AzVirtualNetwork -Name $vnetName -ResourceGroupName $rgname -Location $___location -AddressPrefix 10.0.0.0/16 -Subnet $subnet
1939+
1940+
# Create public ip
1941+
$publicip = New-AzPublicIpAddress -ResourceGroupName $rgname -name $publicIpName -___location $___location -AllocationMethod Static -Sku Standard
1942+
1943+
# Create AzureFirewall
1944+
$azureFirewall = New-AzFirewall -Name $azureFirewallName -ResourceGroupName $rgname -Location $___location -EnableUDPLogOptimization
1945+
1946+
# Verify
1947+
$azFirewall = Get-AzFirewall -Name $azureFirewallName -ResourceGroupName $rgname
1948+
Assert-AreEqual true $azFirewall.EnableUDPLogOptimization
1949+
1950+
# Reset the EnableUDPLogOptimization flag
1951+
$azFirewall.EnableUDPLogOptimization = $false
1952+
Set-AzFirewall -AzureFirewall $azFirewall
1953+
$azfw = Get-AzFirewall -Name $azureFirewallName -ResourceGroupName $rgname
1954+
1955+
Assert-AreEqual false $azfw.EnableUDPLogOptimization
1956+
}
1957+
finally {
1958+
# Cleanup
1959+
Clean-ResourceGroup $rgname
1960+
}
1961+
}

src/Network/Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.AzureFirewallTests/TestAzureFirewallCRUDEnableUDPLogOptimization.json

Lines changed: 2227 additions & 0 deletions
Large diffs are not rendered by default.

src/Network/Network/AzureFirewall/NewAzureFirewallCommand.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,12 @@ public class NewAzureFirewallCommand : AzureFirewallBaseCmdlet
241241
)]
242242
public SwitchParameter IdentifyTopFatFlow { get; set; }
243243

244+
[Parameter(
245+
Mandatory = false,
246+
HelpMessage = "Enable UDP Log Optimization. By default it is false."
247+
)]
248+
public SwitchParameter EnableUDPLogOptimization { get; set; }
249+
244250
public override void Execute()
245251
{
246252
// Old params provided - Get the virtual network, get the public IP address
@@ -310,7 +316,8 @@ private PSAzureFirewall CreateAzureFirewall()
310316
FirewallPolicy = FirewallPolicyId != null ? new MNM.SubResource(FirewallPolicyId) : null,
311317
HubIPAddresses = this.HubIPAddress,
312318
Zones = this.Zone == null ? null : this.Zone.ToList(),
313-
IdentifyTopFatFlow = (this.IdentifyTopFatFlow.IsPresent ? "True" : null)
319+
IdentifyTopFatFlow = (this.IdentifyTopFatFlow.IsPresent ? "True" : null),
320+
EnableUDPLogOptimization = (this.EnableUDPLogOptimization.IsPresent ? "True" : null)
314321
};
315322
}
316323
else
@@ -331,7 +338,8 @@ private PSAzureFirewall CreateAzureFirewall()
331338
DNSServer = this.DnsServer,
332339
AllowActiveFTP = (this.AllowActiveFTP.IsPresent ? "true" : null),
333340
Sku = sku,
334-
IdentifyTopFatFlow = (this.IdentifyTopFatFlow.IsPresent ? "True" : null)
341+
IdentifyTopFatFlow = (this.IdentifyTopFatFlow.IsPresent ? "True" : null),
342+
EnableUDPLogOptimization = (this.EnableUDPLogOptimization.IsPresent ? "True" : null)
335343
};
336344

337345
if (this.Zone != null)

src/Network/Network/ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
--->
2020

2121
## Upcoming Release
22+
23+
* Added `EnableUDPLogOptimization` parameter to `AzureFirewall`
24+
- `New-AzFirewall`
2225
* Fixed a bug not able to add MSSQL application rules to an AZURE FIREWALL POLICY
2326

2427
## Version 4.20.1

src/Network/Network/Common/NetworkResourceManagerProfile.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,6 +1308,7 @@ private static void Initialize()
13081308
{ "Network.DNS.EnableProxy", src.DNSEnableProxy },
13091309
{ "Network.DNS.Servers", src.DNSServer?.Aggregate((result, item) => result + "," + item) },
13101310
{ "Network.AdditionalLogs.EnableFatFlowLogging", src.IdentifyTopFatFlow },
1311+
{ "Network.Logging.EnableUDPLogOptimization", src.EnableUDPLogOptimization },
13111312
}.Where(kvp => kvp.Value != null).ToDictionary(key => key.Key, val => val.Value); // TODO: remove after backend code is refactored
13121313
});
13131314
cfg.CreateMap<CNM.PSAzureFirewallSku, MNM.AzureFirewallSku>();
@@ -1355,6 +1356,7 @@ private static void Initialize()
13551356
dest.AllowActiveFTP = src.AdditionalProperties?.SingleOrDefault(kvp => kvp.Key.Equals("Network.FTP.AllowActiveFTP", StringComparison.OrdinalIgnoreCase)).Value;
13561357
dest.DNSEnableProxy = src.AdditionalProperties?.SingleOrDefault(kvp => kvp.Key.Equals("Network.DNS.EnableProxy", StringComparison.OrdinalIgnoreCase)).Value;
13571358
dest.IdentifyTopFatFlow = src.AdditionalProperties?.SingleOrDefault(kvp => kvp.Key.Equals("Network.AdditionalLogs.EnableFatFlowLogging", StringComparison.OrdinalIgnoreCase)).Value;
1359+
dest.EnableUDPLogOptimization = src.AdditionalProperties?.SingleOrDefault(kvp => kvp.Key.Equals("Network.Logging.EnableUDPLogOptimization", StringComparison.OrdinalIgnoreCase)).Value;
13581360
try
13591361
{
13601362
dest.DNSServer = src.AdditionalProperties?.SingleOrDefault(kvp => kvp.Key.Equals("Network.DNS.Servers", StringComparison.OrdinalIgnoreCase)).Value?.Split(',').Select(str => str.Trim()).ToArray();

src/Network/Network/Models/AzureFirewall/PSAzureFirewall.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ public string[] PrivateRange
8181

8282
public string IdentifyTopFatFlow { get; set; }
8383

84+
public string EnableUDPLogOptimization { get; set; }
85+
8486
[JsonIgnore]
8587
public string IpConfigurationsText
8688
{

src/Network/Network/help/New-AzFirewall.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ New-AzFirewall -Name <String> -ResourceGroupName <String> -Location <String>
2222
[-ThreatIntelWhitelist <PSAzureFirewallThreatIntelWhitelist>] [-PrivateRange <String[]>] [-EnableDnsProxy]
2323
[-DnsServer <String[]>] [-Tag <Hashtable>] [-Force] [-AsJob] [-Zone <String[]>] [-SkuName <String>]
2424
[-SkuTier <String>] [-VirtualHubId <String>] [-HubIPAddress <PSAzureFirewallHubIpAddresses>]
25-
[-FirewallPolicyId <String>] [-AllowActiveFTP] [-IdentifyTopFatFlow]
25+
[-FirewallPolicyId <String>] [-AllowActiveFTP] [-IdentifyTopFatFlow] [-EnableUDPLogOptimization]
2626
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
2727
```
2828

@@ -35,7 +35,7 @@ New-AzFirewall -Name <String> -ResourceGroupName <String> -Location <String> -Vi
3535
[-ThreatIntelWhitelist <PSAzureFirewallThreatIntelWhitelist>] [-PrivateRange <String[]>] [-EnableDnsProxy]
3636
[-DnsServer <String[]>] [-Tag <Hashtable>] [-Force] [-AsJob] [-Zone <String[]>] [-SkuName <String>]
3737
[-SkuTier <String>] [-VirtualHubId <String>] [-HubIPAddress <PSAzureFirewallHubIpAddresses>]
38-
[-FirewallPolicyId <String>] [-AllowActiveFTP] [-IdentifyTopFatFlow]
38+
[-FirewallPolicyId <String>] [-AllowActiveFTP] [-IdentifyTopFatFlow] [-EnableUDPLogOptimization]
3939
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
4040
```
4141

@@ -49,7 +49,7 @@ New-AzFirewall -Name <String> -ResourceGroupName <String> -Location <String> -Vi
4949
[-ThreatIntelWhitelist <PSAzureFirewallThreatIntelWhitelist>] [-PrivateRange <String[]>] [-EnableDnsProxy]
5050
[-DnsServer <String[]>] [-Tag <Hashtable>] [-Force] [-AsJob] [-Zone <String[]>] [-SkuName <String>]
5151
[-SkuTier <String>] [-VirtualHubId <String>] [-HubIPAddress <PSAzureFirewallHubIpAddresses>]
52-
[-FirewallPolicyId <String>] [-AllowActiveFTP] [-IdentifyTopFatFlow]
52+
[-FirewallPolicyId <String>] [-AllowActiveFTP] [-IdentifyTopFatFlow] [-EnableUDPLogOptimization]
5353
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
5454
```
5555

@@ -346,6 +346,21 @@ Accept wildcard characters: False
346346
Enable DNS Proxy. By default it is disabled.
347347
348348
349+
```yaml
350+
Type: System.Management.Automation.SwitchParameter
351+
Parameter Sets: (All)
352+
Aliases:
353+
354+
Required: False
355+
Position: Named
356+
Default value: None
357+
Accept pipeline input: False
358+
Accept wildcard characters: False
359+
```
360+
361+
### -EnableUDPLogOptimization
362+
Enable UDP Log Optimization. By default it is false.
363+
349364
```yaml
350365
Type: System.Management.Automation.SwitchParameter
351366
Parameter Sets: (All)

0 commit comments

Comments
 (0)