You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this article, you learn how to dissociate a public IP address from an Azure virtual machine (VM). Removing the public IP address of your VM will also remove its ability to connect to the internet.
18
18
19
-
You can use the [Azure portal](#azure-portal), the [Azure CLI](#azure-cli), or [Azure PowerShell](#powershell) to dissociate a public IP address from a VM.
19
+
You can use the Azure portal, the Azure CLI, or Azure PowerShell to dissociate a public IP address from a VM.
20
+
21
+
22
+
# [Azure portal](#tab/azureportal)
20
23
21
24
## Prerequisites
22
25
23
26
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
27
+
- A virtual machine with a public IP address associated to it.
24
28
25
-
## Azure portal
29
+
## Dissociate a public IP address from a VM
26
30
27
31
1. Sign in to the [Azure portal](https://portal.azure.com).
28
32
2. Browse to, or search for the virtual machine that you want to disassociate the public IP address from and then select it.
@@ -36,12 +40,16 @@ You can use the [Azure portal](#azure-portal), the [Azure CLI](#azure-cli), or [
36
40
37
41
:::image type="content" source="./media/remove-public-ip-address-vm/dissociate-public-ip.png" alt-text="Screenshot of the Overview page of a public IP address resource showing how to dissociate it from the network interface of a virtual machine.":::
38
42
39
-
## Azure CLI
43
+
# [Azure CLI](#tab/azurecli/)
44
+
45
+
## Prerequisites
40
46
41
47
Install the [Azure CLI](/cli/azure/install-azure-cli), or use the [Azure Cloud Shell](../../cloud-shell/overview.md). The Azure Cloud Shell is a free shell that you can run directly within the Azure portal. It has the Azure CLI preinstalled and configured to use with your account.
42
48
43
49
- If using the CLI locally in Bash, sign in to Azure with `az login`.
44
50
51
+
## Dissociate a public IP address from a VM
52
+
45
53
A public IP address is associated to an IP configuration of a network interface attached to a VM. Use the [az network nic-ip-config update](/cli/azure/network/nic/ip-config#az-network-nic-ip-config-update) command to dissociate a public IP address from an IP configuration.
46
54
47
55
The following example dissociates a public IP address named *myVMPublicIP* from an IP configuration named *ipconfigmyVM* of an existing network interface named *myVMNic* that is attached to a VM named *myVM* in a resource group named *myResourceGroup*.
@@ -97,12 +105,16 @@ az network nic ip-config update \
97
105
98
106
In the previous example, *myVMPublicIP* is the name of the public IP address.
99
107
100
-
## PowerShell
108
+
109
+
110
+
## Pre-requisites
101
111
102
112
Install [PowerShell](/powershell/azure/install-azure-powershell), or use the [Azure Cloud Shell](../../cloud-shell/overview.md). The Azure Cloud Shell is a free shell that you can run directly within the Azure portal. It has PowerShell preinstalled and configured to use with your account.
103
113
104
114
- If using PowerShell locally, sign in to Azure with `Connect-AzAccount`.
105
115
116
+
# [Azure PowerShell](#tab/azurepowershell/)
117
+
106
118
A public IP address is associated to an IP configuration of a network interface attached to a VM. Use the [Get-AzNetworkInterface](/powershell/module/Az.Network/Get-AzNetworkInterface) command to get a network interface. Set the Public IP address value to null and then use the [Set-AzNetworkInterface](/powershell/module/Az.Network/Set-AzNetworkInterface) command to write the new IP configuration to the network interface.
107
119
108
120
The following example dissociates a public IP address named *myVMPublicIP* from a network interface named *myVMNic* that is attached to a VM named *myVM*. All resources are in a resource group named *myResourceGroup*.
0 commit comments