Skip to content

Commit 5d721a2

Browse files
amansahotra-mshtippanaboya
authored andcommitted
powershell command for internet ingress property (#24000)
1 parent 92be3dc commit 5d721a2

8 files changed

+267
-2
lines changed

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
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
---
2+
external help file: Microsoft.Azure.PowerShell.Cmdlets.Network.dll-Help.xml
3+
Module Name: Az.Network
4+
online version: https://learn.microsoft.com/powershell/module/az.network/new-azvirtualapplianceinternetingressipsproperty
5+
schema: 2.0.0
6+
---
7+
8+
# New-AzVirtualApplianceInternetIngressIpsProperty
9+
10+
## SYNOPSIS
11+
Define a Network Virtual Appliance Internet Ingress IPs Property for the resource.
12+
13+
## SYNTAX
14+
15+
```
16+
New-AzVirtualApplianceInternetIngressIpsProperty -InternetIngressPublicIpId <String>
17+
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
18+
```
19+
20+
## DESCRIPTION
21+
The New-AzVirtualApplianceInternetIngressIpsProperty command defines Public IPs which can be attached for Internet Ingress with Network Virtual Appliance resource.
22+
23+
## EXAMPLES
24+
25+
### Example 1
26+
```powershell
27+
$IngressIps=New-AzVirtualApplianceInternetIngressIpsProperty -InternetIngressPublicIpId "/subscriptions/{subscriptionid}/resourceGroups/{rgname}/providers/Microsoft.Network/publicIPAddresses/{publicipname}"
28+
```
29+
30+
Create an Internet Ingress Property object to be used with New-AzNetworkVirtualAppliance command.
31+
32+
### Example 2
33+
```powershell
34+
$IngressIps=New-AzVirtualApplianceInternetIngressIpsProperty -InternetIngressPublicIpId "/subscriptions/{subscriptionid}/resourceGroups/{rgname}/providers/Microsoft.Network/publicIPAddresses/{publicipname}", "/subscriptions/{subscriptionid}/resourceGroups/{rgname}/providers/Microsoft.Network/publicIPAddresses/{publicipname}"
35+
```
36+
37+
Creates a list of Internet Ingress Property object which has 2 Public IPs which can be attached to the Network Virtual Appliance resource.
38+
39+
## PARAMETERS
40+
41+
### -DefaultProfile
42+
The credentials, account, tenant, and subscription used for communication with Azure.
43+
44+
```yaml
45+
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
46+
Parameter Sets: (All)
47+
Aliases: AzContext, AzureRmContext, AzureCredential
48+
49+
Required: False
50+
Position: Named
51+
Default value: None
52+
Accept pipeline input: False
53+
Accept wildcard characters: False
54+
```
55+
56+
### -InternetIngressPublicIpId
57+
The IDs of the Public IPs which can be given as comma separated input.
58+
59+
```yaml
60+
Type: System.String
61+
Parameter Sets: (All)
62+
Aliases:
63+
64+
Required: True
65+
Position: Named
66+
Default value: None
67+
Accept pipeline input: False
68+
Accept wildcard characters: False
69+
```
70+
71+
### -Confirm
72+
Prompts you for confirmation before running the cmdlet.
73+
74+
```yaml
75+
Type: System.Management.Automation.SwitchParameter
76+
Parameter Sets: (All)
77+
Aliases: cf
78+
79+
Required: False
80+
Position: Named
81+
Default value: None
82+
Accept pipeline input: False
83+
Accept wildcard characters: False
84+
```
85+
86+
### -WhatIf
87+
Shows what would happen if the cmdlet runs. The cmdlet is not run.
88+
89+
```yaml
90+
Type: System.Management.Automation.SwitchParameter
91+
Parameter Sets: (All)
92+
Aliases: wi
93+
94+
Required: False
95+
Position: Named
96+
Default value: None
97+
Accept pipeline input: False
98+
Accept wildcard characters: False
99+
```
100+
101+
### CommonParameters
102+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
103+
104+
## INPUTS
105+
106+
### None
107+
108+
## OUTPUTS
109+
110+
### Microsoft.Azure.Commands.Network.Models.PSVirtualApplianceInternetIngressIpsProperties
111+
112+
## NOTES
113+
114+
## RELATED LINKS

0 commit comments

Comments
 (0)