Skip to content

Add new parameter for New-AzPublicIpPrefix #15412

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Network/Network/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* Updated cmdlets to enable processing of available zones on AzureFirewalll
- `New-AzFirewall`
* Updated cmdlets to add properties for new BYOIP features.
- `New-AzPublicIpAddress`
- `New-AzCustomIpPrefix`
- `Update-AzCustomIpPrefix`

Expand Down
4 changes: 4 additions & 0 deletions src/Network/Network/Network.format.ps1xml
Original file line number Diff line number Diff line change
Expand Up @@ -1556,6 +1556,10 @@
<Label>IpTags</Label>
<PropertyName>IpTagsText</PropertyName>
</ListItem>
<ListItem>
<Label>PublicIpPrefix</Label>
<PropertyName>PublicIpPrefixText</PropertyName>
</ListItem>
</ListItems>
</ListEntry>
</ListEntries>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ public class NewAzurePublicIpAddressCommand : PublicIpAddressBaseCmdlet
public string Sku { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "The public IP Sku tier.")]
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "The public IP Sku tier.")]
[ValidateNotNullOrEmpty]
[ValidateSet(
MNM.PublicIPAddressSkuTier.Regional,
MNM.PublicIPAddressSkuTier.Global,
IgnoreCase = true)]
MNM.PublicIPAddressSkuTier.Regional,
MNM.PublicIPAddressSkuTier.Global,
IgnoreCase = true)]
public string Tier { get; set; }

[Parameter(
Expand Down Expand Up @@ -141,7 +141,13 @@ public class NewAzurePublicIpAddressCommand : PublicIpAddressBaseCmdlet
Mandatory = false,
HelpMessage = "A list of availability zones denoting the IP allocated for the resource needs to come from.",
ValueFromPipelineByPropertyName = true)]
public string[] Zone { get; set; }
public string[] Zone { get; set; }

[Parameter(
Mandatory = false,
HelpMessage = "Target ip Address for BYOIP PublicIpAddress.",
ValueFromPipelineByPropertyName = true)]
public string IpAddress { get; set; }

[Parameter(
Mandatory = false,
Expand Down Expand Up @@ -183,6 +189,7 @@ private PSPublicIpAddress CreatePublicIpAddress()
publicIp.PublicIpAddressVersion = this.IpAddressVersion;
publicIp.Zones = this.Zone?.ToList();
publicIp.PublicIpPrefix = this.PublicIpPrefix;
publicIp.IpAddress = this.IpAddress;

if (!string.IsNullOrEmpty(this.EdgeZone))
{
Expand Down
33 changes: 29 additions & 4 deletions src/Network/Network/help/New-AzPublicIpAddress.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Creates a public IP address.

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

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

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

### Example 5: Create a new global public IP address
### Example 5: Create a specific public IP address from a BYOIP Prefix
```powershell
$publicIp = New-AzPublicIpAddress -Name $publicIpName -ResourceGroupName $rgName -AllocationMethod Static -Location $location -IpAddress 0.0.0.0 -PublicIpPrefix $publicIpPrefix -Sku Standard
```

This command creates a new public IP address resource with specific IP. NRP would check if the
given IP is inside the PublicIpPrefix and if the given PublicIpPrefix is BYOIP PublicIpPrefix.
the given public IP address is immediately allocated to this resource from the publicIpPrefix
specified. This option is only supported for the 'Standard' Sku and 'Static' AllocationMethod
and BYOIP PublicIpPrefix.

### Example 6: Create a new global public IP address
```powershell
$publicIp = New-AzPublicIpAddress -Name $publicIpName -ResourceGroupName $rgName -AllocationMethod Static -DomainNameLabel $domainNameLabel -Location $location -Sku Standard -Tier Global
```
Expand Down Expand Up @@ -268,6 +278,21 @@ Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```
### -IpAddress
Specifies the IP address when creating a BYOIP publicIpAddress.
```yaml
Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```
### -ResourceGroupName
Specifies the name of the resource group in which to create a public IP address.
Expand Down