Skip to content

Commit eca0711

Browse files
[Network] DestinationPortBehavior in Get-AzNetworkWatcherConnectionMonitor is not getting information with powershell command (#20578)
* resolved the destinationportbehaviour issue * Update the change log for fix [#15996] * resolved the "DestinationPortBehavior" issue while create and update the CM * removed the redundant line * Update ChangeLog.md Co-authored-by: Dingmeng Xue <[email protected]>
1 parent 4d19301 commit eca0711

File tree

2 files changed

+23
-19
lines changed

2 files changed

+23
-19
lines changed

src/Network/Network/ChangeLog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
* Updated mapping in `AzPublicIpAddress` to always show/create DdosSettings
2525
* Fixed a bug that added Ddos related properties when viewing PublicIpAddress and DdosProtectionPlan objects
2626
* Fixed a Bug for Set-AzIpGroup cmdlet to support the `-WhatIf` parameter
27-
* Fixed a Bug for `Add-AzLoadBalancerFrontendIpConfig`, `Add-AzLoadBalancerProbeConfig`, `Add-AzLoadBalancerBackendAddressPoolConfig`, `Set-AzLoadBalancer`, `New-AzLoadBalancerRuleConfig`, `Remove-AzLoadBalancerInboundNatRuleConfig` cmdlets to support the `-WhatIf` parameter. Fix [#20416]
27+
* Fixed a Bug for `Add-AzLoadBalancerFrontendIpConfig`, `Add-AzLoadBalancerProbeConfig`, `Add-AzLoadBalancerBackendAddressPoolConfig`, `Set-AzLoadBalancer`, `New-AzLoadBalancerRuleConfig`, `Remove-AzLoadBalancerInboundNatRuleConfig` cmdlets to support the `-WhatIf` parameter. [#20416]
28+
* Fixed a bug for DestinationPortBehavior in `Get-AzNetworkWatcherConnectionMonitor`, `New-AzNetworkWatcherConnectionMonitor` powershell command by adding this properties to get and set the DestinationPortBehavior information. [#15996]
2829

2930
## Version 5.2.0
3031
* Added optional parameters `CustomBlockResponseStatusCode` and `CustomBlockResponseBody` parameter to `AzApplicationGatewayFirewallPolicySettings`

src/Network/Network/NetworkWatcher/ConnectionMonitor/ConnectionMonitorBaseCmdlet.cs

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public PSConnectionMonitorResultV2 MapConnectionMonitorResultToPSConnectionMonit
195195
Name = testConfiguration.Name,
196196
PreferredIPVersion = testConfiguration.PreferredIPVersion,
197197
TestFrequencySec = testConfiguration.TestFrequencySec,
198-
SuccessThreshold = testConfiguration.SuccessThreshold == null ? null :
198+
SuccessThreshold = testConfiguration.SuccessThreshold == null ? null :
199199
new PSNetworkWatcherConnectionMonitorSuccessThreshold()
200200
{
201201
ChecksFailedPercent = testConfiguration.SuccessThreshold.ChecksFailedPercent,
@@ -271,8 +271,8 @@ public MNM.ConnectionMonitorEndpoint GetEndpoinByName(IList<ConnectionMonitorEnd
271271
}
272272

273273
public ConnectionMonitor PopulateConnectionMonitorParametersFromV2Request(
274-
PSNetworkWatcherConnectionMonitorTestGroupObject[] testGroups,
275-
PSNetworkWatcherConnectionMonitorOutputObject[] outputs,
274+
PSNetworkWatcherConnectionMonitorTestGroupObject[] testGroups,
275+
PSNetworkWatcherConnectionMonitorOutputObject[] outputs,
276276
string notes)
277277
{
278278
ConnectionMonitor connectionMonitor = new ConnectionMonitor()
@@ -621,7 +621,8 @@ private void AddTestConfigurationsToConnectionMonitorTestGroup(
621621
cmTestConfiguration.TcpConfiguration = new ConnectionMonitorTcpConfiguration()
622622
{
623623
Port = tcpConfiguration.Port,
624-
DisableTraceRoute = tcpConfiguration.DisableTraceRoute
624+
DisableTraceRoute = tcpConfiguration.DisableTraceRoute,
625+
DestinationPortBehavior = tcpConfiguration.DestinationPortBehavior,
625626
};
626627
}
627628
else if (testConfiguration.ProtocolConfiguration is PSNetworkWatcherConnectionMonitorHttpConfiguration httpConfiguration)
@@ -667,13 +668,13 @@ private List<ConnectionMonitorOutput> GetOutputs(PSNetworkWatcherConnectionMonit
667668
{
668669
cmOutputs.Add(
669670
new ConnectionMonitorOutput()
671+
{
672+
Type = output.Type,
673+
WorkspaceSettings = new ConnectionMonitorWorkspaceSettings()
670674
{
671-
Type = output.Type,
672-
WorkspaceSettings = new ConnectionMonitorWorkspaceSettings()
673-
{
674-
WorkspaceResourceId = output.WorkspaceSettings.WorkspaceResourceId
675-
},
676-
});
675+
WorkspaceResourceId = output.WorkspaceSettings.WorkspaceResourceId
676+
},
677+
});
677678
}
678679

679680
return cmOutputs;
@@ -849,13 +850,13 @@ private void ValidateEndpointResourceId(PSNetworkWatcherConnectionMonitorEndpoin
849850
}
850851
else if (string.Equals(endpoint.Type, "AzureSubnet", StringComparison.OrdinalIgnoreCase))
851852
{
852-
if (!resourceType.Equals("virtualNetworks", StringComparison.OrdinalIgnoreCase) || splittedName.Count() != 11
853+
if (!resourceType.Equals("virtualNetworks", StringComparison.OrdinalIgnoreCase) || splittedName.Count() != 11
853854
|| splittedName[9].Equals("subnet", StringComparison.OrdinalIgnoreCase))
854855
{
855856
throw new PSArgumentException(Properties.Resources.InvalidEndpointResourceIdForSpecifiedType, endpoint.Type);
856857
}
857858
}
858-
else if ((string.Equals(endpoint.Type, "MMAWorkspaceMachine", StringComparison.OrdinalIgnoreCase) || string.Equals(endpoint.Type, "MMAWorkspaceNetwork", StringComparison.OrdinalIgnoreCase))
859+
else if ((string.Equals(endpoint.Type, "MMAWorkspaceMachine", StringComparison.OrdinalIgnoreCase) || string.Equals(endpoint.Type, "MMAWorkspaceNetwork", StringComparison.OrdinalIgnoreCase))
859860
&& !resourceType.Equals("workspaces", StringComparison.OrdinalIgnoreCase))
860861
{
861862
throw new PSArgumentException(Properties.Resources.InvalidEndpointResourceIdForSpecifiedType, endpoint.Type);
@@ -866,7 +867,8 @@ private void ValidateEndpointResourceId(PSNetworkWatcherConnectionMonitorEndpoin
866867
{
867868
throw new PSArgumentException(Properties.Resources.InvalidEndpointResourceIdForSpecifiedType, endpoint.Type);
868869
}
869-
} else if (string.Equals(endpoint.Type, "AzureArcVM", StringComparison.OrdinalIgnoreCase))
870+
}
871+
else if (string.Equals(endpoint.Type, "AzureArcVM", StringComparison.OrdinalIgnoreCase))
870872
{
871873
if (!resourceType.Equals("machines", StringComparison.OrdinalIgnoreCase))
872874
{
@@ -882,7 +884,8 @@ private PSNetworkWatcherConnectionMonitorProtocolConfiguration GetPSProtocolConf
882884
return new PSNetworkWatcherConnectionMonitorTcpConfiguration()
883885
{
884886
Port = testConfiguration.TcpConfiguration.Port,
885-
DisableTraceRoute = testConfiguration.TcpConfiguration.DisableTraceRoute
887+
DisableTraceRoute = testConfiguration.TcpConfiguration.DisableTraceRoute,
888+
DestinationPortBehavior = testConfiguration.TcpConfiguration.DestinationPortBehavior
886889
};
887890
}
888891

@@ -1000,10 +1003,10 @@ private List<HTTPHeader> GetRequestHeaders(PSNetworkWatcherConnectionMonitorHttp
10001003
{
10011004
requestHeaders.Add(
10021005
new HTTPHeader()
1003-
{
1004-
Name = header.Name,
1005-
Value = header.Value
1006-
});
1006+
{
1007+
Name = header.Name,
1008+
Value = header.Value
1009+
});
10071010
}
10081011

10091012
return requestHeaders;

0 commit comments

Comments
 (0)