Skip to content

Commit eb1c882

Browse files
Merge pull request #312211 from asudbring/tsk555754-sfi-bastion
Add NSG creation to virtual-networks-static-private-ip
2 parents 17846db + 1b26df8 commit eb1c882

1 file changed

Lines changed: 34 additions & 1 deletion

File tree

articles/virtual-network/ip-services/virtual-networks-static-private-ip.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Create a VM with a static private IP address using the Azure portal, Azure PowerShell, or Azure CLI
33
description: Learn to create a virtual machine with a static private IP address using the Azure portal, Azure PowerShell, or Azure CLI.
4-
ms.date: 02/19/2026
4+
ms.date: 02/24/2026
55
ms.author: mbender
66
author: mbender-ms
77
ms.service: azure-virtual-network
@@ -90,6 +90,9 @@ When you create a virtual machine (VM), it's automatically assigned a private IP
9090

9191
1. Select **Review + create**. Review the settings, and then select **Create**.
9292

93+
> [!NOTE]
94+
> The virtual machine is created without a public IP address and with no public inbound ports. To connect to the virtual machine, use Azure Bastion. For more information, see [Quickstart: Deploy Azure Bastion with default settings](../../bastion/quickstart-host-portal.md).
95+
9396
# [Azure PowerShell](#tab/azurepowershell)
9497

9598
Use the following steps to create a resource group, virtual network, and virtual machine.
@@ -130,6 +133,23 @@ $vnet = @{
130133
New-AzVirtualNetwork @vnet
131134
```
132135

136+
### Create a network security group
137+
138+
Create a network security group with [New-AzNetworkSecurityGroup](/powershell/module/az.network/new-aznetworksecuritygroup). The default rules in the network security group deny all inbound access from the internet.
139+
140+
```azurepowershell-interactive
141+
## Create network security group. ##
142+
$nsg = @{
143+
Name = 'myNSG'
144+
ResourceGroupName = 'myResourceGroup'
145+
Location = 'eastus2'
146+
}
147+
New-AzNetworkSecurityGroup @nsg
148+
```
149+
150+
> [!NOTE]
151+
> The default rules of the network security group block all inbound access from the internet, including SSH. To connect to the virtual machine, use Azure Bastion. For more information, see [Quickstart: Deploy Azure Bastion with default settings](../../bastion/quickstart-host-portal.md).
152+
133153
### Create a virtual machine
134154

135155
Create a credential object for the virtual machine with [Get-Credential](/powershell/module/microsoft.powershell.security/get-credential). Enter a username and password when prompted:
@@ -185,6 +205,19 @@ az network vnet create \
185205
--subnet-prefixes 10.0.0.0/24
186206
```
187207

208+
### Create a network security group
209+
210+
Create a network security group with [az network nsg create](/cli/azure/network/nsg#az-network-nsg-create). The default rules in the network security group deny all inbound access from the internet.
211+
212+
```azurecli-interactive
213+
az network nsg create \
214+
--resource-group myResourceGroup \
215+
--name myNSG
216+
```
217+
218+
> [!NOTE]
219+
> The default rules of the network security group block all inbound access from the internet, including SSH. To connect to the virtual machine, use Azure Bastion. For more information, see [Quickstart: Deploy Azure Bastion with default settings](../../bastion/quickstart-host-portal.md).
220+
188221
### Create a virtual machine
189222

190223
The following command creates a Linux virtual machine without a public IP address with [az vm create](/cli/azure/vm#az-vm-create). The `--generate-ssh-keys` parameter generates an SSH key pair for the VM:

0 commit comments

Comments
 (0)