Skip to content

Commit 46e5917

Browse files
authored
Added new parameters ApplicationSecurityGroup, IpConfiguration, CustomNetworkInterfaceName for Get-AzPrivateEndpoint and New-AzPrivateEndpoint (#16643)
* Added new parameters ApplicationSecurityGroups, IpConfigurations and CustomNetworkInterfaceName for Get-AzPrivateEndpoint and Set-AzPrivateEndpoint * Added new parameter ApplicationSecurityGroups for Get-AzPrivateEndpoint and Set-AzPrivateEndpoint * Renamed parameter name from ApplicationSecurityGroups to ApplicationSecurityGroup for cmdlet New-AzPrivateEndpoint * Update ChangeLog.md * Update Az.Network.psd1 * Update NewAzurePrivateEndpointIPConfigurationCommand.cs * Update NewAzurePrivateEndpointIPConfigurationCommand.cs * Update SignatureIssues.csv
1 parent 3a63aa2 commit 46e5917

18 files changed

+12253
-11
lines changed

src/Network/Network.Test/ScenarioTests/PrivateEndpointTests.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,29 @@ public void TestPrivateDnsZoneGroupCRUD()
4848
{
4949
TestRunner.RunTestScript("Test-PrivateDnsZoneGroupCRUD");
5050
}
51+
52+
[Fact]
53+
[Trait(Category.AcceptanceType, Category.CheckIn)]
54+
[Trait(Category.Owner, NrpTeamAlias.azdevxps)]
55+
public void TestPrivateEndpointApplicationSecurityGroup()
56+
{
57+
TestRunner.RunTestScript("Test-PrivateEndpointApplicationSecurityGroup");
58+
}
59+
60+
[Fact]
61+
[Trait(Category.AcceptanceType, Category.CheckIn)]
62+
[Trait(Category.Owner, NrpTeamAlias.azdevxps)]
63+
public void TestPrivateEndpointIpConfiguration()
64+
{
65+
TestRunner.RunTestScript("Test-PrivateEndpointIpConfiguration");
66+
}
67+
68+
[Fact]
69+
[Trait(Category.AcceptanceType, Category.CheckIn)]
70+
[Trait(Category.Owner, NrpTeamAlias.azdevxps)]
71+
public void TestPrivateEndpointCustomNetworkInterfaceName()
72+
{
73+
TestRunner.RunTestScript("Test-PrivateEndpointCustomNetworkInterfaceName");
74+
}
5175
}
5276
}

src/Network/Network.Test/ScenarioTests/PrivateEndpointTests.ps1

Lines changed: 309 additions & 0 deletions
Large diffs are not rendered by default.

src/Network/Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.PrivateEndpointTests/TestPrivateEndpointApplicationSecurityGroup.json

Lines changed: 4315 additions & 0 deletions
Large diffs are not rendered by default.

src/Network/Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.PrivateEndpointTests/TestPrivateEndpointCustomNetworkInterfaceName.json

Lines changed: 3717 additions & 0 deletions
Large diffs are not rendered by default.

src/Network/Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.PrivateEndpointTests/TestPrivateEndpointIpConfiguration.json

Lines changed: 3553 additions & 0 deletions
Large diffs are not rendered by default.

src/Network/Network/Az.Network.psd1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,8 @@ CmdletsToExport = 'Add-AzApplicationGatewayAuthenticationCertificate',
546546
'Remove-AzVirtualNetworkGatewayNatRule',
547547
'Get-AzVirtualHubBgpConnection', 'New-AzVirtualHubBgpConnection',
548548
'Remove-AzVirtualHubBgpConnection',
549-
'Update-AzVirtualHubBgpConnection'
549+
'Update-AzVirtualHubBgpConnection',
550+
'New-AzPrivateEndpointIpConfiguration'
550551

551552
# Variables to export from this module
552553
# VariablesToExport = @()

src/Network/Network/ChangeLog.md

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

2121
## Upcoming Release
22+
* Added new properties ApplicationSecurityGroup, IpConfiguration and CustomNetworkInterfaceName for Private Endpoint cmdlets
23+
- `Get-AzPrivateEndpoint`
24+
- `New-AzPrivateEndpoint`
25+
* Added new cmdlet to create new IpConfiguration object for building Private Endpoint
26+
- `New-AzPrivateEndpointIpConfiguration`
2227
* Added OrdinalIgnoreCase for string comparison of resourceIdentifier type for flowlog cmdlets
2328
* Fixed typo in error message of InvalidWorkspaceResourceId
2429

src/Network/Network/Common/NetworkResourceManagerProfile.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,8 +1357,14 @@ private static void Initialize()
13571357
// MNM to CNM
13581358
cfg.CreateMap<MNM.VirtualNetworkTap, CNM.PSVirtualNetworkTap>();
13591359

1360-
cfg.CreateMap<CNM.PSPrivateEndpoint, MNM.PrivateEndpoint>();
1361-
cfg.CreateMap<MNM.PrivateEndpoint, CNM.PSPrivateEndpoint>();
1360+
cfg.CreateMap<CNM.PSPrivateEndpoint, MNM.PrivateEndpoint>()
1361+
.ForMember(dest => dest.ApplicationSecurityGroups, opt => opt.MapFrom(src => src._psApplicationSecurityGroups))
1362+
.ForMember(dest => dest.IpConfigurations, opt => opt.MapFrom(src => src._psIpConfigurations));
1363+
cfg.CreateMap<MNM.PrivateEndpoint, CNM.PSPrivateEndpoint>()
1364+
.ForMember(dest => dest._psApplicationSecurityGroups, opt => opt.MapFrom(src => src.ApplicationSecurityGroups))
1365+
.ForMember(dest => dest._psIpConfigurations, opt => opt.MapFrom(src => src.IpConfigurations));
1366+
cfg.CreateMap<CNM.PSPrivateEndpointIPConfiguration, MNM.PrivateEndpointIPConfiguration>();
1367+
cfg.CreateMap<MNM.PrivateEndpointIPConfiguration, CNM.PSPrivateEndpointIPConfiguration>();
13621368
cfg.CreateMap<CNM.PSPrivateDnsZoneGroup, MNM.PrivateDnsZoneGroup>();
13631369
cfg.CreateMap<MNM.PrivateDnsZoneGroup, CNM.PSPrivateDnsZoneGroup>();
13641370
cfg.CreateMap<CNM.PSPrivateDnsZoneConfig, MNM.PrivateDnsZoneConfig>();

src/Network/Network/Models/PSPrivateEndpoint.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,30 @@ public partial class PSPrivateEndpoint : PSTopLevelResource
3131
public List<PSPrivateEndpointCustomDnsConfig> CustomDnsConfigs { get; set; }
3232
public PSExtendedLocation ExtendedLocation { get; set; }
3333

34+
/// <summary>
35+
/// Need this interim property due to a bug in AutoMapper 6.6.2
36+
/// https://github.com/AutoMapper/AutoMapper/issues/2507 - Not able to map null to null for IEnumerable/IReadOnlyList object except for IList
37+
/// </summary>
38+
internal List<PSApplicationSecurityGroup> _psApplicationSecurityGroups { get; set; }
39+
40+
/// <summary>
41+
/// IReadOnlyList object due to ApplicationSecurityGroups is not applicable for Set-AzPrivateEndpoint
42+
/// </summary>
43+
public IReadOnlyList<PSApplicationSecurityGroup> ApplicationSecurityGroups => _psApplicationSecurityGroups.AsReadOnly();
44+
45+
/// <summary>
46+
/// Need this interim property due to a bug in AutoMapper 6.6.2
47+
/// https://github.com/AutoMapper/AutoMapper/issues/2507 - Not able to map null to null for IEnumerable/IReadOnlyList object except for IList
48+
/// </summary>
49+
internal List<PSPrivateEndpointIPConfiguration> _psIpConfigurations { get; set; }
50+
51+
/// <summary>
52+
/// IReadOnlyList object due to PrivateEndpointIPConfigurations is not applicable for Set-AzPrivateEndpoint
53+
/// </summary>
54+
public IReadOnlyList<PSPrivateEndpointIPConfiguration> IpConfigurations => _psIpConfigurations.AsReadOnly();
55+
56+
public string CustomNetworkInterfaceName { get; internal set; }
57+
3458
[JsonIgnore]
3559
public string SubnetText
3660
{
@@ -67,6 +91,18 @@ public string ExtendedLocationText
6791
get { return JsonConvert.SerializeObject(ExtendedLocation, Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); }
6892
}
6993

94+
[JsonIgnore]
95+
public string ApplicationSecurityGroupsText
96+
{
97+
get { return JsonConvert.SerializeObject(ApplicationSecurityGroups, Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); }
98+
}
99+
100+
[JsonIgnore]
101+
public string IpConfigurationsText
102+
{
103+
get { return JsonConvert.SerializeObject(IpConfigurations, Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); }
104+
}
105+
70106
public bool ShouldSerializeNetworkInterfaces()
71107
{
72108
return !string.IsNullOrEmpty(this.Name);
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
using System.Text.Json.Serialization;
5+
6+
namespace Microsoft.Azure.Commands.Network.Models
7+
{
8+
public class PSPrivateEndpointIPConfiguration
9+
{
10+
11+
public string Name { get; internal set; }
12+
13+
public string GroupId { get; internal set; }
14+
15+
public string MemberName { get; internal set; }
16+
17+
[Newtonsoft.Json.JsonProperty("PrivateIpAddress")]
18+
public string PrivateIPAddress { get; internal set; }
19+
20+
public string Type { get; private set; }
21+
22+
public string Etag { get; private set; }
23+
}
24+
}

0 commit comments

Comments
 (0)