Remove-AzPublicIpAddress

Cmdlet Information

This cmdlet deletes a public IP address resource from Azure.

Module: Az.Network

Applicable to: Azure Resource Manager

Syntax

Remove-AzPublicIpAddress -Name <String> -ResourceGroupName <String> [-Force] [-AsJob] [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]

Parameters

Name Type Description Required
-Name String The name of the public IP address to remove. Yes
-ResourceGroupName String The name of the resource group containing the public IP address. Yes
-Force Switch Suppresses the confirmation prompt. Use this parameter to force the removal without a prompt. No
-AsJob Switch Run cmdlet in the background. No
-PassThru Switch Returns the object representing the removed public IP address. No
-WhatIf Switch Shows what would happen if the cmdlet runs. The cmdlet is not run. No
-Confirm Switch Prompts you for confirmation before running the cmdlet. No

Examples

Example 1: Remove a public IP address with confirmation

Remove-AzPublicIpAddress -Name "MyPublicIpAddress" -ResourceGroupName "MyResourceGroup"

This command prompts for confirmation before removing the public IP address named "MyPublicIpAddress" in the "MyResourceGroup" resource group.

Example 2: Remove a public IP address without confirmation

Remove-AzPublicIpAddress -Name "MyPublicIpAddress" -ResourceGroupName "MyResourceGroup" -Force

This command removes the public IP address named "MyPublicIpAddress" in the "MyResourceGroup" resource group without prompting for confirmation.

Example 3: Remove a public IP address and return the object

$publicIp = Remove-AzPublicIpAddress -Name "MyPublicIpAddress" -ResourceGroupName "MyResourceGroup" -PassThru

This command removes the public IP address and stores the representation of the removed resource in the $publicIp variable.