Edit

Share via


New-AzPublicIpAddress

Creates a public IP address.

Syntax

Default (Default)

New-AzPublicIpAddress
    [-Name <String>]
    -ResourceGroupName <String>
    -Location <String>
    [-EdgeZone <String>]
    [-Sku <String>]
    [-Tier <String>]
    -AllocationMethod <String>
    [-IpAddressVersion <String>]
    [-DomainNameLabel <String>]
    [-DomainNameLabelScope <PSDomainNameLabelScopeType>]
    [-IpTag <PSPublicIpTag[]>]
    [-PublicIpPrefix <PSPublicIpPrefix>]
    [-DdosProtectionMode <String>]
    [-DdosProtectionPlanId <String>]
    [-ReverseFqdn <String>]
    [-IdleTimeoutInMinutes <Int32>]
    [-Zone <String[]>]
    [-IpAddress <String>]
    [-Tag <Hashtable>]
    [-Force]
    [-AsJob]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The New-AzPublicIpAddress cmdlet creates a public IP address.

Examples

Example 1: Create a new public IP address

$publicIp = New-AzPublicIpAddress -Name $publicIpName -ResourceGroupName $rgName -AllocationMethod Static -DomainNameLabel $dnsPrefix -Location $location

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 as the -AllocationMethod is specified as 'Static'. If it is specified as 'Dynamic', a public IP address gets allocated only when you start (or create) the associated resource (like a VM or load balancer).

Example 2: Create a public IP address with a reverse FQDN

$publicIp = New-AzPublicIpAddress -Name $publicIpName -ResourceGroupName $rgName -AllocationMethod Static -DomainNameLabel $dnsPrefix -Location $location -ReverseFqdn $customFqdn

This command creates a new public IP address resource. With the -ReverseFqdn parameter, Azure creates a DNS PTR record (reverse-lookup) for the public IP address allocated to this resource, pointing to the $customFqdn specified in the command. As a pre-requisite, the $customFqdn (say webapp.contoso.com) should have a DNS CNAME record (forward-lookup) pointing to $dnsPrefix.$location.cloudapp.azure.com.

Example 3: Create a new public IP address with IpTag

$ipTag = New-AzPublicIpTag -IpTagType "FirstPartyUsage" -Tag "/Sql"
$publicIp = New-AzPublicIpAddress -Name $publicIpName -ResourceGroupName $rgName -AllocationMethod Static -DomainNameLabel $dnsPrefix -Location $location -IpTag $ipTag

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 as the -AllocationMethod is specified as 'Static'. If it is specified as 'Dynamic', a public IP address gets allocated only when you start (or create) the associated resource (like a VM or load balancer). An Iptag is used to specific the Tags associated with resource. Iptag can be specified using New-AzPublicIpTag and passed as input through -IpTags.

Example 4: Create a new public IP address from a Prefix

$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 specific public IP address from a BYOIP Prefix

$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

$publicIp = New-AzPublicIpAddress -Name $publicIpName -ResourceGroupName $rgName -AllocationMethod Static -DomainNameLabel $domainNameLabel -Location $location -Sku Standard -Tier Global

This command creates a new global 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 global public IP address is immediately allocated to this resource. This option is only supported for the 'Standard' Sku and 'Static' AllocationMethod.

Example 7: Create a public IP address with a DomainNameLabelScope

$publicIp = New-AzPublicIpAddress -Name $publicIpName -ResourceGroupName $rgName -AllocationMethod Static -DomainNameLabel $dnsPrefix -DomainNameLabelScope $hasedReusePolicy -Location $location

This command creates a new public IP address resource. With the -DomainNameLabelScope parameter, Azure creates a DNS record with a hashed value in FQDN for the public IP address allocated to this resource with the policy suggested by $hasedReusePolicy.

Parameters

-AllocationMethod

Specifies the method with which to allocate the public IP address. The acceptable values for this parameter are: Static or Dynamic.

Parameter properties

Type:String
Default value:None
Accepted values:Dynamic, Static
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-AsJob

Run cmdlet in the background

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DdosProtectionMode

The DdosProtectionMode to use for Public IP address

Parameter properties

Type:String
Default value:None
Accepted values:VirtualNetworkInherited, Enabled, Disabled
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-DdosProtectionPlanId

The DdosProtectionPlan id to attach to the Public IP address

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure.

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DomainNameLabel

Specifies the relative DNS name for a public IP address.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-DomainNameLabelScope

Specifies the HashedReusePolicy for DNS name for a public IP address.

Parameter properties

Type:

Nullable<T>[PSDomainNameLabelScopeType]

Default value:None
Accepted values:TenantReuse, SubscriptionReuse, ResourceGroupReuse, NoReuse
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-EdgeZone

The name of the extended location.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Force

Forces the command to run without asking for user confirmation.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-IdleTimeoutInMinutes

Specifies the idle time-out, in minutes.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-IpAddress

Specifies the IP address when creating a BYOIP publicIpAddress.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-IpAddressVersion

Specifies the version of the IP address.

Parameter properties

Type:String
Default value:None
Accepted values:IPv4, IPv6
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-IpTag

IpTag List.

Parameter properties

Type:

PSPublicIpTag[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Location

Specifies the region in which to create a public IP address.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Name

Specifies the name of the public IP address that this cmdlet creates.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:ResourceName

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-PublicIpPrefix

Specifies the PSPublicIpPrefix from which to allocate the public IP address.

Parameter properties

Type:PSPublicIpPrefix
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ResourceGroupName

Specifies the name of the resource group in which to create a public IP address.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ReverseFqdn

Specifies a reverse fully qualified domain name (FQDN).

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Sku

The public IP Sku name.

Parameter properties

Type:String
Default value:None
Accepted values:Basic, Standard, StandardV2
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Tag

Key-value pairs in the form of a hash table. For example: @{key0="value0";key1=$null;key2="value2"}

Parameter properties

Type:Hashtable
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Tier

The public IP Sku Tier.

Parameter properties

Type:String
Default value:None
Accepted values:Regional, Global
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Zone

A list of availability zones denoting the IP allocated for the resource needs to come from.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

String

PSPublicIpTag

PSPublicIpPrefix

Int32

String

Hashtable

Outputs

PSPublicIpAddress