
az network vnet create -resource-group 'myResourceGroup' -name 'myVNet' -subnet-name 'mySubnet' -subnet-prefixes 10.0.0.0/24 -network-security-group 'mySubnet-nsg'Ĭreate a subnet for Azure Bastion using az network vnet subnet create. # Create a network security group.Īz network nsg create -name 'mySubnet-nsg' -resource-group 'myResourceGroup' -location 'eastus'Ĭreate a virtual network using az network vnet create. # Create a resource group.Īz group create -name 'myResourceGroup' -location 'eastus'Ĭreate a default network security group using az network nsg create. An Azure resource group is a logical container into which Azure resources are deployed and managed. New-AzBastion -ResourceGroupName 'myResourceGroup' -Name 'myVNet-Bastion' -PublicIpAddressRgName 'myResourceGroup' -PublicIpAddressName 'myBastionIp' -VirtualNetwork $vnetĬreate a resource group using az group create. New-AzPublicIpAddress -ResourceGroupName 'myResourceGroup' -Name 'myBastionIp' -Location 'eastus' -AllocationMethod 'Static' -Sku 'Standard'Ĭreate the Bastion host using New-AzBastion. # Create a public IP address for Azure Bastion. $vnet = New-AzVirtualNetwork -Name 'myVNet' -ResourceGroupName 'myResourceGroup' -Location 'eastus' -AddressPrefix '10.0.0.0/16' -Subnet $firstSubnet, $secondSubnetĬreate the public IP address resource required for the Bastion host using New-AzPublicIpAddress. $secondSubnet = New-AzVirtualNetworkSubnetConfig -Name 'AzureBastionSubnet' -AddressPrefix '10.0.1.0/26'Ĭreate a virtual network using New-AzVirtualNetwork. $firstSubnet = New-AzVirtualNetworkSubnetConfig -Name 'mySubnet' -AddressPrefix '10.0.0.0/24' -NetworkSecurityGroup $networkSecurityGroup $networkSecurityGroup = New-AzNetworkSecurityGroup -Name 'mySubnet-nsg' -ResourceGroupName 'myResourceGroup' -Location 'eastus'Ĭreate a subnet configuration for the virtual machine subnet and the Bastion host subnet using New-AzVirtualNetworkSubnetConfig. New-AzResourceGroup -Name 'myResourceGroup' -Location 'eastus'Ĭreate a default network security group using New-AzNetworkSecurityGroup. Review the settings, and then select Create.Ĭreate a resource group using New-AzResourceGroup. In the Edit subnet page, enter the following values: Setting Select the IP Addresses tab, or select Next button at the bottom of the page.Īccept the default IP address space 10.0.0.0/16 and edit the default subnet by selecting the pencil icon. Under Azure Bastion, select Enable Azure Bastion and accept the default values: Setting Select the Security tab, or select the Next button at the bottom of the page. In Create virtual network, enter or select the following values in the Basics tab: Setting Select Virtual networks in the search results. In the search box at the top of the portal, enter virtual networks. You also create a network security group and apply it to the first subnet. The first subnet is used for the virtual machine, and the second subnet is used for the Bastion host. In this section, you create a virtual network with two subnets and an Azure Bastion host.

If you run Azure CLI locally, sign in to Azure using the az login command.Ĭreate a virtual network and a Bastion host
Azure bastion nsg install#
You can also install Azure CLI locally to run the commands. You can also run the Cloud Shell from within the Azure portal. Select Copy to copy the code, and paste it into Cloud Shell to run it.
Azure bastion nsg code#
To run the commands in the Cloud Shell, select Open Cloudshell at the upper-right corner of a code block. The steps in this article run the Azure CLI commands interactively in Azure Cloud Shell. If you run PowerShell locally, sign in to Azure using the Connect-AzAccount cmdlet.

You can also install Azure PowerShell locally to run the cmdlets. Select Copy to copy the code and then paste it into Cloud Shell to run it.


The steps in this article run the Azure PowerShell cmdlets interactively in Azure Cloud Shell. Sign in to the Azure portal with your Azure account. An Azure account with an active subscription.
