From 2232d68d3dc6a69d6e24d442bb48dd3e6d9dec58 Mon Sep 17 00:00:00 2001 From: Irina Rogozhkina Date: Thu, 3 Sep 2020 16:59:35 -0700 Subject: [PATCH 1/4] Updated ConnectionMonitorEndpoint cmdlet --- 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 ++- 13 files changed, 259 insertions(+), 229 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%) diff --git a/src/Network/Network/Az.Network.psd1 b/src/Network/Network/Az.Network.psd1 index 9d9ded2be5b2..6d2a11876cf0 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 5d74ab93eafd..90a87ed73f02 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 7b7d01d8bc8c..e03ebda5e804 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. From 6baff02af05b5ded3af130482299948e2e9e6f71 Mon Sep 17 00:00:00 2001 From: Irina Rogozhkina Date: Thu, 3 Sep 2020 19:43:35 -0700 Subject: [PATCH 2/4] Updated help files --- ...kWatcherConnectionMonitorEndpointObject.md | 73 +++++++++++++------ ...nnectionMonitorEndpointScopeItemObject.md} | 35 +++------ ...ctionMonitorProtocolConfigurationObject.md | 39 +++++++--- 3 files changed, 89 insertions(+), 58 deletions(-) rename src/Network/Network/help/{New-AzNetworkWatcherConnectionMonitorEndpointFilterItemObject.md => New-AzNetworkWatcherConnectionMonitorEndpointScopeItemObject.md} (62%) diff --git a/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorEndpointObject.md b/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorEndpointObject.md index ba2acbdda519..648c4868dcd7 100644 --- a/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorEndpointObject.md +++ b/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorEndpointObject.md @@ -1,7 +1,7 @@ --- 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-aznetworkwatcherconnectionmonitorendpointobject +online version: schema: 2.0.0 --- @@ -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 @@ -33,20 +32,18 @@ New-AzNetworkWatcherConnectionMonitorEndpointObject cmdlet creates connection mo ## EXAMPLES ### Example 1 -```powershell 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 +66,22 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -CoverageLevel +Test coverage for the endpoint. +Supported values are Default, Low, BelowAverage, Average, AboveAvergae, 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 +97,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 +112,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 +157,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 62% rename from src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorEndpointFilterItemObject.md rename to src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorEndpointScopeItemObject.md index f12d74e41007..174b76880b9f 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: 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..f9b8755d2f76 100644 --- a/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorProtocolConfigurationObject.md +++ b/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorProtocolConfigurationObject.md @@ -1,7 +1,7 @@ --- 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-aznetworkwatcherconnectionmonitorprotocolconfigurationobject +online version: schema: 2.0.0 --- @@ -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 From 9f1d20fa5c9f495c5c69ab7495193e5bac92d5ce Mon Sep 17 00:00:00 2001 From: Irina Rogozhkina Date: Fri, 4 Sep 2020 09:38:39 -0700 Subject: [PATCH 3/4] Fixed help files --- .../New-AzNetworkWatcherConnectionMonitorEndpointObject.md | 7 ++++--- ...tworkWatcherConnectionMonitorEndpointScopeItemObject.md | 2 +- ...kWatcherConnectionMonitorProtocolConfigurationObject.md | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorEndpointObject.md b/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorEndpointObject.md index 648c4868dcd7..66e62800c6bd 100644 --- a/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorEndpointObject.md +++ b/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorEndpointObject.md @@ -1,7 +1,7 @@ --- external help file: Microsoft.Azure.PowerShell.Cmdlets.Network.dll-Help.xml Module Name: Az.Network -online version: +online version: https://docs.microsoft.com/en-us/powershell/module/az.network/new-aznetworkwatcherconnectionmonitorendpointobject schema: 2.0.0 --- @@ -31,7 +31,8 @@ New-AzNetworkWatcherConnectionMonitorEndpointObject cmdlet creates connection mo ## EXAMPLES -### Example 1 +### 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:\>$SrcEndpointScopeItem1 = New-AzNetworkWatcherConnectionMonitorEndpointScopeItemObject -Address "WIN-P0HGNDO2S1B" PS C:\>$SourceEndpointObject1 = New-AzNetworkWatcherConnectionMonitorEndpointObject -Name "workspaceEndpoint" -Type "MMAWorkspaceMachine" -ResourceId $MySrcResourceId1 -IncludeItem $SrcEndpointScopeItem1 @@ -68,7 +69,7 @@ Accept wildcard characters: False ### -CoverageLevel Test coverage for the endpoint. -Supported values are Default, Low, BelowAverage, Average, AboveAvergae, Full. +Supported values are Default, Low, BelowAverage, Average, AboveAverage, Full. ```yaml Type: System.String diff --git a/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorEndpointScopeItemObject.md b/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorEndpointScopeItemObject.md index 174b76880b9f..46909f53a693 100644 --- a/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorEndpointScopeItemObject.md +++ b/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorEndpointScopeItemObject.md @@ -1,7 +1,7 @@ --- external help file: Microsoft.Azure.PowerShell.Cmdlets.Network.dll-Help.xml Module Name: Az.Network -online version: +online version: https://docs.microsoft.com/en-us/powershell/module/az.network/new-aznetworkwatcherconnectionmonitorendpointscopeitemobject schema: 2.0.0 --- diff --git a/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorProtocolConfigurationObject.md b/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorProtocolConfigurationObject.md index f9b8755d2f76..0fb2dcb9f18b 100644 --- a/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorProtocolConfigurationObject.md +++ b/src/Network/Network/help/New-AzNetworkWatcherConnectionMonitorProtocolConfigurationObject.md @@ -1,7 +1,7 @@ --- external help file: Microsoft.Azure.PowerShell.Cmdlets.Network.dll-Help.xml Module Name: Az.Network -online version: +online version: https://docs.microsoft.com/en-us/powershell/module/az.network/new-aznetworkwatcherconnectionmonitorprotocolconfigurationobject schema: 2.0.0 --- From 611fb14ead16f0d6fd623a9b3c800409d8aa1a4e Mon Sep 17 00:00:00 2001 From: Irina Rogozhkina Date: Tue, 8 Sep 2020 12:44:01 -0700 Subject: [PATCH 4/4] Suppressed breaking changes warnings --- .../Exceptions/Az.Network/BreakingChangeIssues.csv | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/StaticAnalysis/Exceptions/Az.Network/BreakingChangeIssues.csv b/tools/StaticAnalysis/Exceptions/Az.Network/BreakingChangeIssues.csv index 1886b5d95cb7..5bd6ae96b4a3 100644 --- a/tools/StaticAnalysis/Exceptions/Az.Network/BreakingChangeIssues.csv +++ b/tools/StaticAnalysis/Exceptions/Az.Network/BreakingChangeIssues.csv @@ -585,3 +585,13 @@ "Microsoft.Azure.PowerShell.Cmdlets.Network.dll","Microsoft.Azure.Commands.Network.RemoveAzureVirtualRouterCommand","Remove-AzVirtualRouter","0","3010","The property 'HostedGateway' of type 'Microsoft.Azure.Commands.Network.Models.PSVirtualRouter' has been removed.","Add the property 'HostedGateway' back to type 'Microsoft.Azure.Commands.Network.Models.PSVirtualRouter'." "Microsoft.Azure.PowerShell.Cmdlets.Network.dll","Microsoft.Azure.Commands.Network.RemoveAzureVirtualRouterCommand","Remove-AzVirtualRouter","0","3010","The property 'HostedGatewayText' of type 'Microsoft.Azure.Commands.Network.Models.PSVirtualRouter' has been removed.","Add the property 'HostedGatewayText' back to type 'Microsoft.Azure.Commands.Network.Models.PSVirtualRouter'." "Microsoft.Azure.PowerShell.Cmdlets.Network.dll","Microsoft.Azure.Commands.Network.GetAzureRmVirtualRouterPeer","Get-AzVirtualRouterPeer","0","3010","The property 'Type' of type 'Microsoft.Azure.Commands.Network.Models.PSVirtualRouterPeer' has been removed.","Add the property 'Type' back to type 'Microsoft.Azure.Commands.Network.Models.PSVirtualRouterPeer'." +"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'."