Skip to content

Commit e4c24d5

Browse files
authored
Add new parameter for New-AzPublicIpPrefix (#15412)
1 parent c631d70 commit e4c24d5

File tree

4 files changed

+48
-11
lines changed

4 files changed

+48
-11
lines changed

src/Network/Network/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
* Updated cmdlets to enable processing of available zones on AzureFirewalll
2323
- `New-AzFirewall`
2424
* Updated cmdlets to add properties for new BYOIP features.
25+
- `New-AzPublicIpAddress`
2526
- `New-AzCustomIpPrefix`
2627
- `Update-AzCustomIpPrefix`
2728

src/Network/Network/Network.format.ps1xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,6 +1556,10 @@
15561556
<Label>IpTags</Label>
15571557
<PropertyName>IpTagsText</PropertyName>
15581558
</ListItem>
1559+
<ListItem>
1560+
<Label>PublicIpPrefix</Label>
1561+
<PropertyName>PublicIpPrefixText</PropertyName>
1562+
</ListItem>
15591563
</ListItems>
15601564
</ListEntry>
15611565
</ListEntries>

src/Network/Network/PublicIpAddress/NewAzurePublicIpAddressCommand.cs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,14 @@ public class NewAzurePublicIpAddressCommand : PublicIpAddressBaseCmdlet
7575
public string Sku { get; set; }
7676

7777
[Parameter(
78-
Mandatory = false,
79-
ValueFromPipelineByPropertyName = true,
80-
HelpMessage = "The public IP Sku tier.")]
78+
Mandatory = false,
79+
ValueFromPipelineByPropertyName = true,
80+
HelpMessage = "The public IP Sku tier.")]
8181
[ValidateNotNullOrEmpty]
8282
[ValidateSet(
83-
MNM.PublicIPAddressSkuTier.Regional,
84-
MNM.PublicIPAddressSkuTier.Global,
85-
IgnoreCase = true)]
83+
MNM.PublicIPAddressSkuTier.Regional,
84+
MNM.PublicIPAddressSkuTier.Global,
85+
IgnoreCase = true)]
8686
public string Tier { get; set; }
8787

8888
[Parameter(
@@ -141,7 +141,13 @@ public class NewAzurePublicIpAddressCommand : PublicIpAddressBaseCmdlet
141141
Mandatory = false,
142142
HelpMessage = "A list of availability zones denoting the IP allocated for the resource needs to come from.",
143143
ValueFromPipelineByPropertyName = true)]
144-
public string[] Zone { get; set; }
144+
public string[] Zone { get; set; }
145+
146+
[Parameter(
147+
Mandatory = false,
148+
HelpMessage = "Target ip Address for BYOIP PublicIpAddress.",
149+
ValueFromPipelineByPropertyName = true)]
150+
public string IpAddress { get; set; }
145151

146152
[Parameter(
147153
Mandatory = false,
@@ -183,6 +189,7 @@ private PSPublicIpAddress CreatePublicIpAddress()
183189
publicIp.PublicIpAddressVersion = this.IpAddressVersion;
184190
publicIp.Zones = this.Zone?.ToList();
185191
publicIp.PublicIpPrefix = this.PublicIpPrefix;
192+
publicIp.IpAddress = this.IpAddress;
186193

187194
if (!string.IsNullOrEmpty(this.EdgeZone))
188195
{

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

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Creates a public IP address.
1515

1616
```
1717
New-AzPublicIpAddress [-Name <String>] -ResourceGroupName <String> [-Location <String>] [-EdgeZone <String>]
18-
[-Sku <String>] [-Tier <String>] -AllocationMethod <String> [-IpAddressVersion <String>]
18+
[-Sku <String>] [-Tier <String>] -AllocationMethod <String> [-IpAddressVersion <String>] [-IpAddress <String>]
1919
[-DomainNameLabel <String>] [-IpTag <PSPublicIpTag[]>] [-PublicIpPrefix <PSPublicIpPrefix>]
2020
[-ReverseFqdn <String>] [-IdleTimeoutInMinutes <Int32>] [-Zone <String[]>] [-Tag <Hashtable>] [-Force]
2121
[-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
@@ -64,16 +64,26 @@ and passed as input through -IpTags.
6464

6565
### Example 4: Create a new public IP address from a Prefix
6666
```powershell
67-
$publicIp = New-AzPublicIpAddress -Name $publicIpName -ResourceGroupName $rgName -AllocationMethod Static -DomainNameLabel $dnsPrefix -Location $location
68-
-PublicIpPrefix publicIpPrefix -Sku Standard
67+
$publicIp = New-AzPublicIpAddress -Name $publicIpName -ResourceGroupName $rgName -AllocationMethod Static -DomainNameLabel $dnsPrefix -Location $location -PublicIpPrefix $publicIpPrefix -Sku Standard
6968
```
7069

7170
This command creates a new public IP address resource. A DNS record is created for
7271
$dnsPrefix.$location.cloudapp.azure.com pointing to the public IP address of this resource. A
7372
public IP address is immediately allocated to this resource from the publicIpPrefix specified.
7473
This option is only supported for the 'Standard' Sku and 'Static' AllocationMethod.
7574

76-
### Example 5: Create a new global public IP address
75+
### Example 5: Create a specific public IP address from a BYOIP Prefix
76+
```powershell
77+
$publicIp = New-AzPublicIpAddress -Name $publicIpName -ResourceGroupName $rgName -AllocationMethod Static -Location $location -IpAddress 0.0.0.0 -PublicIpPrefix $publicIpPrefix -Sku Standard
78+
```
79+
80+
This command creates a new public IP address resource with specific IP. NRP would check if the
81+
given IP is inside the PublicIpPrefix and if the given PublicIpPrefix is BYOIP PublicIpPrefix.
82+
the given public IP address is immediately allocated to this resource from the publicIpPrefix
83+
specified. This option is only supported for the 'Standard' Sku and 'Static' AllocationMethod
84+
and BYOIP PublicIpPrefix.
85+
86+
### Example 6: Create a new global public IP address
7787
```powershell
7888
$publicIp = New-AzPublicIpAddress -Name $publicIpName -ResourceGroupName $rgName -AllocationMethod Static -DomainNameLabel $domainNameLabel -Location $location -Sku Standard -Tier Global
7989
```
@@ -268,6 +278,21 @@ Accept pipeline input: True (ByPropertyName)
268278
Accept wildcard characters: False
269279
```
270280
281+
### -IpAddress
282+
Specifies the IP address when creating a BYOIP publicIpAddress.
283+
284+
```yaml
285+
Type: System.String
286+
Parameter Sets: (All)
287+
Aliases:
288+
289+
Required: False
290+
Position: Named
291+
Default value: None
292+
Accept pipeline input: True (ByPropertyName)
293+
Accept wildcard characters: False
294+
```
295+
271296
### -ResourceGroupName
272297
Specifies the name of the resource group in which to create a public IP address.
273298

0 commit comments

Comments
 (0)