diff --git a/documentation/development-docs/examples/private-link-resource-example.md b/documentation/development-docs/examples/private-link-resource-example.md
index 3fce37bd1087..20235f9a7666 100644
--- a/documentation/development-docs/examples/private-link-resource-example.md
+++ b/documentation/development-docs/examples/private-link-resource-example.md
@@ -1,63 +1,68 @@
## Applicability
-Az.Network supports the retrieval of private link resource in `Get-AzPrivateLinkResource` as well as the management of private endpoint connection in `Approve-AzPrivateEndpointConnect`, `Deny-AzPrivateEndpointConnect`, `Remove-AzPrivateEndpointConnect` and `Set-AzPrivateEndpointConnect`.
+Az.Network supports the retrieval of private link resource in `Get-AzPrivateLinkResource` as well as the management of private endpoint connection by `Get-AzPrivateEndpointConnection`, `Approve-AzPrivateEndpointConnection`, `Deny-AzPrivateEndpointConnection`, `Remove-AzPrivateEndpointConnection` and `Set-AzPrivateEndpointConnection`.
-For providers who
-- supports the features of private linke resource and private endpoint connection already
-- and want to onboard these features in Azure PowerShell,
+For provider who
+- supports the features of private link resource or private endpoint connection already
+- and wants to onboard these features in Azure PowerShell,
+You need to register provider configuration in [ProviderConfiguration.cs](https://github.com/Azure/azure-powershell/blob/main/src/Network/Network/PrivateLinkService/PrivateLinkServiceProvider/ProviderConfiguration.cs#L12).
-they need register provider configuration in [ProviderConfiguration.cs](https://github.com/Azure/azure-powershell/blob/main/src/Network/Network/PrivateLinkService/PrivateLinkServiceProvider/ProviderConfiguration.cs#L12).
-
-Notes: No additional commands for the features of private linke resource and private endpoint connection need to be added.
+Notes: No additional commands for the features of PrivateLinkResource and PrivateEndpointConnection need to be added.
## Prerequisite
We assume the API for `List` private link resource and `Get` private endpoint connection is available in the provider that claims to support private endpoint connection features. That means it supports following APIs:
```
# List Private Link Resource API
-"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{provider}/{Top-Level-Resource}/{Top-Level-Resource-Name}/privateLinkResources"
+"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{provider}/{topResourceType}/{topResourceName}/privateLinkResources"
```
```
# Get Private Endpoint Connection API
-"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{provider}/{Top-Level-Resource}/{Top-Level-Resource-Name}/privateEndpointConnections/{PrivateEndpointConnection-Name}"
+"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{provider}/{topResourceType}/{topResourceName}/privateEndpointConnections/{privateEndpointConnectionName}"
```
-if "List Private Endpoint Connection API" is not available, `privateEndpointConnections` must be included in the properties of top resource returned by
-"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{provider}/{Top-Level-Resource}/{Top-Level-Resource-Name}". So that `Private Endpoint Connections` will be retrieved from the top resource.
+if "List Private Endpoint Connection API" below is not available, `privateEndpointConnections` must be included in the properties of top resource returned by
+"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{provider}/{topResourceType}/{topResourceName}". So that `Get-AzPrivateEndpointConnect` will retrieve connections from the top resource.
```
# List Private Endpoint Connection API
-"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{provider}/{Top-Level-Resource}/{Top-Level-Resource-Name}/privateEndpointConnections"
+"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{provider}/{topResourceType}/{topResourceName}/privateEndpointConnections"
```
## Code Changes Needed
-To add corresponding {Provider}, {Top-Level-Resource} and {API-Version} into [ProviderConfiguration.cs](https://github.com/Azure/azure-powershell/blob/main/src/Network/Network/PrivateLinkService/PrivateLinkServiceProvider/ProviderConfiguration.cs#L12), we need to follow
-in following pattern:
+To add corresponding {Provider}, {topResourceType} and {API-Version} into [ProviderConfiguration.cs](https://github.com/Azure/azure-powershell/blob/main/src/Network/Network/PrivateLinkService/PrivateLinkServiceProvider/ProviderConfiguration.cs#L12), we need to follow in following pattern:
```
-RegisterConfiguration("{Provider}/{Top-Level-Resource}", "{API-Version}", bool hasPrivateEndppointConnectionsURI, bool hasPrivateLinkResourceURI)
+RegisterConfiguration(string type, string apiVersion, bool hasConnectionsURI = false, bool supportGetPrivateLinkResource = false, bool supportPrivateLinkResource = true)
```
-- "{Provider}/{Top-Level-Resource}" describes the type of provider. For example, "Microsoft.Sql/servers".
-- "{API-Version}" specifies the API version to be used. For example, "2018-06-01-preview".
-- `hasPrivateEndppointConnectionsURI` marks the provider whether provides "List Private Endpoint Connection API".
+- `type` includes resource provider and resource type which supports PrivateLink feature. For example, "Microsoft.Sql/servers".
+- `apiVersion` specifies the API version to be used. For example, "2018-06-01-preview".
+- `hasConnectionsURI` marks whether the provider exposes "List Private Endpoint Connection API". Default value is false.
```
# Get Private Link Resource API
-"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{provider}/{Top-Level-Resource}/{Top-Level-Resource-Name}/privateLinkResources/{PrivateLinkResource-Name}"
+"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{provider}/{topResourceType}/{topResourceName}/privateLinkResources/{privateLinkResourceName}"
```
-- `hasPrivateLinkResourceURI` marks the provider whether providers "Get Private Endpoint Connection API".
+- `supportGetPrivateLinkResource` marks whether the provider supports Get API of PrivateLinkResource. Default value is false.
-For instance, for provider "Microsoft.Sql/servers" with API version "2018-06-01-preview", it supports "List Private Endpoint Connection API" and "Get Private Endpoint Connection API". So it's registration configuration should be
+For instance, for provider "Microsoft.Sql/servers" with API version "2018-06-01-preview", it supports "List Private Endpoint Connection API" and "Get Private Link Resource API". So its registration configuration should be:
```
RegisterConfiguration("Microsoft.Sql/servers", "2018-06-01-preview", true, true);
```
+- `supportListPrivateLinkResource` marks whether the provider supports List API of PrivateLinkResource. Default value is true.
+
+For instance, `Microsoft.Network/privateLinkServices` supports PrivateEndpointConnections but doesn't support resource type PrivateLinkResource (We assume List API is mandatory to resource support). Its configuration should be:
+```
+RegisterConfiguration("Microsoft.Network/privateLinkServices", "2020-05-01", true, false, false);
+```
+
## End-To-End Test
### Item Needed
+ Top level resource
```
-New-Az{Top-Level-Resource} -ResourceGroupName {rg_name} -Name {top_level_resource_name}
+New-Az{topResourceType} -ResourceGroupName {rgName} -Name {topResourceName}
-$TopLevelResource = Get-Az{Top-Level-Resource} -ResourceGroupName {rg_name} -Name {top_level_resource_name}
+$TopLevelResource = Get-Az{topResourceType} -ResourceGroupName {rgName} -Name {topResourceName}
```
+ private link resource
@@ -67,24 +72,24 @@ $PrivateLinkResource = Get-AzPrivateLinkResource -PrivateLinkResourceId $TopLeve
+ subnet config (object in memory)
```
-$SubnetConfig = New-AzVirtualNetworkSubnetConfig -Name {config_name} -AddressPrefix "11.0.1.0/24" -PrivateEndpointNetworkPolicies "Disabled"
+$SubnetConfig = New-AzVirtualNetworkSubnetConfig -Name {configName} -AddressPrefix "11.0.1.0/24" -PrivateEndpointNetworkPolicies "Disabled"
```
+ virtual network
```
-New-AzVirtualNetwork -ResourceGroupName {rg_name} -Name {vnet_name} -Location {location} -AddressPrefix "11.0.0.0/16" -Subnet $SubnetConfig
+New-AzVirtualNetwork -ResourceGroupName {rgName} -Name {vnetName} -Location {location} -AddressPrefix "11.0.0.0/16" -Subnet $SubnetConfig
-$VNet=Get-AzVirtualNetwork -ResourceGroupName {rg_name} -Name {vnet_name}
+$VNet=Get-AzVirtualNetwork -ResourceGroupName {rgName} -Name {vnetName}
```
+ private link service connection (object in memory)
```
-$PLSConnection = New-AzPrivateLinkServiceConnection -Name {pls_connection_name} -PrivateLinkServiceId $TopLevelResource.Id -GroupId $TopLevelResource.GroupId
+$PLSConnection = New-AzPrivateLinkServiceConnection -Name {plsConnectionName} -PrivateLinkServiceId $TopLevelResource.Id -GroupId $TopLevelResource.GroupId
```
+ endpoint
```
-New-AzPrivateEndpoint -ResourceGroupName {rg_name} -Name {endpoint_name} -Location {location} -Subnet $VNet.subnets[0] -PrivateLinkServiceConnection $PLSConnection -ByManualRequest
+New-AzPrivateEndpoint -ResourceGroupName {rgName} -Name {endpointName} -Location {location} -Subnet $VNet.subnets[0] -PrivateLinkServiceConnection $PLSConnection -ByManualRequest
```
### step-by-step
@@ -99,7 +104,7 @@ $connection = Get-AzPrivateEndpointConnection -PrivateLinkResourceId $TopLevelRe
* To get the connection, if `list` for private endpoint connection was not supported,
```
-$TopLevelResource = Get-Az{Top-Level-Resource} -ResourceGroupName {rg_name} -Name {top_level_resource_name}
+$TopLevelResource = Get-Az{topResourceType} -ResourceGroupName {rgName} -Name {topResourceName}
$ConnectionId = $TopLevelResource.PrivateEndpointConnection[0].Id
diff --git a/src/Network/Network/ChangeLog.md b/src/Network/Network/ChangeLog.md
index 9158de1a467b..9973601ac24c 100644
--- a/src/Network/Network/ChangeLog.md
+++ b/src/Network/Network/ChangeLog.md
@@ -19,6 +19,8 @@
--->
## Upcoming Release
+* Supported `Microsoft.Network/privateLinkServices` in `Get-AzPrivateEndpointConnection` [#16984].
+* Provided friendly message if resource type is not supported for private endpoint connection features [#17091].
* Added `DisableIPsecProtection` to `Virtual Network Gateway`.
* Added new cmdlets to create/manage authorization objects for ExpressRoutePort:
- `Add-AzExpressRoutePortAuthorization`
diff --git a/src/Network/Network/PrivateLinkService/PrivateEndpointConnection/PrivateEndpointConnectionBaseCmdlet.cs b/src/Network/Network/PrivateLinkService/PrivateEndpointConnection/PrivateEndpointConnectionBaseCmdlet.cs
index ca6c004bd307..aee9df129ac1 100644
--- a/src/Network/Network/PrivateLinkService/PrivateEndpointConnection/PrivateEndpointConnectionBaseCmdlet.cs
+++ b/src/Network/Network/PrivateLinkService/PrivateEndpointConnection/PrivateEndpointConnectionBaseCmdlet.cs
@@ -12,9 +12,12 @@
// limitations under the License.
// ----------------------------------------------------------------------------------
+using Microsoft.Azure.Commands.Common.Exceptions;
using Microsoft.Azure.Commands.Network.PrivateLinkService.PrivateLinkServiceProvider;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using System.Management.Automation;
+using Microsoft.Azure.Management.Internal.Resources.Utilities.Models;
+using System;
namespace Microsoft.Azure.Commands.Network
{
@@ -25,6 +28,7 @@ public abstract class PrivateEndpointConnectionBaseCmdlet : NetworkBaseCmdlet, I
ParameterSetName = "ByResourceId",
ValueFromPipelineByPropertyName = true)]
[ValidateNotNullOrEmpty]
+ [ValidateParentResourceNotNullOrEmpty]
public string ResourceId { get; set; }
[Alias("ResourceName")]
@@ -62,7 +66,7 @@ public abstract class PrivateEndpointConnectionBaseCmdlet : NetworkBaseCmdlet, I
{
var parameters = new RuntimeDefinedParameterDictionary();
RuntimeDefinedParameter namedParameter;
- if (ProviderConfiguration.TryGetProvideServiceParameter(privateEndpointTypeName, NamedContextParameterSet, out namedParameter))
+ if (ProviderConfiguration.TryGetEndpointConnectionServiceParameter(privateEndpointTypeName, NamedContextParameterSet, out namedParameter))
{
parameters.Add(privateEndpointTypeName, namedParameter);
}
@@ -76,7 +80,26 @@ public abstract class PrivateEndpointConnectionBaseCmdlet : NetworkBaseCmdlet, I
protected IPrivateLinkProvider BuildProvider(string subscription, string privateLinkResourceType)
{
+ if (!GenericProvider.SupportsPrivateLinkFeature(privateLinkResourceType))
+ throw new AzPSApplicationException(string.Format(Properties.Resources.UnsupportPrivateEndpointConnectionType, privateLinkResourceType));
return PrivateLinkProviderFactory.CreatePrivateLinkProvder(this, subscription, privateLinkResourceType);
}
+
+ ///
+ /// Validate parent resource of the resource id not null or empty.
+ ///
+ [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
+ internal sealed class ValidateParentResourceNotNullOrEmptyAttribute : ValidateArgumentsAttribute
+ {
+ protected override void Validate(object arguments, EngineIntrinsics engineIntrinsics)
+ {
+ string resourceId = (string)arguments;
+ var resourceIdentifier = new ResourceIdentifier(resourceId);
+ if (string.IsNullOrEmpty(resourceIdentifier.ParentResource))
+ {
+ throw new AzPSApplicationException(string.Format(Properties.Resources.InvalidResourceId, resourceId));
+ }
+ }
+ }
}
}
diff --git a/src/Network/Network/PrivateLinkService/PrivateLinkResource/GetAzurePrivateLinkResourceCommand.cs b/src/Network/Network/PrivateLinkService/PrivateLinkResource/GetAzurePrivateLinkResourceCommand.cs
index 5d6d5bee49c9..5c3b2965c684 100644
--- a/src/Network/Network/PrivateLinkService/PrivateLinkResource/GetAzurePrivateLinkResourceCommand.cs
+++ b/src/Network/Network/PrivateLinkService/PrivateLinkResource/GetAzurePrivateLinkResourceCommand.cs
@@ -12,6 +12,7 @@
// limitations under the License.
// ----------------------------------------------------------------------------------
+using Microsoft.Azure.Commands.Common.Exceptions;
using Microsoft.Azure.Commands.Network.Models;
using Microsoft.Azure.Commands.Network.PrivateLinkService.PrivateLinkServiceProvider;
using Microsoft.Azure.Management.Internal.Resources.Utilities.Models;
@@ -63,9 +64,10 @@ public class GetAzurePrivateLinkResourceCommand : NetworkBaseCmdlet, IDynamicPar
public new object GetDynamicParameters()
{
+ InvocationInfo invocationInfo = MyInvocation;
var parameters = new RuntimeDefinedParameterDictionary();
RuntimeDefinedParameter namedParameter;
- if (ProviderConfiguration.TryGetProvideServiceParameter(privateEndpointTypeName, NamedContextParameterSet, out namedParameter))
+ if (ProviderConfiguration.TryGetLinkResourceServiceParameter(privateEndpointTypeName, NamedContextParameterSet, out namedParameter))
{
parameters.Add(privateEndpointTypeName, namedParameter);
}
@@ -89,6 +91,12 @@ public override void Execute()
this.Subscription = DefaultProfile.DefaultContext.Subscription.Id;
this.PrivateLinkResourceType = DynamicParameters[privateEndpointTypeName].Value as string;
}
+ // First check resource type whether support private link feature, if support then check whether support private link resource feature.
+ if (!GenericProvider.SupportsPrivateLinkFeature(this.PrivateLinkResourceType) || !ProviderConfiguration.GetProviderConfiguration(this.PrivateLinkResourceType).SupportListPrivateLinkResource)
+ {
+ throw new AzPSApplicationException(string.Format(Properties.Resources.UnsupportPrivateLinkResourceType, this.PrivateLinkResourceType));
+ }
+
IPrivateLinkProvider provider = PrivateLinkProviderFactory.CreatePrivateLinkProvder(this, Subscription, PrivateLinkResourceType);
if (provider == null)
{
diff --git a/src/Network/Network/PrivateLinkService/PrivateLinkServiceProvider/GenericProvider.cs b/src/Network/Network/PrivateLinkService/PrivateLinkServiceProvider/GenericProvider.cs
index 8bae2ce58a53..3b6cdcdc4f16 100644
--- a/src/Network/Network/PrivateLinkService/PrivateLinkServiceProvider/GenericProvider.cs
+++ b/src/Network/Network/PrivateLinkService/PrivateLinkServiceProvider/GenericProvider.cs
@@ -20,6 +20,7 @@
using Microsoft.Azure.Internal.Common;
using System.Collections.Generic;
using System.Linq;
+using Microsoft.Azure.Commands.Common.Exceptions;
namespace Microsoft.Azure.Commands.Network.PrivateLinkService.PrivateLinkServiceProvider
{
@@ -36,7 +37,7 @@ public GenericProvider(NetworkBaseCmdlet baseCmdlet, string subscription, string
#region Interface Implementation
- public static bool SupportsPrivateLinkResourceType(string privateLinkResourceType)
+ public static bool SupportsPrivateLinkFeature(string privateLinkResourceType)
{
ProviderConfiguration configuration = ProviderConfiguration.GetProviderConfiguration(privateLinkResourceType);
return (configuration != null);
@@ -133,16 +134,14 @@ public void DeletePrivateEndpointConnection(string resourceGroupName, string ser
public PSPrivateLinkResource GetPrivateLinkResource(string resourceGroupName, string serviceName, string name)
{
- if (_configuration.HasResourceURI)
+ if (_configuration.SupportGetPrivateLinkResource)
{
string url = BuildPrivateLinkResourceURL(resourceGroupName, serviceName, name);
PrivateLinkResource resource = ServiceClient.Operations.GetResource(url, _configuration.ApiVersion);
return ToPsPrivateLinkResource(resource);
}
- else
- {
- return ListPrivateLinkResource(resourceGroupName, serviceName).Single(plr => plr.Name.Equals(name));
- }
+
+ return ListPrivateLinkResource(resourceGroupName, serviceName).Single(plr => plr.Name.Equals(name));
}
public List ListPrivateLinkResource(string resourceGroupName, string serviceName)
diff --git a/src/Network/Network/PrivateLinkService/PrivateLinkServiceProvider/PrivateLinkProviderFactory.cs b/src/Network/Network/PrivateLinkService/PrivateLinkServiceProvider/PrivateLinkProviderFactory.cs
index bd840346ff1b..d59108babd01 100644
--- a/src/Network/Network/PrivateLinkService/PrivateLinkServiceProvider/PrivateLinkProviderFactory.cs
+++ b/src/Network/Network/PrivateLinkService/PrivateLinkServiceProvider/PrivateLinkProviderFactory.cs
@@ -27,7 +27,7 @@ public static IPrivateLinkProvider CreatePrivateLinkProvder(NetworkBaseCmdlet cm
return new NetworkingProvider(cmdlet);
}
- if(GenericProvider.SupportsPrivateLinkResourceType(privateLinkResourceType))
+ if(GenericProvider.SupportsPrivateLinkFeature(privateLinkResourceType))
{
return new GenericProvider(cmdlet, subscription, privateLinkResourceType);
}
diff --git a/src/Network/Network/PrivateLinkService/PrivateLinkServiceProvider/ProviderConfiguration.cs b/src/Network/Network/PrivateLinkService/PrivateLinkServiceProvider/ProviderConfiguration.cs
index d5025e39d3b1..ef4b6256c7f4 100644
--- a/src/Network/Network/PrivateLinkService/PrivateLinkServiceProvider/ProviderConfiguration.cs
+++ b/src/Network/Network/PrivateLinkService/PrivateLinkServiceProvider/ProviderConfiguration.cs
@@ -52,6 +52,7 @@ static ProviderConfiguration()
RegisterConfiguration("Microsoft.Migrate/assessmentProjects", "2020-05-01-preview", false, false);
RegisterConfiguration("Microsoft.Migrate/migrateProjects", "2020-06-01-preview", false, false);
RegisterConfiguration("Microsoft.Network/applicationgateways", "2020-05-01", true, false);
+ RegisterConfiguration("Microsoft.Network/privateLinkServices", "2020-05-01", true, false, false);
RegisterConfiguration("Microsoft.OffAzure/masterSites", "2020-07-07", false, false);
RegisterConfiguration("Microsoft.PowerBI/privateLinkServicesForPowerBI", "2020-06-01", false, true);
RegisterConfiguration("Microsoft.Purview/accounts", "2020-12-01-preview", true, true);
@@ -71,15 +72,23 @@ static ProviderConfiguration()
RegisterConfiguration("Microsoft.Web/hostingEnvironments", "2020-10-01", true, false);
RegisterConfiguration("Microsoft.BotService/botServices", "2021-05-01-preview", true, true);
}
-
- private static void RegisterConfiguration(string type, string apiVersion, bool hasConnectionsURI = false, bool hasResourceURI = false)
+ ///
+ /// Register priavte endopoint connection and private link resource configuration
+ ///
+ /// Resource type
+ /// Resource api version
+ /// True if the private endpoint connection can be list by URL , otherwise it can be list by URL
+ /// True if the private link resource can be obtained by Id, otherwise false
+ /// True if the private link resource can be listed, otherwise false
+ private static void RegisterConfiguration(string type, string apiVersion, bool hasConnectionsURI = false, bool supportGetPrivateLinkResource = false, bool supportListPrivateLinkResource = true)
{
ProviderConfiguration configuration = new ProviderConfiguration
{
Type = type,
ApiVersion = apiVersion,
HasConnectionsURI = hasConnectionsURI,
- HasResourceURI = hasResourceURI
+ SupportGetPrivateLinkResource = supportGetPrivateLinkResource,
+ SupportListPrivateLinkResource = supportListPrivateLinkResource,
};
_configurations.Add(type, configuration);
}
@@ -87,11 +96,14 @@ private static void RegisterConfiguration(string type, string apiVersion, bool h
public string Type { get; set; }
public string ApiVersion { get; set; }
public bool HasConnectionsURI { get; set; }
- public bool HasResourceURI { get; set; }
+ public bool SupportGetPrivateLinkResource { get; set; }
+ public bool SupportListPrivateLinkResource { get; set; }
public static ProviderConfiguration GetProviderConfiguration(string type)
{
- return _configurations[type];
+ ProviderConfiguration outProviderConfiguration = null;
+ _configurations.TryGetValue(type, out outProviderConfiguration);
+ return outProviderConfiguration;
}
///
@@ -100,7 +112,7 @@ public static ProviderConfiguration GetProviderConfiguration(string type)
/// The name of the parameter
/// The returned runtime parameter for context, with appropriate validate set
/// True if one or more contexts were found, otherwise false
- public static bool TryGetProvideServiceParameter(string name, string parameterSetName, out RuntimeDefinedParameter runtimeParameter)
+ public static bool TryGetEndpointConnectionServiceParameter(string name, string parameterSetName, out RuntimeDefinedParameter runtimeParameter)
{
var result = false;
runtimeParameter = null;
@@ -114,7 +126,37 @@ public static bool TryGetProvideServiceParameter(string name, string parameterSe
{
new ParameterAttribute { Mandatory = false,
ValueFromPipeline = true,
- HelpMessage = "The private link resource type.",
+ HelpMessage = "The resource provider and resource type which supports private endpoint connection.",
+ ParameterSetName = parameterSetName },
+ new ValidateSetAttribute(ProvideTypeList)
+ }
+ );
+ result = true;
+ }
+ return result;
+ }
+
+ ///
+ /// Generate a runtime parameter with ValidateSet matching the current context
+ ///
+ /// The name of the parameter
+ /// The returned runtime parameter for context, with appropriate validate set
+ /// True if one or more contexts were found, otherwise false
+ public static bool TryGetLinkResourceServiceParameter(string name, string parameterSetName, out RuntimeDefinedParameter runtimeParameter)
+ {
+ var result = false;
+ runtimeParameter = null;
+ if (_configurations != null && _configurations.Values != null)
+ {
+ var ObjArray = _configurations.Values.ToArray();
+ var ProvideTypeList = ObjArray.Where(c => (c.SupportListPrivateLinkResource || c.SupportGetPrivateLinkResource)).Select(c => c.Type).ToArray();
+ runtimeParameter = new RuntimeDefinedParameter(
+ name, typeof(string),
+ new Collection()
+ {
+ new ParameterAttribute { Mandatory = false,
+ ValueFromPipeline = true,
+ HelpMessage = "The resource provider and resource type which supports private link resource.",
ParameterSetName = parameterSetName },
new ValidateSetAttribute(ProvideTypeList)
}
diff --git a/src/Network/Network/Properties/Resources.Designer.cs b/src/Network/Network/Properties/Resources.Designer.cs
index 516876cf79bb..a0c82ec8b236 100644
--- a/src/Network/Network/Properties/Resources.Designer.cs
+++ b/src/Network/Network/Properties/Resources.Designer.cs
@@ -1576,6 +1576,24 @@ internal static string UnsupportedProtocolConfigurationType {
}
}
+ ///
+ /// Looks up a localized string similar to The {0} doesn't register private endpoint connection..
+ ///
+ internal static string UnsupportPrivateEndpointConnectionType {
+ get {
+ return ResourceManager.GetString("UnsupportPrivateEndpointConnectionType", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to The {0} doesn't register private link resource..
+ ///
+ internal static string UnsupportPrivateLinkResourceType {
+ get {
+ return ResourceManager.GetString("UnsupportPrivateLinkResourceType", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Updating resource with ResourceGroupName {0}, ResourceName {1}..
///
diff --git a/src/Network/Network/Properties/Resources.resx b/src/Network/Network/Properties/Resources.resx
index b4cb10471218..7d3e579c0316 100644
--- a/src/Network/Network/Properties/Resources.resx
+++ b/src/Network/Network/Properties/Resources.resx
@@ -735,4 +735,10 @@
The VirtualNetworkGatewayNatRule could not be found
+
+ {0} doesn't support private endpoint connection.
+
+
+ {0} doesn't support private link resource.
+
\ No newline at end of file