From 0ac6110d12c7e9db8977a9df93387081d8c4c0e3 Mon Sep 17 00:00:00 2001 From: irrogozh Date: Tue, 15 Sep 2020 01:43:35 -0700 Subject: [PATCH 1/4] Updated Connection monitor endpoint cmdlet (#12943) * Updated ConnectionMonitorEndpoint cmdlet * Updated help files * Fixed help files * Suppressed breaking changes warnings --- src/Network/Network/Az.Network.psd1 | 4 +- .../Common/NetworkResourceManagerProfile.cs | 8 +- .../Models/PSConnectionMonitorEndPoint.cs | 12 +- ...cs => PSConnectionMonitorEndpointScope.cs} | 19 +- ...> PSConnectionMonitorEndpointScopeItem.cs} | 10 +- .../PSConnectionMonitorTcpConfiguration.cs | 3 + src/Network/Network/Network.format.ps1xml | 36 ++-- .../ConnectionMonitorBaseCmdlet.cs | 204 +++++++++--------- ...rConnectionMonitorEndPointObjectCommand.cs | 57 +++-- ...nnectionMonitorEndpointScopeItemObject.cs} | 22 +- ...nitorProtocolConfigurationObjectCommand.cs | 11 +- .../Network/Properties/Resources.Designer.cs | 73 +++---- src/Network/Network/Properties/Resources.resx | 29 ++- ...kWatcherConnectionMonitorEndpointObject.md | 74 +++++-- ...nnectionMonitorEndpointScopeItemObject.md} | 35 +-- ...ctionMonitorProtocolConfigurationObject.md | 37 +++- .../Az.Network/BreakingChangeIssues.csv | 12 +- 17 files changed, 359 insertions(+), 287 deletions(-) rename src/Network/Network/Models/{PSConnectionMonitorEndpointFilter.cs => PSConnectionMonitorEndpointScope.cs} (54%) rename src/Network/Network/Models/{PSConnectionMonitorEndpointFilterItem.cs => PSConnectionMonitorEndpointScopeItem.cs} (78%) rename src/Network/Network/NetworkWatcher/ConnectionMonitor/{NewAzureNetworkWatcherConnectionMonitorEndpointFilterItemObject.cs => NewAzureNetworkWatcherConnectionMonitorEndpointScopeItemObject.cs} (57%) rename src/Network/Network/help/{New-AzNetworkWatcherConnectionMonitorEndpointFilterItemObject.md => New-AzNetworkWatcherConnectionMonitorEndpointScopeItemObject.md} (64%) diff --git a/src/Network/Network/Az.Network.psd1 b/src/Network/Network/Az.Network.psd1 index fc39c091594c..ec89beb48ec8 100644 --- a/src/Network/Network/Az.Network.psd1 +++ b/src/Network/Network/Az.Network.psd1 @@ -257,9 +257,9 @@ CmdletsToExport = 'Add-AzApplicationGatewayAuthenticationCertificate', 'Test-AzNetworkWatcherConnectivity', 'Get-AzNetworkWatcherReachabilityReport', 'Get-AzNetworkWatcherReachabilityProvidersList', - 'New-AzNetworkWatcherConnectionMonitorEndpointFilterItemObject', - 'New-AzNetworkWatcherConnectionMonitorObject', 'New-AzNetworkWatcherConnectionMonitorEndpointObject', + 'New-AzNetworkWatcherConnectionMonitorObject', + 'New-AzNetworkWatcherConnectionMonitorEndpointScopeItemObject', 'New-AzNetworkWatcherConnectionMonitorTestConfigurationObject', 'New-AzNetworkWatcherConnectionMonitorTestGroupObject', 'New-AzNetworkWatcherConnectionMonitorOutputObject', diff --git a/src/Network/Network/Common/NetworkResourceManagerProfile.cs b/src/Network/Network/Common/NetworkResourceManagerProfile.cs index 4f4625c5db51..5d04ffe5e09f 100644 --- a/src/Network/Network/Common/NetworkResourceManagerProfile.cs +++ b/src/Network/Network/Common/NetworkResourceManagerProfile.cs @@ -556,8 +556,8 @@ private static void Initialize() cfg.CreateMap(); cfg.CreateMap(); cfg.CreateMap(); - cfg.CreateMap(); - cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); cfg.CreateMap(); cfg.CreateMap(); cfg.CreateMap(); @@ -575,8 +575,8 @@ private static void Initialize() cfg.CreateMap(); cfg.CreateMap(); cfg.CreateMap(); - cfg.CreateMap(); - cfg.CreateMap(); + cfg.CreateMap(); + cfg.CreateMap(); cfg.CreateMap(); cfg.CreateMap(); cfg.CreateMap(); diff --git a/src/Network/Network/Models/PSConnectionMonitorEndPoint.cs b/src/Network/Network/Models/PSConnectionMonitorEndPoint.cs index 35aa5ab68ef0..1e0c7681c286 100644 --- a/src/Network/Network/Models/PSConnectionMonitorEndPoint.cs +++ b/src/Network/Network/Models/PSConnectionMonitorEndPoint.cs @@ -23,6 +23,9 @@ public class PSNetworkWatcherConnectionMonitorEndpointObject [Ps1Xml(Target = ViewControl.Table)] public string Name { get; set; } + [Ps1Xml(Target = ViewControl.Table)] + public string Type { get; set; } + [Ps1Xml(Target = ViewControl.Table)] public string ResourceId { get; set; } @@ -30,12 +33,15 @@ public class PSNetworkWatcherConnectionMonitorEndpointObject public string Address { get; set; } [Ps1Xml(Target = ViewControl.Table)] - public PSNetworkWatcherConnectionMonitorEndpointFilter Filter { get; set; } + public PSNetworkWatcherConnectionMonitorEndpointScope Scope { get; set; } + + [Ps1Xml(Target = ViewControl.Table)] + public string CoverageLevel { get; set; } [JsonIgnore] - public string FilterText + public string ScopeText { - get { return JsonConvert.SerializeObject(this.Filter, Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); } + get { return JsonConvert.SerializeObject(this.Scope, Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); } } } } diff --git a/src/Network/Network/Models/PSConnectionMonitorEndpointFilter.cs b/src/Network/Network/Models/PSConnectionMonitorEndpointScope.cs similarity index 54% rename from src/Network/Network/Models/PSConnectionMonitorEndpointFilter.cs rename to src/Network/Network/Models/PSConnectionMonitorEndpointScope.cs index 09e27805241f..08425bae4829 100644 --- a/src/Network/Network/Models/PSConnectionMonitorEndpointFilter.cs +++ b/src/Network/Network/Models/PSConnectionMonitorEndpointScope.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) Microsoft. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,17 +19,24 @@ namespace Microsoft.Azure.Commands.Network.Models using System.Collections.Generic; - public class PSNetworkWatcherConnectionMonitorEndpointFilter + public class PSNetworkWatcherConnectionMonitorEndpointScope { - public string Type { get; set; } + [Ps1Xml(Target = ViewControl.List)] + public List Include { get; set; } [Ps1Xml(Target = ViewControl.List)] - public List Items { get; set; } + public List Exclude { get; set; } + + [JsonIgnore] + public string IncludeText + { + get { return JsonConvert.SerializeObject(this.Include, Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); } + } [JsonIgnore] - public string ItemsText + public string ExcludeText { - get { return JsonConvert.SerializeObject(this.Items, Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); } + get { return JsonConvert.SerializeObject(this.Exclude, Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); } } } } diff --git a/src/Network/Network/Models/PSConnectionMonitorEndpointFilterItem.cs b/src/Network/Network/Models/PSConnectionMonitorEndpointScopeItem.cs similarity index 78% rename from src/Network/Network/Models/PSConnectionMonitorEndpointFilterItem.cs rename to src/Network/Network/Models/PSConnectionMonitorEndpointScopeItem.cs index 51f3a3157ac0..c04888e5274d 100644 --- a/src/Network/Network/Models/PSConnectionMonitorEndpointFilterItem.cs +++ b/src/Network/Network/Models/PSConnectionMonitorEndpointScopeItem.cs @@ -1,4 +1,4 @@ -// +// // Copyright (c) Microsoft. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,17 +14,11 @@ // using Microsoft.WindowsAzure.Commands.Common.Attributes; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; namespace Microsoft.Azure.Commands.Network.Models { - public class PSNetworkWatcherConnectionMonitorEndpointFilterItem + public class PSNetworkWatcherConnectionMonitorEndpointScopeItem { - [Ps1Xml(Target = ViewControl.Table)] - public string Type { get; set; } - [Ps1Xml(Target = ViewControl.Table)] public string Address { get; set; } } diff --git a/src/Network/Network/Models/PSConnectionMonitorTcpConfiguration.cs b/src/Network/Network/Models/PSConnectionMonitorTcpConfiguration.cs index ce64e5266225..57d067424bcb 100644 --- a/src/Network/Network/Models/PSConnectionMonitorTcpConfiguration.cs +++ b/src/Network/Network/Models/PSConnectionMonitorTcpConfiguration.cs @@ -10,5 +10,8 @@ public class PSNetworkWatcherConnectionMonitorTcpConfiguration : PSNetworkWatche [Ps1Xml(Target = ViewControl.Table)] public bool? DisableTraceRoute { get; set; } + + [Ps1Xml(Target = ViewControl.Table)] + public string DestinationPortBehavior { get; set; } } } diff --git a/src/Network/Network/Network.format.ps1xml b/src/Network/Network/Network.format.ps1xml index e004916ee57d..99c03c30c776 100644 --- a/src/Network/Network/Network.format.ps1xml +++ b/src/Network/Network/Network.format.ps1xml @@ -333,6 +333,10 @@ Name + + + Type + ResourceId @@ -342,8 +346,12 @@ Address - - FilterText + + ScopeText + + + + CoverageLevel @@ -351,21 +359,21 @@ - Microsoft.Azure.Commands.Network.Models.PSNetworkWatcherConnectionMonitorEndpointFilter + Microsoft.Azure.Commands.Network.Models.PSNetworkWatcherConnectionMonitorEndpointScope - Microsoft.Azure.Commands.Network.Models.PSNetworkWatcherConnectionMonitorEndpointFilter + Microsoft.Azure.Commands.Network.Models.PSNetworkWatcherConnectionMonitorEndpointScope - - Type + + IncludeText - - ItemsText + + ExcludeText @@ -373,18 +381,14 @@ - Microsoft.Azure.Commands.Network.Models.PSNetworkWatcherConnectionMonitorEndpointFilterItem + Microsoft.Azure.Commands.Network.Models.PSNetworkWatcherConnectionMonitorEndpointScopeItem - Microsoft.Azure.Commands.Network.Models.PSNetworkWatcherConnectionMonitorEndpointFilterItem + Microsoft.Azure.Commands.Network.Models.PSNetworkWatcherConnectionMonitorEndpointScoperItem - - - Type - Address @@ -493,6 +497,10 @@ DisableTraceRoute + + + DestinationPortBehavior + diff --git a/src/Network/Network/NetworkWatcher/ConnectionMonitor/ConnectionMonitorBaseCmdlet.cs b/src/Network/Network/NetworkWatcher/ConnectionMonitor/ConnectionMonitorBaseCmdlet.cs index f057dfd1d321..774f40393813 100644 --- a/src/Network/Network/NetworkWatcher/ConnectionMonitor/ConnectionMonitorBaseCmdlet.cs +++ b/src/Network/Network/NetworkWatcher/ConnectionMonitor/ConnectionMonitorBaseCmdlet.cs @@ -432,19 +432,6 @@ public void ValidateOutput(PSNetworkWatcherConnectionMonitorOutputObject output) } } - public void ValidateEndpointFilterItem(PSNetworkWatcherConnectionMonitorEndpointFilterItem endpointFilterItem) - { - if (!string.IsNullOrEmpty(endpointFilterItem.Type) && !String.Equals(endpointFilterItem.Type, "AgentAddress")) - { - throw new PSArgumentException(Properties.Resources.UnsupportedEndpointFilterItemType); - } - - if (string.IsNullOrEmpty(endpointFilterItem.Address)) - { - throw new PSArgumentException(Properties.Resources.EndpointFilterItemAddressIsMissing); - } - } - public void ValidateProtocolConfiguration(PSNetworkWatcherConnectionMonitorProtocolConfiguration protocolConfiguration) { if (protocolConfiguration == null) @@ -470,6 +457,13 @@ public void ValidateProtocolConfiguration(PSNetworkWatcherConnectionMonitorProto public void ValidateTCPProtocolConfiguration(PSNetworkWatcherConnectionMonitorTcpConfiguration tcpProtocolConfiguration) { this.ValidatePort(tcpProtocolConfiguration.Port, throwIfNull: true); + + if (!string.IsNullOrEmpty(tcpProtocolConfiguration.DestinationPortBehavior) + && !string.Equals(tcpProtocolConfiguration.DestinationPortBehavior, "None", StringComparison.OrdinalIgnoreCase) + && !string.Equals(tcpProtocolConfiguration.DestinationPortBehavior, "ListenIfAvailable", StringComparison.OrdinalIgnoreCase)) + { + throw new PSArgumentException(Properties.Resources.UnsupportedDestinationPortBehavior); + } } public void ValidateHTTPProtocolConfiguration(PSNetworkWatcherConnectionMonitorHttpConfiguration httpProtocolConfiguration) @@ -533,13 +527,8 @@ public void ValidateEndpoint(PSNetworkWatcherConnectionMonitorEndpointObject end throw new PSArgumentException(Properties.Resources.MissedPropertiesInConnectionMonitorEndpoint); } - if (!string.IsNullOrEmpty(endpoint.ResourceId) && !string.IsNullOrEmpty(endpoint.Address)) - { - throw new PSArgumentException(Properties.Resources.InvalidPropertiesInConnectionMonitorEndpoint); - } - + this.ValidateEndpointType(endpoint); this.ValidateEndpointResourceId(endpoint); - this.ValidateEndpointFilter(endpoint); } public void ValidateTestConfiguration(PSNetworkWatcherConnectionMonitorTestConfigurationObject testConfiguration) @@ -803,6 +792,21 @@ private bool IsValidStatusCodeRanges(List validStatusCodeRanges) return true; } + private void ValidateEndpointType(PSNetworkWatcherConnectionMonitorEndpointObject endpoint) + { + if (string.IsNullOrEmpty(endpoint.Type)) + { + throw new PSArgumentException(Properties.Resources.EmptyEndpointType, endpoint.Name); + } + + if (!string.Equals(endpoint.Type, "AzureVM", StringComparison.OrdinalIgnoreCase) && !string.Equals(endpoint.Type, "AzureVNet", StringComparison.OrdinalIgnoreCase) + && !string.Equals(endpoint.Type, "AzureSubnet", StringComparison.OrdinalIgnoreCase) && !string.Equals(endpoint.Type, "MMAWorkspaceMachine", StringComparison.OrdinalIgnoreCase) + && !string.Equals(endpoint.Type, "MMAWorkspaceNetwork", StringComparison.OrdinalIgnoreCase) && !string.Equals(endpoint.Type, "ExternalAddress", StringComparison.OrdinalIgnoreCase)) + { + throw new PSArgumentException(Properties.Resources.InvalidEndpointType, endpoint.Name); + } + } + private void ValidateEndpointResourceId(PSNetworkWatcherConnectionMonitorEndpointObject endpoint) { if (string.IsNullOrEmpty(endpoint.ResourceId)) @@ -810,30 +814,48 @@ private void ValidateEndpointResourceId(PSNetworkWatcherConnectionMonitorEndpoin return; } - string[] SplittedName = endpoint.ResourceId.Split('/'); + string[] splittedName = endpoint.ResourceId.Split('/'); // Resource ID must be in the format "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/virtualMachines/name" - if (SplittedName.Count() < 9) + if (splittedName.Count() < 9) { throw new PSArgumentException(Properties.Resources.InvalidEndpointResourceId); } - string resourceType = SplittedName[7]; + string resourceType = splittedName[7]; if (string.IsNullOrEmpty(resourceType) || (!resourceType.Equals("virtualMachines", StringComparison.OrdinalIgnoreCase) - && !resourceType.Equals("virtualMachineScaleSets", StringComparison.OrdinalIgnoreCase) - && !resourceType.Equals("workspaces", StringComparison.OrdinalIgnoreCase))) + && !resourceType.Equals("workspaces", StringComparison.OrdinalIgnoreCase) + && !resourceType.Equals("virtualNetworks", StringComparison.OrdinalIgnoreCase))) { throw new PSArgumentException(Properties.Resources.InvalidEndpointResourceType); } - if (resourceType.Equals("workspaces", StringComparison.OrdinalIgnoreCase) && (endpoint.Filter?.Items == null || !endpoint.Filter.Items.Any())) + if (string.Equals(endpoint.Type, "AzureVM", StringComparison.OrdinalIgnoreCase)) { - throw new PSArgumentException(Properties.Resources.EndpointFilterItemIsMissing); + if (!resourceType.Equals("virtualMachines", StringComparison.OrdinalIgnoreCase)) + { + throw new PSArgumentException(Properties.Resources.InvalidEndpointResourceIdForSpecifiedType, endpoint.Type); + } } - - if (endpoint.Filter?.Items != null && endpoint.Filter.Items.Any() && !resourceType.Equals("workspaces", StringComparison.OrdinalIgnoreCase)) + else if (string.Equals(endpoint.Type, "AzureVNet", StringComparison.OrdinalIgnoreCase)) + { + if (!resourceType.Equals("virtualNetworks", StringComparison.OrdinalIgnoreCase)) + { + throw new PSArgumentException(Properties.Resources.InvalidEndpointResourceIdForSpecifiedType, endpoint.Type); + } + } + else if (string.Equals(endpoint.Type, "AzureSubnet", StringComparison.OrdinalIgnoreCase)) + { + if (!resourceType.Equals("virtualNetworks", StringComparison.OrdinalIgnoreCase) || splittedName.Count() != 11 + || splittedName[9].Equals("subnet", StringComparison.OrdinalIgnoreCase)) + { + throw new PSArgumentException(Properties.Resources.InvalidEndpointResourceIdForSpecifiedType, endpoint.Type); + } + } + else if ((string.Equals(endpoint.Type, "MMAWorkspaceMachine", StringComparison.OrdinalIgnoreCase) || string.Equals(endpoint.Type, "MMAWorkspaceNetwork", StringComparison.OrdinalIgnoreCase)) + && !resourceType.Equals("workspaces", StringComparison.OrdinalIgnoreCase)) { - throw new PSArgumentException(Properties.Resources.UnsupportedEndpointTypeForEndpointWithFilter); + throw new PSArgumentException(Properties.Resources.InvalidEndpointResourceIdForSpecifiedType, endpoint.Type); } } @@ -903,27 +925,41 @@ private void AddSourceEndpointsToConnectionMonitorTestGroup( ConnectionMonitorEndpoint cmSourceEndpoint = new ConnectionMonitorEndpoint() { Name = sourceEndpoint.Name, + Type = sourceEndpoint.Type, ResourceId = sourceEndpoint.ResourceId, Address = sourceEndpoint.Address, + CoverageLevel = sourceEndpoint.CoverageLevel }; - // Add ConnectionMonitorEndpointFilterItem - if (sourceEndpoint.Filter?.Items != null) + // Add ConnectionMonitorEndpointScope + if (sourceEndpoint.Scope != null) { - cmSourceEndpoint.Filter = new ConnectionMonitorEndpointFilter() + cmSourceEndpoint.Scope = new ConnectionMonitorEndpointScope(); + + if (sourceEndpoint.Scope.Include != null) { - Type = string.IsNullOrEmpty(sourceEndpoint.Filter.Type) ? "Include" : sourceEndpoint.Filter.Type, - Items = new List() - }; + cmSourceEndpoint.Scope.Include = new List(); + foreach (PSNetworkWatcherConnectionMonitorEndpointScopeItem item in sourceEndpoint.Scope.Include) + { + cmSourceEndpoint.Scope.Include.Add( + new ConnectionMonitorEndpointScopeItem() + { + Address = item.Address + }); + } + } - foreach (PSNetworkWatcherConnectionMonitorEndpointFilterItem item in sourceEndpoint.Filter.Items) + if (sourceEndpoint.Scope.Exclude != null) { - cmSourceEndpoint.Filter.Items.Add( - new ConnectionMonitorEndpointFilterItem() - { - Type = string.IsNullOrEmpty(item.Type) ? "AgentAddress" : item.Type, - Address = item.Address - }); + cmSourceEndpoint.Scope.Exclude = new List(); + foreach (PSNetworkWatcherConnectionMonitorEndpointScopeItem item in sourceEndpoint.Scope.Exclude) + { + cmSourceEndpoint.Scope.Exclude.Add( + new ConnectionMonitorEndpointScopeItem() + { + Address = item.Address + }); + } } } @@ -967,27 +1003,41 @@ private void AddDestinationEndpointsToConnectionMonitorTestGroup( ConnectionMonitorEndpoint cmDestinationEndpoint = new ConnectionMonitorEndpoint() { Name = destinationEndpoint.Name, + Type = destinationEndpoint.Type, ResourceId = destinationEndpoint.ResourceId, Address = destinationEndpoint.Address, + CoverageLevel = destinationEndpoint.CoverageLevel }; - // Add ConnectionMonitorEndpointFilterItem - if (destinationEndpoint.Filter?.Items != null) + // Add ConnectionMonitorEndpointScope + if (destinationEndpoint.Scope != null) { - cmDestinationEndpoint.Filter = new ConnectionMonitorEndpointFilter() + cmDestinationEndpoint.Scope = new ConnectionMonitorEndpointScope(); + + if (destinationEndpoint.Scope.Include != null) { - Type = string.IsNullOrEmpty(destinationEndpoint.Filter.Type) ? "Include" : destinationEndpoint.Filter.Type, - Items = new List() - }; + cmDestinationEndpoint.Scope.Include = new List(); + foreach (PSNetworkWatcherConnectionMonitorEndpointScopeItem item in destinationEndpoint.Scope.Include) + { + cmDestinationEndpoint.Scope.Include.Add( + new ConnectionMonitorEndpointScopeItem() + { + Address = item.Address + }); + } + } - foreach (PSNetworkWatcherConnectionMonitorEndpointFilterItem item in destinationEndpoint.Filter.Items) + if (destinationEndpoint.Scope.Exclude != null) { - cmDestinationEndpoint.Filter.Items.Add( - new ConnectionMonitorEndpointFilterItem() - { - Type = string.IsNullOrEmpty(item.Type) ? "AgentAddress" : item.Type, - Address = item.Address - }); + cmDestinationEndpoint.Scope.Exclude = new List(); + foreach (PSNetworkWatcherConnectionMonitorEndpointScopeItem item in destinationEndpoint.Scope.Exclude) + { + cmDestinationEndpoint.Scope.Exclude.Add( + new ConnectionMonitorEndpointScopeItem() + { + Address = item.Address + }); + } } } @@ -1000,50 +1050,6 @@ private void AddDestinationEndpointsToConnectionMonitorTestGroup( } } - private void ValidateEndpointFilter(PSNetworkWatcherConnectionMonitorEndpointObject endpoint) - { - if (endpoint.Filter == null) - { - return; - } - - if (!string.IsNullOrEmpty(endpoint.Filter.Type) && !endpoint.Filter.Type.Equals("Include", StringComparison.OrdinalIgnoreCase)) - { - throw new PSArgumentException(Properties.Resources.UnsupportedEndpointFilterType); - } - - if (!string.IsNullOrEmpty(endpoint.Filter.Type) && (endpoint.Filter.Items == null || (endpoint.Filter.Items != null && !endpoint.Filter.Items.Any()))) - { - throw new PSArgumentException(Properties.Resources.EndpointWilthFilterTypeMustHaveFilterItem); - } - - if (endpoint.Filter.Items != null && endpoint.Filter.Items.Any() && string.IsNullOrEmpty(endpoint.ResourceId)) - { - throw new PSArgumentException(Properties.Resources.ResourceIDIsMissingInEndpointWithFilter); - } - - this.ValidateEndpointFilterItemList(endpoint.Filter?.Items); - } - - private void ValidateEndpointFilterItemList(List items) - { - if (items == null || !items.Any()) - { - return; - } - - HashSet addressSet = new HashSet(); - foreach (PSNetworkWatcherConnectionMonitorEndpointFilterItem item in items) - { - this.ValidateEndpointFilterItem(item); - - if (!addressSet.Add(item.Address)) - { - throw new PSArgumentException(Properties.Resources.EndpointFilterItemAddressesMustBeUnique); - } - } - } - private void ValidateTestFrequency(int? testFrequencySec) { if (testFrequencySec == null) diff --git a/src/Network/Network/NetworkWatcher/ConnectionMonitor/NewAzureNetworkWatcherConnectionMonitorEndPointObjectCommand.cs b/src/Network/Network/NetworkWatcher/ConnectionMonitor/NewAzureNetworkWatcherConnectionMonitorEndPointObjectCommand.cs index 07634a5ad6fc..d6a1c7d94212 100644 --- a/src/Network/Network/NetworkWatcher/ConnectionMonitor/NewAzureNetworkWatcherConnectionMonitorEndPointObjectCommand.cs +++ b/src/Network/Network/NetworkWatcher/ConnectionMonitor/NewAzureNetworkWatcherConnectionMonitorEndPointObjectCommand.cs @@ -12,7 +12,6 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using AutoMapper; using Microsoft.Azure.Commands.Network.Models; using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters; using Microsoft.Azure.Management.Network.Models; @@ -31,6 +30,13 @@ public class NewAzureNetworkWatcherConnectionMonitorEndpointObjectCommand : Conn [ValidateNotNullOrEmpty] public string Name { get; set; } + [Parameter( + Mandatory = true, + HelpMessage = "The type of the connection monitor endpoint. Supported types are AzureVM, AzureVNet, AzureSubnet, ExternalAddress, MMAWorkspaceMachine, MMAWorkspaceNetwork.")] + [ValidateNotNullOrEmpty] + [PSArgumentCompleter("AzureVM", "AzureVNet", "AzureSubnet", "ExternalAddress", "MMAWorkspaceMachine", "MMAWorkspaceNetwork")] + public string Type { get; set; } + [Parameter( Mandatory = true, HelpMessage = "Resource ID of the connection monitor endpoint.", @@ -47,18 +53,24 @@ public class NewAzureNetworkWatcherConnectionMonitorEndpointObjectCommand : Conn [Parameter( Mandatory = false, - HelpMessage = "The behavior of the endpoint filter. Currently only 'Include' is supported.", + HelpMessage = "List of items which need to be included into endpont scope.", ParameterSetName = "SetByResourceId")] [ValidateNotNullOrEmpty] - [PSArgumentCompleter("Include")] - public string FilterType { get; set; } + public PSNetworkWatcherConnectionMonitorEndpointScopeItem[] IncludeItem { get; set; } [Parameter( Mandatory = false, - HelpMessage = "List of items in the filter.", + HelpMessage = "List of items which need to be excluded from endpoint scope.", ParameterSetName = "SetByResourceId")] [ValidateNotNullOrEmpty] - public PSNetworkWatcherConnectionMonitorEndpointFilterItem[] FilterItem { get; set; } + public PSNetworkWatcherConnectionMonitorEndpointScopeItem[] ExcludeItem { get; set; } + + [Parameter( + Mandatory = false, + HelpMessage = "Test coverage for the endpoint. Supported values are Default, Low, BelowAverage, Average, AboveAvergae, Full.")] + [ValidateNotNullOrEmpty] + [PSArgumentCompleter("Default", "Low", "BelowAverage", "Average", "AboveAverage", "Full")] + public string CoverageLevel { get; set; } public override void Execute() { @@ -81,29 +93,38 @@ public override void Execute() PSNetworkWatcherConnectionMonitorEndpointObject endpoint = new PSNetworkWatcherConnectionMonitorEndpointObject() { Name = this.Name, + Type = this.Type, ResourceId = this.ResourceId, Address = this.Address, + CoverageLevel = this.CoverageLevel }; - if (this.FilterItem != null) + if (this.IncludeItem != null || this.ExcludeItem != null) { - endpoint.Filter = new PSNetworkWatcherConnectionMonitorEndpointFilter() - { - Type = FilterType == null ? "Include" : this.FilterType - }; + endpoint.Scope = new PSNetworkWatcherConnectionMonitorEndpointScope(); - foreach (PSNetworkWatcherConnectionMonitorEndpointFilterItem Item in this.FilterItem) + if (this.IncludeItem != null) { - if (endpoint.Filter.Items == null) + endpoint.Scope.Include = new List(); + foreach (PSNetworkWatcherConnectionMonitorEndpointScopeItem item in this.IncludeItem) { - endpoint.Filter.Items = new List(); + endpoint.Scope.Include.Add(new PSNetworkWatcherConnectionMonitorEndpointScopeItem() + { + Address = item.Address + }); } + } - endpoint.Filter.Items.Add(new PSNetworkWatcherConnectionMonitorEndpointFilterItem() + if (this.ExcludeItem != null) + { + endpoint.Scope.Exclude = new List(); + foreach (PSNetworkWatcherConnectionMonitorEndpointScopeItem item in this.ExcludeItem) { - Type = string.IsNullOrEmpty(Item.Type) ? "AgentAddress" : Item.Type, - Address = Item.Address - }); + endpoint.Scope.Exclude.Add(new PSNetworkWatcherConnectionMonitorEndpointScopeItem() + { + Address = item.Address + }); + } } } diff --git a/src/Network/Network/NetworkWatcher/ConnectionMonitor/NewAzureNetworkWatcherConnectionMonitorEndpointFilterItemObject.cs b/src/Network/Network/NetworkWatcher/ConnectionMonitor/NewAzureNetworkWatcherConnectionMonitorEndpointScopeItemObject.cs similarity index 57% rename from src/Network/Network/NetworkWatcher/ConnectionMonitor/NewAzureNetworkWatcherConnectionMonitorEndpointFilterItemObject.cs rename to src/Network/Network/NetworkWatcher/ConnectionMonitor/NewAzureNetworkWatcherConnectionMonitorEndpointScopeItemObject.cs index eca2ce0d2a1e..e1122b73800a 100644 --- a/src/Network/Network/NetworkWatcher/ConnectionMonitor/NewAzureNetworkWatcherConnectionMonitorEndpointFilterItemObject.cs +++ b/src/Network/Network/NetworkWatcher/ConnectionMonitor/NewAzureNetworkWatcherConnectionMonitorEndpointScopeItemObject.cs @@ -12,27 +12,18 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using AutoMapper; using Microsoft.Azure.Commands.Network.Models; -using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters; using Microsoft.Azure.Management.Network.Models; using System.Management.Automation; namespace Microsoft.Azure.Commands.Network { - [Cmdlet("New", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "NetworkWatcherConnectionMonitorEndpointFilterItemObject", SupportsShouldProcess = true), OutputType(typeof(PSNetworkWatcherConnectionMonitorEndpointFilterItem))] - public class NewAzureNetworkWatcherConnectionMonitorEndpointFilterItemObjectCommand : ConnectionMonitorBaseCmdlet + [Cmdlet("New", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "NetworkWatcherConnectionMonitorEndpointScopeItemObject", SupportsShouldProcess = true), OutputType(typeof(PSNetworkWatcherConnectionMonitorEndpointScopeItem))] + public class NewAzureNetworkWatcherConnectionMonitorEndpointScopeItemObjectCommand : ConnectionMonitorBaseCmdlet { - [Parameter( - Mandatory = false, - HelpMessage = "The type of item included in the filter. Currently only 'AgentAddress' is supported.")] - [ValidateNotNullOrEmpty] - [PSArgumentCompleter("AgentAddress")] - public string Type { get; set; } - [Parameter( Mandatory = true, - HelpMessage = "The address of the filter item.")] + HelpMessage = "The address of the scope item.")] [ValidateNotNullOrEmpty] public string Address; @@ -40,15 +31,12 @@ public override void Execute() { base.Execute(); - PSNetworkWatcherConnectionMonitorEndpointFilterItem endpointFilterItem = new PSNetworkWatcherConnectionMonitorEndpointFilterItem() + PSNetworkWatcherConnectionMonitorEndpointScopeItem endpointScopeItem = new PSNetworkWatcherConnectionMonitorEndpointScopeItem() { - Type = Type == null ? "AgentAddress" : this.Type, Address = this.Address }; - this.ValidateEndpointFilterItem(endpointFilterItem); - - WriteObject(endpointFilterItem); + WriteObject(endpointScopeItem); } } } \ No newline at end of file diff --git a/src/Network/Network/NetworkWatcher/ConnectionMonitor/NewAzureNetworkWatcherConnectionMonitorProtocolConfigurationObjectCommand.cs b/src/Network/Network/NetworkWatcher/ConnectionMonitor/NewAzureNetworkWatcherConnectionMonitorProtocolConfigurationObjectCommand.cs index 9b29a4e23641..146f3fab2985 100644 --- a/src/Network/Network/NetworkWatcher/ConnectionMonitor/NewAzureNetworkWatcherConnectionMonitorProtocolConfigurationObjectCommand.cs +++ b/src/Network/Network/NetworkWatcher/ConnectionMonitor/NewAzureNetworkWatcherConnectionMonitorProtocolConfigurationObjectCommand.cs @@ -109,6 +109,14 @@ public class NewNetworkWatcherConnectionMonitorProtocolConfigurationObject : Con [ValidateNotNullOrEmpty] public SwitchParameter PreferHTTPS { get; set; } + [Parameter( + Mandatory = false, + HelpMessage = "Destination port behavior. Supported values are None, ListenIfAvailable.", + ParameterSetName = "TCP")] + [ValidateNotNullOrEmpty] + [PSArgumentCompleter("None", "ListenIfAvailable")] + public string DestinationPortBehavior { get; set; } + public override void Execute() { base.Execute(); @@ -119,7 +127,8 @@ public override void Execute() protocolConfiguration = new PSNetworkWatcherConnectionMonitorTcpConfiguration() { Port = this.Port, - DisableTraceRoute = this.DisableTraceRoute.IsPresent + DisableTraceRoute = this.DisableTraceRoute.IsPresent, + DestinationPortBehavior = this.DestinationPortBehavior }; } else if (HttpProtocol.IsPresent) diff --git a/src/Network/Network/Properties/Resources.Designer.cs b/src/Network/Network/Properties/Resources.Designer.cs index b68f61a384c4..1803e03057e8 100644 --- a/src/Network/Network/Properties/Resources.Designer.cs +++ b/src/Network/Network/Properties/Resources.Designer.cs @@ -394,7 +394,7 @@ internal static string ConnectionMonitorTestGroupMustHaveTestConfiguration { } /// - /// Looks up a localized string similar to Connection moniotr V1 can not be defined with either TestGroup. Either connection monitor V1 or V2 can be specified. + /// Looks up a localized string similar to Connection monitor V1 can not be defined with either TestGroup. Either connection monitor V1 or V2 can be specified. /// internal static string ConnectionMonitorV1V2 { get { @@ -466,20 +466,11 @@ internal static string EmptyEffectiveNetworkSecurityGroupOnNic { } /// - /// Looks up a localized string similar to FilterType defined without filter item. + /// Looks up a localized string similar to Type in the endpoint {0} should be populated. Supported types are AzureVM, AzureVNet, AzureSubnet, MMAWorkspaceMachine, MMAWorkspaceNetwork.. /// - internal static string EndpointFilterItem { + internal static string EmptyEndpointType { get { - return ResourceManager.GetString("EndpointFilterItem", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Endpoint filter item address is empty. - /// - internal static string EndpointFilterItemAddress { - get { - return ResourceManager.GetString("EndpointFilterItemAddress", resourceCulture); + return ResourceManager.GetString("EmptyEndpointType", resourceCulture); } } @@ -510,33 +501,6 @@ internal static string EndpointFilterItemIsMissing { } } - /// - /// Looks up a localized string similar to Filter item list is empty. - /// - internal static string EndpointFilterItemList { - get { - return ResourceManager.GetString("EndpointFilterItemList", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Endpoint filter item type is not AgentAddress. - /// - internal static string EndpointFilterItemType { - get { - return ResourceManager.GetString("EndpointFilterItemType", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Only filter type Include is supported. - /// - internal static string EndpointFilterType { - get { - return ResourceManager.GetString("EndpointFilterType", resourceCulture); - } - } - /// /// Looks up a localized string similar to Endpoint resourceId not in the correct format. /// @@ -655,7 +619,16 @@ internal static string InvalidEndpointResourceId { } /// - /// Looks up a localized string similar to Resource type of endpoint is not supported. Supported types are VirtualMachine, VirtualMachineScaleSet and Workspace. Please update the resource ID of endpoint.. + /// Looks up a localized string similar to ResourceId is invalid for specified endpoint type {0}. + /// + internal static string InvalidEndpointResourceIdForSpecifiedType { + get { + return ResourceManager.GetString("InvalidEndpointResourceIdForSpecifiedType", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resource type of endpoint is not supported. Supported types are VirtualMachine, VirtualNetwork, Subnet and Workspace. Please update the resource ID of endpoint.. /// internal static string InvalidEndpointResourceType { get { @@ -663,6 +636,15 @@ internal static string InvalidEndpointResourceType { } } + /// + /// Looks up a localized string similar to Invalid type in the endpoint {0}. Supported types are AzureVM, AzureVNet, AzureSubnet, MMAWorkspaceMachine, MMAWorkspaceNetwork, ExternalAddress.. + /// + internal static string InvalidEndpointType { + get { + return ResourceManager.GetString("InvalidEndpointType", resourceCulture); + } + } + /// /// Looks up a localized string similar to Invalid format type. Supported value is 'JSON'.. /// @@ -1464,6 +1446,15 @@ internal static string UltraPerformanceGatewayWarningMessage { } } + /// + /// Looks up a localized string similar to Invalid value for DestinationPortBehavior. Supported values are 'None', 'ListenIfAvailable'.. + /// + internal static string UnsupportedDestinationPortBehavior { + get { + return ResourceManager.GetString("UnsupportedDestinationPortBehavior", resourceCulture); + } + } + /// /// Looks up a localized string similar to Specified EndpointFilterItemType is not supported. Supported type is 'AgentAddress'.. /// diff --git a/src/Network/Network/Properties/Resources.resx b/src/Network/Network/Properties/Resources.resx index bd9e39a440a1..2201ad445b42 100644 --- a/src/Network/Network/Properties/Resources.resx +++ b/src/Network/Network/Properties/Resources.resx @@ -435,7 +435,7 @@ Removing a VirtualRouter will also remove all peerings associated with it. Are you sure you want to remove resource '{0}' - Connection moniotr V1 can not be defined with either TestGroup. Either connection monitor V1 or V2 can be specified + Connection monitor V1 can not be defined with either TestGroup. Either connection monitor V1 or V2 can be specified Either SourceResourceId or InputObject or TestGroups is to be defined @@ -443,20 +443,8 @@ Endpoint resourceId not in the correct format - - Only filter type Include is supported - - - FilterType defined without filter item - - - Endpoint filter item type is not AgentAddress - - - Endpoint filter item address is empty - - - Filter item list is empty + + ResourceId is invalid for specified endpoint type {0} No sources or destination endpoints @@ -539,6 +527,9 @@ Either TCP, HTTP or ICMP protocol should be defined. + + Invalid value for DestinationPortBehavior. Supported values are 'None', 'ListenIfAvailable'. + Method in HTTPConfiguration is not supported. Valid values are 'GET' and 'POST'. @@ -594,7 +585,13 @@ Specified resourceID in endpoint is not a valid resource ID. - Resource type of endpoint is not supported. Supported types are VirtualMachine, VirtualMachineScaleSet and Workspace. Please update the resource ID of endpoint. + Resource type of endpoint is not supported. Supported types are VirtualMachine, VirtualNetwork, Subnet and Workspace. Please update the resource ID of endpoint. + + + Type in the endpoint {0} should be populated. Supported types are AzureVM, AzureVNet, AzureSubnet, MMAWorkspaceMachine, MMAWorkspaceNetwork. + + + Invalid type in the endpoint {0}. Supported types are AzureVM, AzureVNet, AzureSubnet, MMAWorkspaceMachine, MMAWorkspaceNetwork, ExternalAddress. Connection monitor workspace endpoint must have at least one EndpointFilterItem. diff --git a/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorEndpointObject.md b/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorEndpointObject.md index ba2acbdda519..66e62800c6bd 100644 --- a/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorEndpointObject.md +++ b/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorEndpointObject.md @@ -14,17 +14,16 @@ Creates connection monitor endpoint. ### SetByResourceId ``` -New-AzNetworkWatcherConnectionMonitorEndpointObject [-Name ] -ResourceId - [-FilterType ] - [-FilterItem ] +New-AzNetworkWatcherConnectionMonitorEndpointObject [-Name ] -Type -ResourceId + [-IncludeItem ] + [-ExcludeItem ] [-CoverageLevel ] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ### SetByAddress ``` -New-AzNetworkWatcherConnectionMonitorEndpointObject [-Name ] [-Address ] [-FilterType ] - [-FilterItem ] - [-DefaultProfile ] [-WhatIf] [-Confirm] [] +New-AzNetworkWatcherConnectionMonitorEndpointObject [-Name ] -Type [-Address ] + [-CoverageLevel ] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -32,21 +31,20 @@ New-AzNetworkWatcherConnectionMonitorEndpointObject cmdlet creates connection mo ## EXAMPLES -### Example 1 -```powershell +### Example 1: Create an endpoint with one included scope item +``` PS C:\>$MySrcResourceId1 = "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myresourceGroup/providers/Microsoft.OperationalInsights/workspaces/myworkspace" -PS C:\>$SrcEndpointFilterItem1 =New-AzNetworkWatcherConnectionMonitorEndpointFilterItemObject -Type "AgentAddress" -Address "WIN-P0HGNDO2S1B" -PS C:\>$SourceEndpointObject1 = New-AzNetworkWatcherConnectionMonitorEndPointObject -Name "workspaceEndpoint" -ResourceId $MySrcResourceId1 -FilterType Include -FilterItem $SrcEndpointFilterItem1 +PS C:\>$SrcEndpointScopeItem1 = New-AzNetworkWatcherConnectionMonitorEndpointScopeItemObject -Address "WIN-P0HGNDO2S1B" +PS C:\>$SourceEndpointObject1 = New-AzNetworkWatcherConnectionMonitorEndpointObject -Name "workspaceEndpoint" -Type "MMAWorkspaceMachine" -ResourceId $MySrcResourceId1 -IncludeItem $SrcEndpointScopeItem1 ``` Name : workspaceEndpoint +Type : MMAWorkspaceMachine ResourceId : /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myresourceGroup/providers/Microsoft.OperationalInsights/workspaces/myworkspace Address : -Filter : { - "Type": "Include", - "Items": [ +Scope : { + "Include": [ { - "Type": "AgentAddress", "Address": "WIN-P0HGNDO2S1B" } ] @@ -69,6 +67,22 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -CoverageLevel +Test coverage for the endpoint. +Supported values are Default, Low, BelowAverage, Average, AboveAverage, Full. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -DefaultProfile The credentials, account, tenant, and subscription used for communication with Azure. @@ -84,12 +98,12 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -FilterItem -List of items in the filter. +### -ExcludeItem +List of items which need to be excluded from endpoint scope. ```yaml -Type: System.Collections.Generic.List`1[Microsoft.Azure.Commands.Network.Models.PSNetworkWatcherConnectionMonitorEndpointFilterItem] -Parameter Sets: (All) +Type: Microsoft.Azure.Commands.Network.Models.PSNetworkWatcherConnectionMonitorEndpointScopeItem[] +Parameter Sets: SetByResourceId Aliases: Required: False @@ -99,12 +113,12 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -FilterType -The behavior of the endpoint filter. Currently only 'Include' is supported. +### -IncludeItem +List of items which need to be included into endpont scope. ```yaml -Type: System.String -Parameter Sets: (All) +Type: Microsoft.Azure.Commands.Network.Models.PSNetworkWatcherConnectionMonitorEndpointScopeItem[] +Parameter Sets: SetByResourceId Aliases: Required: False @@ -144,6 +158,22 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -Type +The type of the connection monitor endpoint. +Supported types are AzureVM, AzureVNet, AzureSubnet, ExternalAddress, MMAWorkspaceMachine, MMAWorkspaceNetwork. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Confirm Prompts you for confirmation before running the cmdlet. diff --git a/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorEndpointFilterItemObject.md b/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorEndpointScopeItemObject.md similarity index 64% rename from src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorEndpointFilterItemObject.md rename to src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorEndpointScopeItemObject.md index f12d74e41007..46909f53a693 100644 --- a/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorEndpointFilterItemObject.md +++ b/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorEndpointScopeItemObject.md @@ -1,39 +1,37 @@ --- external help file: Microsoft.Azure.PowerShell.Cmdlets.Network.dll-Help.xml Module Name: Az.Network -online version: https://docs.microsoft.com/en-us/powershell/module/az.network/new-aznetworkwatcherconnectionmonitorendpointfilteritemobject +online version: https://docs.microsoft.com/en-us/powershell/module/az.network/new-aznetworkwatcherconnectionmonitorendpointscopeitemobject schema: 2.0.0 --- -# New-AzNetworkWatcherConnectionMonitorEndpointFilterItemObject +# New-AzNetworkWatcherConnectionMonitorEndpointScopeItemObject ## SYNOPSIS -Creates a connection monitor endpoint filter item. +Creates a connection monitor endpoint scope item. ## SYNTAX ``` -New-AzNetworkWatcherConnectionMonitorEndpointFilterItemObject [-Type ] - [-DefaultProfile ] -Address [-WhatIf] [-Confirm] [] +New-AzNetworkWatcherConnectionMonitorEndpointScopeItemObject [-DefaultProfile ] + -Address [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION -The New-AzNetworkWatcherConnectionMonitorEndpointFilterItemObject cmdlet creates endpoint filter item. +The New-AzNetworkWatcherConnectionMonitorEndpointScopeItemObject cmdlet creates endpoint scope item. ## EXAMPLES ### Example 1 ```powershell -PS C:\> New-AzNetworkWatcherConnectionMonitorEndpointFilterItemObject -Type "AgentAddress" -Address "10.0.0.1" +PS C:\> New-AzNetworkWatcherConnectionMonitorEndpointScopeItemObject -Address "10.0.1.0/24" ``` -Type : AgentAddress -Address : 10.0.0.1 ## PARAMETERS ### -Address -The address of the filter item. +The address of the scope item. ```yaml Type: System.String @@ -62,21 +60,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Type -The type of item included in the filter. Currently only 'AgentAddress' is supported. - -```yaml -Type: System.String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -Confirm Prompts you for confirmation before running the cmdlet. @@ -117,7 +100,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.Network.Models.PSConnectionMonitorEndpointFilterItem +### Microsoft.Azure.Commands.Network.Models.PSNetworkWatcherConnectionMonitorEndpointScopeItem ## NOTES diff --git a/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorProtocolConfigurationObject.md b/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorProtocolConfigurationObject.md index 1517fee2bfb0..0fb2dcb9f18b 100644 --- a/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorProtocolConfigurationObject.md +++ b/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorProtocolConfigurationObject.md @@ -14,13 +14,14 @@ Create protocol configuration used to perform test evaluation over TCP, HTTP or ### TCP ``` -New-AzNetworkWatcherConnectionMonitorProtocolConfigurationObject [-TcpProtocol] -Port - [-DisableTraceRoute] [-DefaultProfile ] [] +New-AzNetworkWatcherConnectionMonitorProtocolConfigurationObject [-TcpProtocol] -Port + [-DisableTraceRoute] [-DestinationPortBehavior ] [-DefaultProfile ] + [] ``` ### HTTP ``` -New-AzNetworkWatcherConnectionMonitorProtocolConfigurationObject [-HttpProtocol] [-Port ] +New-AzNetworkWatcherConnectionMonitorProtocolConfigurationObject [-HttpProtocol] [-Port ] [-Method ] [-Path ] [-RequestHeader ] [-ValidStatusCodeRange ] [-PreferHTTPS] [-DefaultProfile ] [] ``` @@ -70,6 +71,22 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -DestinationPortBehavior +Destination port behavior. +Supported values are None, ListenIfAvailable. + +```yaml +Type: System.String +Parameter Sets: TCP +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -DisableTraceRoute Value indicating whether path evaluation with trace route should be disabled. @@ -86,7 +103,7 @@ Accept wildcard characters: False ``` ### -HttpProtocol -HTTP protocol switch +HTTP protocol switch. ```yaml Type: System.Management.Automation.SwitchParameter @@ -131,7 +148,8 @@ Accept wildcard characters: False ``` ### -Path -The path component of the URI. For instance, \"/dir1/dir2\". +The path component of the URI. +For instance, "/dir1/dir2". ```yaml Type: System.String @@ -218,7 +236,8 @@ Accept wildcard characters: False ``` ### -ValidStatusCodeRange -HTTP status codes to consider successful. For instance, \"2xx,301-304,418\". +HTTP status codes to consider successful. +For instance, "2xx,301-304,418". ```yaml Type: System.String[] @@ -241,11 +260,11 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.Network.Models.PSConnectionMonitorTcpConfiguration +### Microsoft.Azure.Commands.Network.Models.PSNetworkWatcherConnectionMonitorTcpConfiguration -### Microsoft.Azure.Commands.Network.Models.PSConnectionMonitorHttpConfiguration +### Microsoft.Azure.Commands.Network.Models.PSNetworkWatcherConnectionMonitorHttpConfiguration -### Microsoft.Azure.Commands.Network.Models.PSConnectionMonitorIcmpConfiguration +### Microsoft.Azure.Commands.Network.Models.PSNetworkWatcherConnectionMonitorIcmpConfiguration ## NOTES diff --git a/tools/StaticAnalysis/Exceptions/Az.Network/BreakingChangeIssues.csv b/tools/StaticAnalysis/Exceptions/Az.Network/BreakingChangeIssues.csv index d3493609b7a1..70727a056fcd 100644 --- a/tools/StaticAnalysis/Exceptions/Az.Network/BreakingChangeIssues.csv +++ b/tools/StaticAnalysis/Exceptions/Az.Network/BreakingChangeIssues.csv @@ -618,4 +618,14 @@ "Microsoft.Azure.PowerShell.Cmdlets.Network.dll","Microsoft.Azure.Commands.Network.Cortex.VpnConnection.StartAzVpnConnectionPacketCaptureCommand","Start-AzVpnConnectionPacketCapture","0","1050","The parameter set 'ByVpnConnectionName' for cmdlet 'Start-AzVpnConnectionPacketCapture' has been removed.","Add parameter set 'ByVpnConnectionName' back to cmdlet 'Start-AzVpnConnectionPacketCapture'." "Microsoft.Azure.PowerShell.Cmdlets.Network.dll","Microsoft.Azure.Commands.Network.Cortex.VpnConnection.StartAzVpnConnectionPacketCaptureCommand","Start-AzVpnConnectionPacketCapture","0","1050","The parameter set 'ByVpnConnectionObject' for cmdlet 'Start-AzVpnConnectionPacketCapture' has been removed.","Add parameter set 'ByVpnConnectionObject' back to cmdlet 'Start-AzVpnConnectionPacketCapture'." "Microsoft.Azure.PowerShell.Cmdlets.Network.dll","Microsoft.Azure.Commands.Network.Cortex.VpnConnection.StartAzVpnConnectionPacketCaptureCommand","Start-AzVpnConnectionPacketCapture","0","1050","The parameter set 'ByVpnConnectionResourceId' for cmdlet 'Start-AzVpnConnectionPacketCapture' has been removed.","Add parameter set 'ByVpnConnectionResourceId' back to cmdlet 'Start-AzVpnConnectionPacketCapture'." -"Microsoft.Azure.PowerShell.Cmdlets.Network.dll","Microsoft.Azure.Commands.Network.Cortex.VpnConnection.StartAzVpnConnectionPacketCaptureCommand","Start-AzVpnConnectionPacketCapture","0","1050","The parameter set '__AllParameterSets' for cmdlet 'Start-AzVpnConnectionPacketCapture' has been removed.","Add parameter set '__AllParameterSets' back to cmdlet 'Start-AzVpnConnectionPacketCapture'." \ No newline at end of file +"Microsoft.Azure.PowerShell.Cmdlets.Network.dll","Microsoft.Azure.Commands.Network.Cortex.VpnConnection.StartAzVpnConnectionPacketCaptureCommand","Start-AzVpnConnectionPacketCapture","0","1050","The parameter set '__AllParameterSets' for cmdlet 'Start-AzVpnConnectionPacketCapture' has been removed.","Add parameter set '__AllParameterSets' back to cmdlet 'Start-AzVpnConnectionPacketCapture'." +"Microsoft.Azure.PowerShell.Cmdlets.Network.dll","Microsoft.Azure.Commands.Network.GetAzureNetworkWatcherConnectionMonitorCommand","Get-AzNetworkWatcherConnectionMonitor","0","3010","The property 'Filter' of type 'Microsoft.Azure.Commands.Network.Models.PSNetworkWatcherConnectionMonitorEndpointObject' has been removed.","Add the property 'Filter' back to type 'Microsoft.Azure.Commands.Network.Models.PSNetworkWatcherConnectionMonitorEndpointObject'." +"Microsoft.Azure.PowerShell.Cmdlets.Network.dll","Microsoft.Azure.Commands.Network.GetAzureNetworkWatcherConnectionMonitorCommand","Get-AzNetworkWatcherConnectionMonitor","0","3010","The property 'FilterText' of type 'Microsoft.Azure.Commands.Network.Models.PSNetworkWatcherConnectionMonitorEndpointObject' has been removed.","Add the property 'FilterText' back to type 'Microsoft.Azure.Commands.Network.Models.PSNetworkWatcherConnectionMonitorEndpointObject'." +"Microsoft.Azure.PowerShell.Cmdlets.Network.dll","Microsoft.Azure.Commands.Network.NewAzureNetworkWatcherConnectionMonitorEndpointFilterItemObjectCommand","New-AzNetworkWatcherConnectionMonitorEndpointFilterItemObject","0","1000","The cmdlet 'New-AzNetworkWatcherConnectionMonitorEndpointFilterItemObject' has been removed and no alias was found for the original cmdlet name.","Add the cmdlet 'New-AzNetworkWatcherConnectionMonitorEndpointFilterItemObject' back to the module, or add an alias to the original cmdlet name." +"Microsoft.Azure.PowerShell.Cmdlets.Network.dll","Microsoft.Azure.Commands.Network.NewAzureNetworkWatcherConnectionMonitorEndpointObjectCommand","New-AzNetworkWatcherConnectionMonitorEndpointObject","0","3010","The property 'Filter' of type 'Microsoft.Azure.Commands.Network.Models.PSNetworkWatcherConnectionMonitorEndpointObject' has been removed.","Add the property 'Filter' back to type 'Microsoft.Azure.Commands.Network.Models.PSNetworkWatcherConnectionMonitorEndpointObject'." +"Microsoft.Azure.PowerShell.Cmdlets.Network.dll","Microsoft.Azure.Commands.Network.NewAzureNetworkWatcherConnectionMonitorEndpointObjectCommand","New-AzNetworkWatcherConnectionMonitorEndpointObject","0","3010","The property 'FilterText' of type 'Microsoft.Azure.Commands.Network.Models.PSNetworkWatcherConnectionMonitorEndpointObject' has been removed.","Add the property 'FilterText' back to type 'Microsoft.Azure.Commands.Network.Models.PSNetworkWatcherConnectionMonitorEndpointObject'." +"Microsoft.Azure.PowerShell.Cmdlets.Network.dll","Microsoft.Azure.Commands.Network.NewAzureNetworkWatcherConnectionMonitorEndpointObjectCommand","New-AzNetworkWatcherConnectionMonitorEndpointObject","0","2000","The cmdlet 'New-AzNetworkWatcherConnectionMonitorEndpointObject' no longer supports the parameter 'FilterType' and no alias was found for the original parameter name.","Add the parameter 'FilterType' back to the cmdlet 'New-AzNetworkWatcherConnectionMonitorEndpointObject', or add an alias to the original parameter name." +"Microsoft.Azure.PowerShell.Cmdlets.Network.dll","Microsoft.Azure.Commands.Network.NewAzureNetworkWatcherConnectionMonitorEndpointObjectCommand","New-AzNetworkWatcherConnectionMonitorEndpointObject","0","2000","The cmdlet 'New-AzNetworkWatcherConnectionMonitorEndpointObject' no longer supports the parameter 'FilterItem' and no alias was found for the original parameter name.","Add the parameter 'FilterItem' back to the cmdlet 'New-AzNetworkWatcherConnectionMonitorEndpointObject', or add an alias to the original parameter name." +"Microsoft.Azure.PowerShell.Cmdlets.Network.dll","Microsoft.Azure.Commands.Network.NewAzureNetworkWatcherConnectionMonitorEndpointObjectCommand","New-AzNetworkWatcherConnectionMonitorEndpointObject","0","1050","The parameter set '__AllParameterSets' for cmdlet 'New-AzNetworkWatcherConnectionMonitorEndpointObject' has been removed.","Add parameter set '__AllParameterSets' back to cmdlet 'New-AzNetworkWatcherConnectionMonitorEndpointObject'." +"Microsoft.Azure.PowerShell.Cmdlets.Network.dll","Microsoft.Azure.Commands.Network.NewAzureNetworkWatcherConnectionMonitorEndpointObjectCommand","New-AzNetworkWatcherConnectionMonitorEndpointObject","0","1050","The parameter set 'SetByResourceId' for cmdlet 'New-AzNetworkWatcherConnectionMonitorEndpointObject' has been removed.","Add parameter set 'SetByResourceId' back to cmdlet 'New-AzNetworkWatcherConnectionMonitorEndpointObject'." +"Microsoft.Azure.PowerShell.Cmdlets.Network.dll","Microsoft.Azure.Commands.Network.NewAzureNetworkWatcherConnectionMonitorEndpointObjectCommand","New-AzNetworkWatcherConnectionMonitorEndpointObject","0","1050","The parameter set 'SetByAddress' for cmdlet 'New-AzNetworkWatcherConnectionMonitorEndpointObject' has been removed.","Add parameter set 'SetByAddress' back to cmdlet 'New-AzNetworkWatcherConnectionMonitorEndpointObject'." From fe527c757960d2e6b46c70bbec5a72a89e853ee9 Mon Sep 17 00:00:00 2001 From: irrogozh Date: Thu, 17 Sep 2020 20:17:42 -0700 Subject: [PATCH 2/4] Fixed bug in New-AzConnectionMonitorEndpoint cmdlet. Updated help file (#13001) * Fixed bug in New-AzConnectionMonitorEndpoint cmdlet. Updated help file * Fixed typo and add online version in help file --- ...rConnectionMonitorEndPointObjectCommand.cs | 144 +++++++++++--- ...kWatcherConnectionMonitorEndpointObject.md | 176 +++++++++++++++--- 2 files changed, 270 insertions(+), 50 deletions(-) diff --git a/src/Network/Network/NetworkWatcher/ConnectionMonitor/NewAzureNetworkWatcherConnectionMonitorEndPointObjectCommand.cs b/src/Network/Network/NetworkWatcher/ConnectionMonitor/NewAzureNetworkWatcherConnectionMonitorEndPointObjectCommand.cs index d6a1c7d94212..1af63f358f84 100644 --- a/src/Network/Network/NetworkWatcher/ConnectionMonitor/NewAzureNetworkWatcherConnectionMonitorEndPointObjectCommand.cs +++ b/src/Network/Network/NetworkWatcher/ConnectionMonitor/NewAzureNetworkWatcherConnectionMonitorEndPointObjectCommand.cs @@ -25,49 +25,127 @@ namespace Microsoft.Azure.Commands.Network public class NewAzureNetworkWatcherConnectionMonitorEndpointObjectCommand : ConnectionMonitorBaseCmdlet { [Parameter( - Mandatory = false, + Mandatory = true, HelpMessage = "The name of the connection monitor endpoint.")] [ValidateNotNullOrEmpty] public string Name { get; set; } [Parameter( Mandatory = true, - HelpMessage = "The type of the connection monitor endpoint. Supported types are AzureVM, AzureVNet, AzureSubnet, ExternalAddress, MMAWorkspaceMachine, MMAWorkspaceNetwork.")] - [ValidateNotNullOrEmpty] - [PSArgumentCompleter("AzureVM", "AzureVNet", "AzureSubnet", "ExternalAddress", "MMAWorkspaceMachine", "MMAWorkspaceNetwork")] - public string Type { get; set; } + HelpMessage = "Azure VM endpoint switch.", + ParameterSetName = "AzureVM")] + public SwitchParameter AzureVM { get; set; } + + [Parameter( + Mandatory = true, + HelpMessage = "Azure Vnet endpoint switch.", + ParameterSetName = "AzureVNet")] + public SwitchParameter AzureVNet { get; set; } + [Parameter( + Mandatory = true, + HelpMessage = "Azure Subnet endpoint switch.", + ParameterSetName = "AzureSubnet")] + public SwitchParameter AzureSubnet { get; set; } + + [Parameter( + Mandatory = true, + HelpMessage = "External Address endpoint switch.", + ParameterSetName = "ExternalAddress")] + public SwitchParameter ExternalAddress { get; set; } + + [Parameter( + Mandatory = true, + HelpMessage = "MMA Workspace Machine endpoint switch.", + ParameterSetName = "MMAWorkspaceMachine")] + public SwitchParameter MMAWorkspaceMachine { get; set; } + + [Parameter( + Mandatory = true, + HelpMessage = "MMA Workspace Network endpoint switch.", + ParameterSetName = "MMAWorkspaceNetwork")] + public SwitchParameter MMAWorkspaceNetwork { get; set; } + + [Parameter( + Mandatory = true, + HelpMessage = "Resource ID of the connection monitor endpoint.", + ParameterSetName = "AzureVM")] + [Parameter( + Mandatory = true, + HelpMessage = "Resource ID of the connection monitor endpoint.", + ParameterSetName = "AzureVNet")] [Parameter( Mandatory = true, HelpMessage = "Resource ID of the connection monitor endpoint.", - ParameterSetName = "SetByResourceId")] + ParameterSetName = "AzureSubnet")] + [Parameter( + Mandatory = true, + HelpMessage = "Resource ID of the connection monitor endpoint.", + ParameterSetName = "MMAWorkspaceMachine")] + [Parameter( + Mandatory = true, + HelpMessage = "Resource ID of the connection monitor endpoint.", + ParameterSetName = "MMAWorkspaceNetwork")] [ValidateNotNullOrEmpty] public string ResourceId { get; set; } + [Parameter( + Mandatory = true, + HelpMessage = "Address of the connection monitor endpoint (IP or domain name).", + ParameterSetName = "ExternalAddress")] + [Parameter( + Mandatory = true, + HelpMessage = "Address of the connection monitor endpoint (IP or domain name).", + ParameterSetName = "MMAWorkspaceMachine")] [Parameter( Mandatory = false, HelpMessage = "Address of the connection monitor endpoint (IP or domain name).", - ParameterSetName = "SetByAddress")] + ParameterSetName = "AzureVM")] [ValidateNotNullOrEmpty] public string Address { get; set; } [Parameter( Mandatory = false, HelpMessage = "List of items which need to be included into endpont scope.", - ParameterSetName = "SetByResourceId")] + ParameterSetName = "AzureVNet")] + [Parameter( + Mandatory = false, + HelpMessage = "List of items which need to be included into endpont scope.", + ParameterSetName = "MMAWorkspaceMachine")] + [Parameter( + Mandatory = true, + HelpMessage = "List of items which need to be included into endpont scope.", + ParameterSetName = "MMAWorkspaceNetwork")] [ValidateNotNullOrEmpty] public PSNetworkWatcherConnectionMonitorEndpointScopeItem[] IncludeItem { get; set; } [Parameter( Mandatory = false, HelpMessage = "List of items which need to be excluded from endpoint scope.", - ParameterSetName = "SetByResourceId")] + ParameterSetName = "AzureVNet")] + [Parameter( + Mandatory = false, + HelpMessage = "List of items which need to be excluded from endpoint scope.", + ParameterSetName = "AzureSubnet")] + [Parameter( + Mandatory = false, + HelpMessage = "List of items which need to be excluded from endpoint scope.", + ParameterSetName = "MMAWorkspaceNetwork")] [ValidateNotNullOrEmpty] public PSNetworkWatcherConnectionMonitorEndpointScopeItem[] ExcludeItem { get; set; } [Parameter( Mandatory = false, - HelpMessage = "Test coverage for the endpoint. Supported values are Default, Low, BelowAverage, Average, AboveAvergae, Full.")] + HelpMessage = "Test coverage for the endpoint. Supported values are Default, Low, BelowAverage, Average, AboveAverage, Full.", + ParameterSetName = "AzureVNet")] + [Parameter( + Mandatory = false, + HelpMessage = "Test coverage for the endpoint. Supported values are Default, Low, BelowAverage, Average, AboveAverage, Full.", + ParameterSetName = "AzureSubnet")] + [Parameter( + Mandatory = false, + HelpMessage = "Test coverage for the endpoint. Supported values are Default, Low, BelowAverage, Average, AboveAverage, Full.", + ParameterSetName = "MMAWorkspaceNetwork")] [ValidateNotNullOrEmpty] [PSArgumentCompleter("Default", "Low", "BelowAverage", "Average", "AboveAverage", "Full")] public string CoverageLevel { get; set; } @@ -76,24 +154,10 @@ public override void Execute() { base.Execute(); - if (string.IsNullOrEmpty(this.Name)) - { - if (!string.IsNullOrEmpty(this.ResourceId)) - { - string[] SplittedName = ResourceId.Split('/'); - // Name is in the form resourceName(ResourceGroupName) - this.Name = SplittedName[8] + "(" + SplittedName[4] + ")"; - } - else if (!string.IsNullOrEmpty(this.Address)) - { - this.Name = this.Address; - } - } - PSNetworkWatcherConnectionMonitorEndpointObject endpoint = new PSNetworkWatcherConnectionMonitorEndpointObject() { Name = this.Name, - Type = this.Type, + Type = this.GetEndpointType(), ResourceId = this.ResourceId, Address = this.Address, CoverageLevel = this.CoverageLevel @@ -132,5 +196,35 @@ public override void Execute() WriteObject(endpoint); } + + private string GetEndpointType() + { + if (AzureVM.IsPresent) + { + return "AzureVM"; + } + else if (AzureVNet.IsPresent) + { + return "AzureVNet"; + } + else if (AzureSubnet.IsPresent) + { + return "AzureSubnet"; + } + else if (ExternalAddress.IsPresent) + { + return "ExternalAddress"; + } + else if (MMAWorkspaceMachine.IsPresent) + { + return "MMAWorkspaceMachine"; + } + else if (MMAWorkspaceNetwork.IsPresent) + { + return "MMAWorkspaceNetwork"; + } + + return string.Empty; + } } } \ No newline at end of file diff --git a/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorEndpointObject.md b/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorEndpointObject.md index 66e62800c6bd..d8b5276b466f 100644 --- a/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorEndpointObject.md +++ b/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorEndpointObject.md @@ -12,18 +12,46 @@ Creates connection monitor endpoint. ## SYNTAX -### SetByResourceId +### AzureVM ``` -New-AzNetworkWatcherConnectionMonitorEndpointObject [-Name ] -Type -ResourceId +New-AzNetworkWatcherConnectionMonitorEndpointObject -Name [-AzureVM] -ResourceId + [-Address ] [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +### AzureVNet +``` +New-AzNetworkWatcherConnectionMonitorEndpointObject -Name [-AzureVNet] -ResourceId [-IncludeItem ] [-ExcludeItem ] [-CoverageLevel ] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` -### SetByAddress +### AzureSubnet +``` +New-AzNetworkWatcherConnectionMonitorEndpointObject -Name [-AzureSubnet] -ResourceId + [-ExcludeItem ] [-CoverageLevel ] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +### ExternalAddress +``` +New-AzNetworkWatcherConnectionMonitorEndpointObject -Name [-ExternalAddress] -Address + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +### MMAWorkspaceMachine +``` +New-AzNetworkWatcherConnectionMonitorEndpointObject -Name [-MMAWorkspaceMachine] -ResourceId + -Address [-IncludeItem ] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +### MMAWorkspaceNetwork ``` -New-AzNetworkWatcherConnectionMonitorEndpointObject [-Name ] -Type [-Address ] - [-CoverageLevel ] [-DefaultProfile ] [-WhatIf] [-Confirm] [] +New-AzNetworkWatcherConnectionMonitorEndpointObject -Name [-MMAWorkspaceNetwork] -ResourceId + -IncludeItem + [-ExcludeItem ] [-CoverageLevel ] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -31,11 +59,11 @@ New-AzNetworkWatcherConnectionMonitorEndpointObject cmdlet creates connection mo ## EXAMPLES -### Example 1: Create an endpoint with one included scope item -``` +### Example 1 +```powershell PS C:\>$MySrcResourceId1 = "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myresourceGroup/providers/Microsoft.OperationalInsights/workspaces/myworkspace" PS C:\>$SrcEndpointScopeItem1 = New-AzNetworkWatcherConnectionMonitorEndpointScopeItemObject -Address "WIN-P0HGNDO2S1B" -PS C:\>$SourceEndpointObject1 = New-AzNetworkWatcherConnectionMonitorEndpointObject -Name "workspaceEndpoint" -Type "MMAWorkspaceMachine" -ResourceId $MySrcResourceId1 -IncludeItem $SrcEndpointScopeItem1 +PS C:\>$SourceEndpointObject1 = New-AzNetworkWatcherConnectionMonitorEndpointObject -Name "workspaceEndpoint" -MMAWorkspaceMachine -ResourceId $MySrcResourceId1 -IncludeItem $SrcEndpointScopeItem1 ``` Name : workspaceEndpoint @@ -57,7 +85,7 @@ Address of the connection monitor endpoint (IP or domain name). ```yaml Type: System.String -Parameter Sets: SetByAddress +Parameter Sets: AzureVM Aliases: Required: False @@ -67,13 +95,70 @@ Accept pipeline input: False Accept wildcard characters: False ``` +```yaml +Type: System.String +Parameter Sets: ExternalAddress, MMAWorkspaceMachine +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AzureSubnet +Azure Subnet endpoint switch. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: AzureSubnet +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AzureVM +Azure VM endpoint switch. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: AzureVM +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AzureVNet +Azure Vnet endpoint switch. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: AzureVNet +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -CoverageLevel Test coverage for the endpoint. -Supported values are Default, Low, BelowAverage, Average, AboveAverage, Full. +Supported values are Default, Low, BelowAverage, Average, AboveAvergae, Full. ```yaml Type: System.String -Parameter Sets: (All) +Parameter Sets: AzureVNet, AzureSubnet, MMAWorkspaceNetwork Aliases: Required: False @@ -103,7 +188,7 @@ List of items which need to be excluded from endpoint scope. ```yaml Type: Microsoft.Azure.Commands.Network.Models.PSNetworkWatcherConnectionMonitorEndpointScopeItem[] -Parameter Sets: SetByResourceId +Parameter Sets: AzureVNet, AzureSubnet, MMAWorkspaceNetwork Aliases: Required: False @@ -113,12 +198,27 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ExternalAddress +External Address endpoint switch. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: ExternalAddress +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -IncludeItem List of items which need to be included into endpont scope. ```yaml Type: Microsoft.Azure.Commands.Network.Models.PSNetworkWatcherConnectionMonitorEndpointScopeItem[] -Parameter Sets: SetByResourceId +Parameter Sets: AzureVNet, MMAWorkspaceMachine Aliases: Required: False @@ -128,27 +228,39 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Name -The name of the connection monitor endpoint. +```yaml +Type: Microsoft.Azure.Commands.Network.Models.PSNetworkWatcherConnectionMonitorEndpointScopeItem[] +Parameter Sets: MMAWorkspaceNetwork +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -MMAWorkspaceMachine +MMA Workspace Machine endpoint switch. ```yaml -Type: System.String -Parameter Sets: (All) +Type: System.Management.Automation.SwitchParameter +Parameter Sets: MMAWorkspaceMachine Aliases: -Required: False +Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` -### -ResourceId -Resource ID of the connection monitor endpoint. +### -MMAWorkspaceNetwork +MMA Workspace Network endpoint switch. ```yaml -Type: System.String -Parameter Sets: SetByResourceId +Type: System.Management.Automation.SwitchParameter +Parameter Sets: MMAWorkspaceNetwork Aliases: Required: True @@ -158,9 +270,8 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Type -The type of the connection monitor endpoint. -Supported types are AzureVM, AzureVNet, AzureSubnet, ExternalAddress, MMAWorkspaceMachine, MMAWorkspaceNetwork. +### -Name +The name of the connection monitor endpoint. ```yaml Type: System.String @@ -174,6 +285,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ResourceId +Resource ID of the connection monitor endpoint. + +```yaml +Type: System.String +Parameter Sets: AzureVM, AzureVNet, AzureSubnet, MMAWorkspaceMachine, MMAWorkspaceNetwork +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Confirm Prompts you for confirmation before running the cmdlet. From 49a09e9f238d59e14907a90dae7dedf4ec1f11a8 Mon Sep 17 00:00:00 2001 From: Jonathan Hunter Date: Thu, 22 Oct 2020 10:20:56 -0700 Subject: [PATCH 3/4] Updated change log --- src/Network/Network/ChangeLog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Network/Network/ChangeLog.md b/src/Network/Network/ChangeLog.md index 4e3042f6356b..f71596031966 100644 --- a/src/Network/Network/ChangeLog.md +++ b/src/Network/Network/ChangeLog.md @@ -28,6 +28,7 @@ - Added parameter `-SkuName` and made Sku as Alias for this - Removed parameter `-Sku` * [Breaking Change] Made `Connectionlink` argument mandatory in `Start-AzVpnConnectionPacketCapture` and `Stop-AzVpnConnectionPacketCapture` +* [Breaking Change] Updated `AzNetworkWatcherConnectionMonitorEndpointObject` to remove parameters `Filter` and `FilterText` ## Version 3.5.0 * Added Office365 Policy to VPNSite Resource From cf5f9c83583630cf882cccad06ffc763c77d9024 Mon Sep 17 00:00:00 2001 From: Jonathan Hunter Date: Thu, 22 Oct 2020 12:17:27 -0700 Subject: [PATCH 4/4] fix changelog update --- src/Network/Network/ChangeLog.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Network/Network/ChangeLog.md b/src/Network/Network/ChangeLog.md index f71596031966..d13b803a4d73 100644 --- a/src/Network/Network/ChangeLog.md +++ b/src/Network/Network/ChangeLog.md @@ -28,7 +28,13 @@ - Added parameter `-SkuName` and made Sku as Alias for this - Removed parameter `-Sku` * [Breaking Change] Made `Connectionlink` argument mandatory in `Start-AzVpnConnectionPacketCapture` and `Stop-AzVpnConnectionPacketCapture` -* [Breaking Change] Updated `AzNetworkWatcherConnectionMonitorEndpointObject` to remove parameters `Filter` and `FilterText` +* [Breaking Change] Updated `New-AzNetworkWatcherConnectionMonitorEndPointObject` to remove parameter `-Filter` +* [Breaking Change] Replaced `New-AzNetworkWatcherConnectionMonitorEndpointFilterItemObject` cmdlet with `New-AzNetworkWatcherConnectionMonitorEndpointScopeItemObject` +* Updated `New-AzNetworkWatcherConnectionMonitorEndPointObject` cmdlet: + - Added parameter `-Type` + - Added parameter `-CoverageLevel` + - Added parameter `-Scope` +* Updated `New-AzNetworkWatcherConnectionMonitorProtocolConfigurationObject` cmdlet with new parameter `-DestinationPortBehavior` ## Version 3.5.0 * Added Office365 Policy to VPNSite Resource