Skip to content

Commit 74d7be5

Browse files
powershell command for internet ingress property (#24000)
1 parent deb01ed commit 74d7be5

11 files changed

+271
-2
lines changed

src/Accounts/Accounts/Utilities/CommandMappings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4670,6 +4670,7 @@
46704670
"New-AzOffice365PolicyProperty": {},
46714671
"Get-AzNetworkVirtualApplianceSku": {},
46724672
"New-AzVirtualApplianceAdditionalNicProperty": {},
4673+
"New-AzVirtualApplianceInternetIngressIpsProperty": {},
46734674
"New-AzVirtualApplianceSkuProperty": {},
46744675
"New-AzCustomIpPrefix": {},
46754676
"New-AzSaaSNetworkVirtualAppliance": {},

src/Network/Network/Az.Network.psd1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,7 @@ CmdletsToExport = 'Add-AzApplicationGatewayAuthenticationCertificate',
569569
'Remove-AzVirtualApplianceSite', 'Update-AzVirtualApplianceSite',
570570
'New-AzOffice365PolicyProperty', 'Get-AzNetworkVirtualApplianceSku',
571571
'New-AzVirtualApplianceAdditionalNicProperty',
572+
'New-AzVirtualApplianceInternetIngressIpsProperty',
572573
'New-AzVirtualApplianceSkuProperty', 'New-AzCustomIpPrefix',
573574
'New-AzSaaSNetworkVirtualAppliance', 'Update-AzCustomIpPrefix',
574575
'Get-AzCustomIpPrefix', 'Remove-AzCustomIpPrefix',

src/Network/Network/ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
* Changed the Default Rule Set from CRS3.0 to DRS2.1 in `NewAzureApplicationGatewayFirewallPolicy`
2525
* Added optional property 'Profile' to `New-AzFirewallPolicyIntrusionDetection`
2626
* Added new cmdlet to update Connection child resource of Network Virtual Appliance. - `Update-AzNetworkVirtualApplianceConnection`
27+
* Added support of `InternetIngressIp` Property in New-AzNetworkVirtualAppliance
28+
* Added the new cmdlet for supporting `InternetIngressIp` Property with Network Virtual Appliances -`New-AzVirtualApplianceInternetIngressIpsProperty`
2729

2830
## Version 7.1.0
2931
* Added DefaultOutboundAccess parameter on subnet creation

src/Network/Network/Common/NetworkResourceManagerProfile.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2216,6 +2216,7 @@ private static void Initialize()
22162216
cfg.CreateMap<CNM.PSVirtualApplianceSite, MNM.VirtualApplianceSite>();
22172217
cfg.CreateMap<CNM.PSVirtualApplianceSkuProperties, MNM.VirtualApplianceSkuProperties>();
22182218
cfg.CreateMap<CNM.PSNetworkVirtualApplianceConnection, MNM.NetworkVirtualApplianceConnection>();
2219+
cfg.CreateMap<CNM.PSVirtualApplianceInternetIngressIpsProperties, MNM.InternetIngressPublicIpsProperties>();
22192220
cfg.CreateMap<CNM.PSNetworkVirtualApplianceDelegationProperties, MNM.DelegationProperties>();
22202221

22212222
// MNM to CNM
@@ -2238,6 +2239,7 @@ private static void Initialize()
22382239
cfg.CreateMap<MNM.VirtualApplianceSite, CNM.PSVirtualApplianceSite>();
22392240
cfg.CreateMap<MNM.VirtualApplianceSkuProperties, CNM.PSVirtualApplianceSkuProperties>();
22402241
cfg.CreateMap<MNM.VirtualApplianceAdditionalNicProperties, CNM.PSVirtualApplianceAdditionalNicProperties>();
2242+
cfg.CreateMap<MNM.InternetIngressPublicIpsProperties, CNM.PSVirtualApplianceInternetIngressIpsProperties>();
22412243
cfg.CreateMap<MNM.NetworkVirtualApplianceConnection,CNM.PSNetworkVirtualApplianceConnection>();
22422244
cfg.CreateMap<MNM.DelegationProperties, CNM.PSNetworkVirtualApplianceDelegationProperties>();
22432245

src/Network/Network/Models/PSNetworkVirtualAppliance.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,7 @@ public class PSNetworkVirtualAppliance : PSTopLevelResource
4848
public IList<PSVirtualApplianceAdditionalNicProperties> AdditionalNics { get; set; }
4949

5050
public PSNetworkVirtualApplianceDelegationProperties Delegation { get; set; }
51+
52+
public IList<PSVirtualApplianceInternetIngressIpsProperties> InternetIngressPublicIps { get; set; }
5153
}
5254
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
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+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
16+
using System;
17+
using System.Collections.Generic;
18+
using System.Globalization;
19+
using System.Text;
20+
21+
namespace Microsoft.Azure.Commands.Network.Models
22+
{
23+
public class PSVirtualApplianceInternetIngressIpsProperties
24+
{
25+
public string Id { get; set; }
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
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+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System;
16+
using System.Collections.Generic;
17+
using System.Management.Automation;
18+
using System.Text;
19+
using System.Linq;
20+
using Microsoft.Azure.Commands.Network.Models;
21+
22+
namespace Microsoft.Azure.Commands.Network
23+
{
24+
[Cmdlet(VerbsCommon.New, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "VirtualApplianceInternetIngressIpsProperty",
25+
SupportsShouldProcess = true),
26+
OutputType(typeof(PSVirtualApplianceInternetIngressIpsProperties))]
27+
public class NewVirtualApplianceInternetIngressIpsPropertyCommand : VirtualApplianceInternetIngressIpsPropertiesBaseCmdlet
28+
{
29+
[Parameter(
30+
Mandatory = true,
31+
ValueFromPipelineByPropertyName = false,
32+
HelpMessage = "The Public IPs for Internet Ingress.")]
33+
[ValidateNotNullOrEmpty]
34+
public string[] InternetIngressPublicIpId { get; set; }
35+
36+
public override void Execute()
37+
{
38+
base.Execute();
39+
40+
int elements = InternetIngressPublicIpId.Length;
41+
var InternetIngressIpsList = new List<PSVirtualApplianceInternetIngressIpsProperties>();
42+
43+
for (int i = 0; i < elements; i++)
44+
{
45+
var currentelement = new PSVirtualApplianceInternetIngressIpsProperties();
46+
currentelement.Id = InternetIngressPublicIpId[i];
47+
InternetIngressIpsList.Add(currentelement);
48+
}
49+
50+
WriteObject(InternetIngressIpsList, true);
51+
52+
}
53+
}
54+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
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+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
16+
using System;
17+
using System.Collections.Generic;
18+
using System.Text;
19+
20+
namespace Microsoft.Azure.Commands.Network
21+
{
22+
public class VirtualApplianceInternetIngressIpsPropertiesBaseCmdlet : NetworkBaseCmdlet
23+
{
24+
// Empty class for future development of Get/Set/Update commands.
25+
}
26+
}

src/Network/Network/NetworkVirtualAppliance/NewNetworkVirtualApplianceCommand.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,13 @@ public class NewNetworkVirtualApplianceCommand : NetworkVirtualApplianceBaseCmdl
137137
[ValidateNotNullOrEmpty]
138138
public PSVirtualApplianceAdditionalNicProperties[] AdditionalNic { get; set; }
139139

140+
[Parameter(
141+
Mandatory = false,
142+
ValueFromPipelineByPropertyName = true,
143+
HelpMessage = "The Internet Ingress IPs Properties of the Virtual Appliance.")]
144+
[ValidateNotNullOrEmpty]
145+
public PSVirtualApplianceInternetIngressIpsProperties[] InternetIngressIp { get; set; }
146+
140147
public override void Execute()
141148
{
142149
base.Execute();
@@ -182,6 +189,11 @@ private PSNetworkVirtualAppliance CreateNetworkVirtualAppliance()
182189
networkVirtualAppliance.AdditionalNics = AdditionalNic;
183190
}
184191

192+
if (InternetIngressIp != null)
193+
{
194+
networkVirtualAppliance.InternetIngressPublicIps = InternetIngressIp;
195+
}
196+
185197
var networkVirtualApplianceModel = NetworkResourceManagerProfile.Mapper.Map<MNM.NetworkVirtualAppliance>(networkVirtualAppliance);
186198

187199
networkVirtualApplianceModel.Tags = TagsConversionHelper.CreateTagDictionary(this.Tag, validate: true);

src/Network/Network/help/New-AzNetworkVirtualAppliance.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ New-AzNetworkVirtualAppliance -Name <String> -ResourceGroupName <String> -Locati
1818
-VirtualHubId <String> -Sku <PSVirtualApplianceSkuProperties> -VirtualApplianceAsn <Int32>
1919
[-Identity <PSManagedServiceIdentity>] [-BootStrapConfigurationBlob <String[]>]
2020
[-CloudInitConfigurationBlob <String[]>] [-CloudInitConfiguration <String>] [-Tag <Hashtable>] [-Force]
21-
[-AsJob] [-AdditionalNic <PSVirtualApplianceAdditionalNicProperties[]>]
21+
[-AsJob] [-AdditionalNic <PSVirtualApplianceAdditionalNicProperties[]>] [-InternetIngressIp <PSVirtualApplianceInternetIngressIpsProperties[]>]
2222
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
2323
```
2424

@@ -28,7 +28,7 @@ New-AzNetworkVirtualAppliance -ResourceId <String> -Location <String> -VirtualHu
2828
-Sku <PSVirtualApplianceSkuProperties> -VirtualApplianceAsn <Int32> [-Identity <PSManagedServiceIdentity>]
2929
[-BootStrapConfigurationBlob <String[]>] [-CloudInitConfigurationBlob <String[]>]
3030
[-CloudInitConfiguration <String>] [-Tag <Hashtable>] [-Force] [-AsJob]
31-
[-AdditionalNic <PSVirtualApplianceAdditionalNicProperties[]>] [-DefaultProfile <IAzureContextContainer>]
31+
[-AdditionalNic <PSVirtualApplianceAdditionalNicProperties[]>] [-InternetIngressIp <PSVirtualApplianceInternetIngressIpsProperties[]>] [-DefaultProfile <IAzureContextContainer>]
3232
[-WhatIf] [-Confirm] [<CommonParameters>]
3333
```
3434

@@ -61,6 +61,19 @@ $nva=New-AzNetworkVirtualAppliance -ResourceGroupName testrg -Name nva -Location
6161

6262
Creates a new Network Virtual Appliance resource in resource group: testrg with additional nic "sdwan" and a public IP attached to "sdwan" nic.
6363

64+
### Example 3
65+
```powershell
66+
$sku=New-AzVirtualApplianceSkuProperty -VendorName "ciscosdwantest" -BundledScaleUnit 4 -MarketPlaceVersion '17.6.03'
67+
$hub=Get-AzVirtualHub -ResourceGroupName testrg -Name hub
68+
$id1 = "/subscriptions/{subscriptionid}/resourceGroups/testrg/providers/Microsoft.Network/publicIPAddresses/{publicip1name}"
69+
$pip2 = Get-AzPublicIpAddress -Name publicip2name
70+
$id2 = $pip2.Id
71+
$IngressIps=New-AzVirtualApplianceInternetIngressIpsProperty -InternetIngressPublicIpId $id1, $id2
72+
$nva=New-AzNetworkVirtualAppliance -ResourceGroupName testrg -Name nva -Location eastus2 -VirtualApplianceAsn 65222 -VirtualHubId $hub.Id -Sku $sku -CloudInitConfiguration "echo Hello World!" -InternetIngressIp $IngressIps
73+
```
74+
75+
Creates a new Network Virtual Appliance resource in resource group: testrg with 2 Internet Ingress Public IPs attached to it.
76+
6477
## PARAMETERS
6578

6679
### -AdditionalNic
@@ -183,6 +196,21 @@ Accept pipeline input: True (ByPropertyName)
183196
Accept wildcard characters: False
184197
```
185198
199+
### -InternetIngressIp
200+
The Internet Ingress IPs to be attached to the Virtual Appliance.
201+
202+
```yaml
203+
Type: Microsoft.Azure.Commands.Network.Models.PSVirtualApplianceInternetIngressIpsProperties[]
204+
Parameter Sets: (All)
205+
Aliases:
206+
207+
Required: False
208+
Position: Named
209+
Default value: None
210+
Accept pipeline input: True (ByPropertyName)
211+
Accept wildcard characters: False
212+
```
213+
186214
### -Location
187215
The public IP address location.
188216

0 commit comments

Comments
 (0)