Skip to content

Commit ffdbfe7

Browse files
authored
Adding new endpoint AzureArcVM in ConnectionMonitor (#19626)
1 parent dd281cd commit ffdbfe7

File tree

4 files changed

+46
-2
lines changed

4 files changed

+46
-2
lines changed

src/Network/Network/ChangeLog.md

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

2121
## Upcoming Release
22+
* Added a new endpoint swtich `AzureArcVM` in Networkwatcher ConnectionMonitor
23+
- `New-AzNetworkWatcherConnectionMonitor`
2224
* Updated commandlet to support bypassing the ExpressRoute gateway when accessing private-links.
2325
- `New-AzVirtualNetworkGatewayConnection`
2426
* Updated commandlet to support no-internet advertise CustomIpPrefix.

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ private void ValidateEndpointType(PSNetworkWatcherConnectionMonitorEndpointObjec
802802
if (!string.Equals(endpoint.Type, "AzureVM", StringComparison.OrdinalIgnoreCase) && !string.Equals(endpoint.Type, "AzureVNet", StringComparison.OrdinalIgnoreCase)
803803
&& !string.Equals(endpoint.Type, "AzureSubnet", StringComparison.OrdinalIgnoreCase) && !string.Equals(endpoint.Type, "MMAWorkspaceMachine", StringComparison.OrdinalIgnoreCase)
804804
&& !string.Equals(endpoint.Type, "MMAWorkspaceNetwork", StringComparison.OrdinalIgnoreCase) && !string.Equals(endpoint.Type, "ExternalAddress", StringComparison.OrdinalIgnoreCase)
805-
&& !string.Equals(endpoint.Type, "AzureVMSS", StringComparison.OrdinalIgnoreCase))
805+
&& !string.Equals(endpoint.Type, "AzureVMSS", StringComparison.OrdinalIgnoreCase) && !string.Equals(endpoint.Type, "AzureArcVM", StringComparison.OrdinalIgnoreCase))
806806
{
807807
throw new PSArgumentException(Properties.Resources.InvalidEndpointType, endpoint.Name);
808808
}
@@ -827,7 +827,8 @@ private void ValidateEndpointResourceId(PSNetworkWatcherConnectionMonitorEndpoin
827827
if (string.IsNullOrEmpty(resourceType) || (!resourceType.Equals("virtualMachines", StringComparison.OrdinalIgnoreCase)
828828
&& !resourceType.Equals("workspaces", StringComparison.OrdinalIgnoreCase)
829829
&& !resourceType.Equals("virtualNetworks", StringComparison.OrdinalIgnoreCase)
830-
&& !resourceType.Equals("virtualMachineScaleSets", StringComparison.OrdinalIgnoreCase)))
830+
&& !resourceType.Equals("virtualMachineScaleSets", StringComparison.OrdinalIgnoreCase))
831+
&& !resourceType.Equals("machines", StringComparison.OrdinalIgnoreCase))
831832
{
832833
throw new PSArgumentException(Properties.Resources.InvalidEndpointResourceType);
833834
}
@@ -865,6 +866,12 @@ private void ValidateEndpointResourceId(PSNetworkWatcherConnectionMonitorEndpoin
865866
{
866867
throw new PSArgumentException(Properties.Resources.InvalidEndpointResourceIdForSpecifiedType, endpoint.Type);
867868
}
869+
} else if (string.Equals(endpoint.Type, "AzureArcVM", StringComparison.OrdinalIgnoreCase))
870+
{
871+
if (!resourceType.Equals("machines", StringComparison.OrdinalIgnoreCase))
872+
{
873+
throw new PSArgumentException(Properties.Resources.InvalidEndpointResourceIdForSpecifiedType, endpoint.Type);
874+
}
868875
}
869876
}
870877

src/Network/Network/NetworkWatcher/ConnectionMonitor/NewAzureNetworkWatcherConnectionMonitorEndPointObjectCommand.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ public class NewAzureNetworkWatcherConnectionMonitorEndpointObjectCommand : Conn
7272
ParameterSetName = "AzureVMSS")]
7373
public SwitchParameter AzureVMSS { get; set; }
7474

75+
[Parameter(
76+
Mandatory = true,
77+
HelpMessage = "Azure ArcVM endpoint switch.",
78+
ParameterSetName = "AzureArcVM")]
79+
public SwitchParameter AzureArcVM { get; set; }
80+
7581
[Parameter(
7682
Mandatory = true,
7783
HelpMessage = "Resource ID of the connection monitor endpoint.",
@@ -96,6 +102,10 @@ public class NewAzureNetworkWatcherConnectionMonitorEndpointObjectCommand : Conn
96102
Mandatory = true,
97103
HelpMessage = "Azure VMSS endpoint.",
98104
ParameterSetName = "AzureVMSS")]
105+
[Parameter(
106+
Mandatory = true,
107+
HelpMessage = "Azure ArcVM endpoint.",
108+
ParameterSetName = "AzureArcVM")]
99109
[ValidateNotNullOrEmpty]
100110
public string ResourceId { get; set; }
101111

@@ -249,6 +259,10 @@ private string GetEndpointType()
249259
{
250260
return "AzureVMSS";
251261
}
262+
else if (AzureArcVM.IsPresent)
263+
{
264+
return "AzureArcVM";
265+
}
252266

253267
return string.Empty;
254268
}

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ New-AzNetworkWatcherConnectionMonitorEndpointObject -Name <String> [-AzureVMSS]
6262
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
6363
```
6464

65+
### AzureArcVM
66+
```
67+
New-AzNetworkWatcherConnectionMonitorEndpointObject -Name <String> [-AzureArcVM] -ResourceId <String>
68+
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
69+
```
70+
6571
## DESCRIPTION
6672
New-AzNetworkWatcherConnectionMonitorEndpointObject cmdlet creates connection monitor endpoint.
6773

@@ -294,6 +300,21 @@ Accept pipeline input: False
294300
Accept wildcard characters: False
295301
```
296302
303+
### -AzureArcVM
304+
AzureArc VM endpoint switch
305+
306+
```yaml
307+
Type: System.Management.Automation.SwitchParameter
308+
Parameter Sets: AzureArcVM
309+
Aliases:
310+
311+
Required: True
312+
Position: Named
313+
Default value: None
314+
Accept pipeline input: False
315+
Accept wildcard characters: False
316+
```
317+
297318
### -Name
298319
The name of the connection monitor endpoint.
299320

0 commit comments

Comments
 (0)