Edit

Set-AzPublicIpAddress

Updates a public IP address.

Syntax

Default (Default)

Set-AzPublicIpAddress
    -PublicIpAddress <PSPublicIpAddress>
    [-DdosCustomPolicyId <String>]
    [-RemoveDdosCustomPolicy]
    [-AsJob]
    [-DefaultProfile <IAzureContextContainer>]
    [-AcquirePolicyToken]
    [-ChangeReference <String>]
    [<CommonParameters>]

Description

The Set-AzPublicIpAddress cmdlet updates a public IP address.

Examples

Example 1: Change allocation method of a public IP address

$publicIp = Get-AzPublicIpAddress -Name $publicIpName -ResourceGroupName $rgName

$publicIp.PublicIpAllocationMethod = "Static"

Set-AzPublicIpAddress -PublicIpAddress $publicIp

Get-AzPublicIpAddress -Name $publicIpName -ResourceGroupName $rgName

First command gets the public IP address resource with name $publicIPName in the resource group $rgName. Second command sets the allocation method of the public IP address object to "Static". Set-AzPublicIPAddress command updates the public IP address resource with the updated object, and modifies the allocation method to 'Static'. A public IP address gets allocated immediately.

Example 2: Add DNS domain label of a public IP address

$publicIp = Get-AzPublicIpAddress -Name $publicIpName -ResourceGroupName $rgName

$publicIp.DnsSettings = @{"DomainNameLabel" = "newdnsprefix"}

Set-AzPublicIpAddress -PublicIpAddress $publicIp

$publicIp = Get-AzPublicIpAddress -Name $publicIpName -ResourceGroupName $rgName

First command gets the public IP address resource with name $publicIPName in the resource group $rgName. Second command sets the DomainNameLabel property to the required dns prefix. Set-AzPublicIPAddress command updates the public IP address resource with the updated object. DomainNameLabel & Fqdn are modified as expected.

Example 3: Change DNS domain label of a public IP address

$publicIp = Get-AzPublicIpAddress -Name $publicIpName -ResourceGroupName $rgName

$publicIp.DnsSettings.DomainNameLabel = "newdnsprefix"

Set-AzPublicIpAddress -PublicIpAddress $publicIp

$publicIp = Get-AzPublicIpAddress -Name $publicIpName -ResourceGroupName $rgName

First command gets the public IP address resource with name $publicIPName in the resource group $rgName. Second command sets the DomainNameLabel property to the required dns prefix. Set-AzPublicIPAddress command updates the public IP address resource with the updated object. DomainNameLabel & Fqdn are modified as expected.

Example 4: Associate a DDoS custom policy with a supported public IP address

$publicIp = Get-AzPublicIpAddress -Name $publicIpName -ResourceGroupName $rgName

Set-AzPublicIpAddress -PublicIpAddress $publicIp -DdosCustomPolicyId $ddosCustomPolicyId

The first command gets a Standard public IP address. The second command associates the DDoS custom policy with the public IP address. The service validates that the public IP address has a supported attachment, such as a network interface.

Example 5: Remove a DDoS custom policy association

$publicIp = Get-AzPublicIpAddress -Name $publicIpName -ResourceGroupName $rgName

Set-AzPublicIpAddress -PublicIpAddress $publicIp -RemoveDdosCustomPolicy

The first command gets the public IP address. The second command removes its DDoS custom policy association.

Parameters

-AcquirePolicyToken

Acquire an Azure Policy token automatically for this resource operation.

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

-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

-ChangeReference

The change reference resource ID for this resource operation.

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:False
Value from remaining arguments:False

-DdosCustomPolicyId

The DDoS custom policy ID to associate with a supported public IP address. The service validates whether the public IP address attachment supports a DDoS custom policy. This parameter cannot be used with -RemoveDdosCustomPolicy.

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

-PublicIpAddress

Specifies a public IP address object representing the state to which the public IP address should be set.

Parameter properties

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

Parameter sets

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

-RemoveDdosCustomPolicy

Removes the DDoS custom policy association from the Public IP address. This parameter cannot be used with -DdosCustomPolicyId.

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: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

PSPublicIpAddress

Outputs

PSPublicIpAddress