Skip to content

Adding AuxiliaryMode property to New-AzNetworkInterface cmdlet #17866

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ function Test-NetworkInterfaceCRUD
$publicIpName = Get-ResourceName
$nicName = Get-ResourceName
$domainNameLabel = Get-ResourceName
$rglocation = Get-ProviderLocation ResourceManagement
$rglocation = Get-ProviderLocation ResourceManagement "East US 2 EUAP"
$resourceTypeParent = "Microsoft.Network/networkInterfaces"
$location = Get-ProviderLocation $resourceTypeParent
$location = Get-ProviderLocation $resourceTypeParent "East US 2 EUAP"

try
{
Expand All @@ -135,7 +135,7 @@ function Test-NetworkInterfaceCRUD
$publicip = New-AzPublicIpAddress -ResourceGroupName $rgname -name $publicIpName -location $location -AllocationMethod Dynamic -DomainNameLabel $domainNameLabel

# Create NetworkInterface
$actualNic = New-AzNetworkInterface -Name $nicName -ResourceGroupName $rgname -Location $location -Subnet $vnet.Subnets[0] -PublicIpAddress $publicip
$actualNic = New-AzNetworkInterface -Name $nicName -ResourceGroupName $rgname -Location $location -Subnet $vnet.Subnets[0] -PublicIpAddress $publicip -EnableAcceleratedNetworking -AuxiliaryMode MaxConnections -Tag @{ fastpathenabled = "true"}
$expectedNic = Get-AzNetworkInterface -Name $nicName -ResourceGroupName $rgname

Assert-AreEqual $expectedNic.ResourceGroupName $actualNic.ResourceGroupName
Expand All @@ -148,6 +148,7 @@ function Test-NetworkInterfaceCRUD
Assert-AreEqual $expectedNic.IpConfigurations[0].Subnet.Id $actualNic.IpConfigurations[0].Subnet.Id
Assert-NotNull $expectedNic.IpConfigurations[0].PrivateIpAddress
Assert-AreEqual "Dynamic" $expectedNic.IpConfigurations[0].PrivateIpAllocationMethod
Assert-AreEqual "MaxConnections" $expectedNic.AuxiliaryMode

$expectedNic = Get-AzNetworkInterface -ResourceId $actualNic.Id

Expand Down

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/Network/Network/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* Updated cmdlets to add new property of `HubRoutingPreference` in VirtualHub and set property of `PreferredRoutingGateway` deprecated .
- `New-AzVirtualHub`
- `Update-AzVirtualHub`
* Added optional parameter `AuxiliaryMode` to cmdlet `New-AzNetworkInterface` to enable this network interface as Sirius enabled. Allowed values are None(default) and MaxConnections.

## Version 4.16.0
* Added support for retrieving the state of packet capture even when the provisioning state of the packet capture was failure
Expand Down
3 changes: 3 additions & 0 deletions src/Network/Network/Models/PSNetworkInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ public class PSNetworkInterface : PSTopLevelResource, INetworkInterfaceReference
[Ps1Xml(Target = ViewControl.Table)]
public bool VnetEncryptionSupported { get; set; }

[Ps1Xml(Target = ViewControl.Table)]
public string AuxiliaryMode { get; set; }

[JsonIgnore]
public string VirtualMachineText
{
Expand Down
4 changes: 4 additions & 0 deletions src/Network/Network/Network.format.ps1xml
Original file line number Diff line number Diff line change
Expand Up @@ -1856,6 +1856,10 @@
<Label>VnetEncryptionSupported</Label>
<PropertyName>VnetEncryptionSupported</PropertyName>
</ListItem>
<ListItem>
<Label>AuxiliaryMode</Label>
<PropertyName>AuxiliaryMode</PropertyName>
</ListItem>
<ListItem>
<Label>NetworkSecurityGroup</Label>
<PropertyName>NetworkSecurityGroupText</PropertyName>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,15 @@ public class NewAzureNetworkInterfaceCommand : NetworkInterfaceBaseCmdlet
HelpMessage = "EnableAcceleratedNetworking")]
public SwitchParameter EnableAcceleratedNetworking { get; set; }

[Parameter(
Mandatory = false,
HelpMessage = "The auxiliary mode of the Network Interface ")]
[ValidateSet(
MNM.NetworkInterfaceAuxiliaryMode.None,
MNM.NetworkInterfaceAuxiliaryMode.MaxConnections,
IgnoreCase = true)]
public string AuxiliaryMode { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
Expand Down Expand Up @@ -438,6 +447,11 @@ private PSNetworkInterface CreateNetworkInterface()
networkInterface.NetworkSecurityGroup.Id = this.NetworkSecurityGroupId;
}

if (!string.IsNullOrEmpty(this.AuxiliaryMode))
{
networkInterface.AuxiliaryMode = this.AuxiliaryMode;
}

List<string> resourceIdsRequiringAuthToken = new List<string>();
Dictionary<string, List<string>> auxAuthHeader = null;

Expand Down