Skip to content

Commit 01997cb

Browse files
authored
Merge pull request #8115 from markcowl/fig-ag
Supporting KeyVault in ApplicationGateway
2 parents dcf17a9 + 05df2da commit 01997cb

File tree

399 files changed

+647
-412
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

399 files changed

+647
-412
lines changed

src/ResourceManager/Network/Commands.Network/ApplicationGateway/NewAzureApplicationGatewayCommand.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using AutoMapper;
1615
using Microsoft.Azure.Commands.Network.Models;
1716
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
1817
using Microsoft.Azure.Commands.ResourceManager.Common.Tags;
@@ -183,6 +182,15 @@ public class NewAzureApplicationGatewayCommand : ApplicationGatewayBaseCmdlet
183182
HelpMessage = "A hashtable which represents resource tags.")]
184183
public Hashtable Tag { get; set; }
185184

185+
[Parameter(
186+
Mandatory = false,
187+
ValueFromPipelineByPropertyName = true,
188+
HelpMessage = "ResourceId of the user assigned identity to be assigned to Application Gateway.")]
189+
[ValidateNotNullOrEmpty]
190+
[Alias("UserAssignedIdentity")]
191+
public string UserAssignedIdentityId { get; set; }
192+
193+
186194
[Parameter(
187195
Mandatory = false,
188196
HelpMessage = "Do not ask for confirmation if you want to overrite a resource")]
@@ -322,6 +330,18 @@ private PSApplicationGateway CreateApplicationGateway()
322330
applicationGateway.Zones = this.Zone?.ToList();
323331
}
324332

333+
if (this.UserAssignedIdentityId != null)
334+
{
335+
applicationGateway.Identity = new PSManagedServiceIdentity
336+
{
337+
Type = MNM.ResourceIdentityType.UserAssigned,
338+
UserAssignedIdentities = new Dictionary<string, PSManagedServiceIdentityUserAssignedIdentitiesValue>
339+
{
340+
{ this.UserAssignedIdentityId, new PSManagedServiceIdentityUserAssignedIdentitiesValue() }
341+
}
342+
};
343+
}
344+
325345
if (this.CustomErrorConfiguration != null)
326346
{
327347
applicationGateway.CustomErrorConfigurations = this.CustomErrorConfiguration?.ToList();

src/ResourceManager/Network/Commands.Network/ApplicationGateway/SslCertificate/AzureApplicationGatewaySslCertificateBase.cs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,36 @@ public class AzureApplicationGatewaySslCertificateBase : NetworkBaseCmdlet
2929
public string Name { get; set; }
3030

3131
[Parameter(
32-
Mandatory = true,
32+
Mandatory = false,
3333
HelpMessage = "Path of certificate PFX file")]
3434
[ValidateNotNullOrEmpty]
3535
public string CertificateFile { get; set; }
3636

3737
[Parameter(
38-
Mandatory = true,
38+
Mandatory = false,
3939
HelpMessage = "Certificate password")]
4040
[ValidateNotNullOrEmpty]
4141
public SecureString Password { get; set; }
4242

43+
[Parameter(
44+
Mandatory = false,
45+
HelpMessage = "SecretId (uri) of the KeyVault Secret. Use this option when a specific version of secret needs to be used.")]
46+
[ValidateNotNullOrEmpty]
47+
public string KeyVaultSecretId { get; set; }
48+
4349
public PSApplicationGatewaySslCertificate NewObject()
4450
{
4551
var sslCertificate = new PSApplicationGatewaySslCertificate();
4652

4753
sslCertificate.Name = this.Name;
48-
sslCertificate.Data = Convert.ToBase64String(File.ReadAllBytes(this.CertificateFile));
49-
sslCertificate.Password = this.Password;
54+
if (this.CertificateFile != null)
55+
{
56+
sslCertificate.Data = Convert.ToBase64String(File.ReadAllBytes(this.CertificateFile));
57+
sslCertificate.Password = this.Password;
58+
}
59+
60+
sslCertificate.KeyVaultSecretId = this.KeyVaultSecretId;
61+
5062
sslCertificate.Id =
5163
ApplicationGatewayChildResourceHelper.GetResourceNotSetId(
5264
this.NetworkClient.NetworkManagementClient.SubscriptionId,

src/ResourceManager/Network/Commands.Network/ChangeLog.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,10 @@
4040
- New-AzureRmApplicationGatewayUrlPathMapConfig
4141
* Removed deprecated -ResourceId parameter from Get-AzServiceEndpointPolicyDefinition
4242
* Removed deprecated EnableVmProtection property from PSVirtualNetwork
43-
* Removed deprecated Set-AzVirtualNetworkGatewayVpnClientConfig cmdlet
43+
* Removed deprecated Set-AzVirtualNetworkGatewayVpnClientConfig cmdlet
44+
* Added KeyVault Support to Application Gateway using Identity.
45+
- Cmdlets updated with optonal parameter -KeyVaultSecretId, -KeyVaultSecret
46+
- Add-AzApplicationGatewaySslCertificate
47+
- New-AzApplicationGatewaySslCertificate
48+
- Set-AzApplicationGatewaySslCertificate
49+
- New-AzApplicationGateway cmdlet updated with optional parameter -UserAssignedIdentityId, -UserAssignedIdentity

src/ResourceManager/Network/Commands.Network/Commands.Network.Netcore.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@
6868
<ItemGroup>
6969
<Content Include="help\**\*" CopyToOutputDirectory="PreserveNewest" />
7070
</ItemGroup>
71-
</Project>
71+
</Project>

src/ResourceManager/Network/Commands.Network/Common/NetworkResourceManagerProfile.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ private static void Initialize()
5656
cfg.CreateMap<CNM.PSResourceId, MNM.SubResource>();
5757
cfg.CreateMap<MNM.SubResource, CNM.PSResourceId>();
5858

59+
// Managed Service Identity
60+
cfg.CreateMap<CNM.PSManagedServiceIdentity, MNM.ManagedServiceIdentity>();
61+
cfg.CreateMap<MNM.ManagedServiceIdentity, CNM.PSManagedServiceIdentity>();
62+
cfg.CreateMap<CNM.PSManagedServiceIdentityUserAssignedIdentitiesValue, MNM.ManagedServiceIdentityUserAssignedIdentitiesValue>();
63+
cfg.CreateMap<MNM.ManagedServiceIdentityUserAssignedIdentitiesValue, CNM.PSManagedServiceIdentityUserAssignedIdentitiesValue>();
64+
5965
// Route Filter
6066
cfg.CreateMap<CNM.PSRouteFilter, MNM.RouteFilter>();
6167
cfg.CreateMap<MNM.RouteFilter, CNM.PSRouteFilter>();

src/ResourceManager/Network/Commands.Network/Models/PSApplicationGateway.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ public class PSApplicationGateway : PSTopLevelResource
7575
[Ps1Xml(Target = ViewControl.Table)]
7676
public string ProvisioningState { get; set; }
7777

78+
[Ps1Xml(Target = ViewControl.Table)]
79+
public PSManagedServiceIdentity Identity { get; set; }
80+
7881
[JsonIgnore]
7982
public string GatewayIpConfigurationsText
8083
{

src/ResourceManager/Network/Commands.Network/Models/PSApplicationGatewaySslCertificate.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public class PSApplicationGatewaySslCertificate : PSChildResource
2323
public string Data { get; set; }
2424
public SecureString Password { get; set; }
2525
public string PublicCertData { get; set; }
26+
public string KeyVaultSecretId { get; set; }
2627
[Ps1Xml(Target = ViewControl.Table)]
2728
public string ProvisioningState { get; set; }
2829
public string Type { get; set; }
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//
2+
// Copyright (c) Microsoft. All rights reserved.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
16+
using Microsoft.Azure.Management.Network.Models;
17+
using Microsoft.WindowsAzure.Commands.Common.Attributes;
18+
using System.Collections.Generic;
19+
20+
namespace Microsoft.Azure.Commands.Network.Models
21+
{
22+
public class PSManagedServiceIdentity
23+
{
24+
[Ps1Xml(Target = ViewControl.Table)]
25+
public ResourceIdentityType? Type { get; set; }
26+
[Ps1Xml(Target = ViewControl.Table)]
27+
public string PrincipalId { get; set; }
28+
[Ps1Xml(Target = ViewControl.Table)]
29+
public string TenantId { get; set; }
30+
[Ps1Xml(Target = ViewControl.Table)]
31+
public Dictionary<string, PSManagedServiceIdentityUserAssignedIdentitiesValue> UserAssignedIdentities { get; set; }
32+
}
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//
2+
// Copyright (c) Microsoft. All rights reserved.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
16+
using Microsoft.WindowsAzure.Commands.Common.Attributes;
17+
18+
namespace Microsoft.Azure.Commands.Network.Models
19+
{
20+
public class PSManagedServiceIdentityUserAssignedIdentitiesValue
21+
{
22+
[Ps1Xml(Target = ViewControl.Table)]
23+
public string PrincipalId { get; set; }
24+
[Ps1Xml(Target = ViewControl.Table)]
25+
public string ClientId { get; set; }
26+
}
27+
}

src/ResourceManager/Network/Commands.Network/help/Add-AzApplicationGatewayAuthenticationCertificate.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ The credentials, account, tenant, and subscription used for communication with a
6161
```yaml
6262
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
6363
Parameter Sets: (All)
64-
Aliases: AzureRmContext, AzureCredential
64+
Aliases: AzContext, AzureRmContext, AzureCredential
6565

6666
Required: False
6767
Position: Named

src/ResourceManager/Network/Commands.Network/help/Add-AzApplicationGatewayBackendAddressPool.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ The credentials, account, tenant, and subscription used for communication with a
104104
```yaml
105105
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
106106
Parameter Sets: (All)
107-
Aliases: AzureRmContext, AzureCredential
107+
Aliases: AzContext, AzureRmContext, AzureCredential
108108

109109
Required: False
110110
Position: Named

src/ResourceManager/Network/Commands.Network/help/Add-AzApplicationGatewayBackendHttpSettings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ The credentials, account, tenant, and subscription used for communication with a
122122
```yaml
123123
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
124124
Parameter Sets: (All)
125-
Aliases: AzureRmContext, AzureCredential
125+
Aliases: AzContext, AzureRmContext, AzureCredential
126126

127127
Required: False
128128
Position: Named

src/ResourceManager/Network/Commands.Network/help/Add-AzApplicationGatewayCustomError.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ The credentials, account, tenant, and subscription used for communication with A
6868
```yaml
6969
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
7070
Parameter Sets: (All)
71-
Aliases: AzureRmContext, AzureCredential
71+
Aliases: AzContext, AzureRmContext, AzureCredential
7272

7373
Required: False
7474
Position: Named

src/ResourceManager/Network/Commands.Network/help/Add-AzApplicationGatewayFrontendIPConfig.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ The credentials, account, tenant, and subscription used for communication with a
9797
```yaml
9898
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
9999
Parameter Sets: (All)
100-
Aliases: AzureRmContext, AzureCredential
100+
Aliases: AzContext, AzureRmContext, AzureCredential
101101

102102
Required: False
103103
Position: Named

src/ResourceManager/Network/Commands.Network/help/Add-AzApplicationGatewayFrontendPort.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ The credentials, account, tenant, and subscription used for communication with a
5555
```yaml
5656
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
5757
Parameter Sets: (All)
58-
Aliases: AzureRmContext, AzureCredential
58+
Aliases: AzContext, AzureRmContext, AzureCredential
5959

6060
Required: False
6161
Position: Named

src/ResourceManager/Network/Commands.Network/help/Add-AzApplicationGatewayHttpListener.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ The credentials, account, tenant, and subscription used for communication with a
9292
```yaml
9393
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
9494
Parameter Sets: (All)
95-
Aliases: AzureRmContext, AzureCredential
95+
Aliases: AzContext, AzureRmContext, AzureCredential
9696

9797
Required: False
9898
Position: Named

src/ResourceManager/Network/Commands.Network/help/Add-AzApplicationGatewayHttpListenerCustomError.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ The credentials, account, tenant, and subscription used for communication with A
5454
```yaml
5555
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
5656
Parameter Sets: (All)
57-
Aliases: AzureRmContext, AzureCredential
57+
Aliases: AzContext, AzureRmContext, AzureCredential
5858

5959
Required: False
6060
Position: Named

src/ResourceManager/Network/Commands.Network/help/Add-AzApplicationGatewayIPConfiguration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ The credentials, account, tenant, and subscription used for communication with a
6767
```yaml
6868
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
6969
Parameter Sets: (All)
70-
Aliases: AzureRmContext, AzureCredential
70+
Aliases: AzContext, AzureRmContext, AzureCredential
7171

7272
Required: False
7373
Position: Named

src/ResourceManager/Network/Commands.Network/help/Add-AzApplicationGatewayProbeConfig.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ The credentials, account, tenant, and subscription used for communication with a
5656
```yaml
5757
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
5858
Parameter Sets: (All)
59-
Aliases: AzureRmContext, AzureCredential
59+
Aliases: AzContext, AzureRmContext, AzureCredential
6060

6161
Required: False
6262
Position: Named

src/ResourceManager/Network/Commands.Network/help/Add-AzApplicationGatewayRedirectConfiguration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ The credentials, account, tenant, and subscription used for communication with a
7070
```yaml
7171
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
7272
Parameter Sets: (All)
73-
Aliases: AzureRmContext, AzureCredential
73+
Aliases: AzContext, AzureRmContext, AzureCredential
7474

7575
Required: False
7676
Position: Named

src/ResourceManager/Network/Commands.Network/help/Add-AzApplicationGatewayRequestRoutingRule.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ The credentials, account, tenant, and subscription used for communication with a
129129
```yaml
130130
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
131131
Parameter Sets: (All)
132-
Aliases: AzureRmContext, AzureCredential
132+
Aliases: AzContext, AzureRmContext, AzureCredential
133133

134134
Required: False
135135
Position: Named

src/ResourceManager/Network/Commands.Network/help/Add-AzApplicationGatewayRewriteRuleSet.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ The credentials, account, tenant, and subscription used for communication with A
5555
```yaml
5656
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
5757
Parameter Sets: (All)
58-
Aliases: AzureRmContext, AzureCredential
58+
Aliases: AzContext, AzureRmContext, AzureCredential
5959

6060
Required: False
6161
Position: Named

0 commit comments

Comments
 (0)