Skip to content

Commit 9e010f1

Browse files
authored
Merge pull request #109179 from cherylmc/bascli
update
2 parents 0264e26 + 70536e7 commit 9e010f1

File tree

3 files changed

+73
-0
lines changed

3 files changed

+73
-0
lines changed

articles/bastion/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
href: bastion-create-host-portal.md
2121
- name: Azure PowerShell
2222
href: bastion-create-host-powershell.md
23+
- name: Azure CLI
24+
href: create-host-cli.md
2325
- name: Connect to a virtual machine
2426
items:
2527
- name: SSH (Linux)

articles/bastion/create-host-cli.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
title: 'Create a Bastion host using Azure CLI | Azure Bastion'
3+
description: In this article, learn how to create and delete a Bastion host
4+
services: bastion
5+
author: cherylmc
6+
7+
ms.service: bastion
8+
ms.topic: conceptual
9+
ms.date: 03/26/2020
10+
ms.author: cherylmc
11+
# Customer intent: As someone with a networking background, I want to create an Azure Bastion host.
12+
13+
---
14+
15+
# Create an Azure Bastion host using Azure CLI
16+
17+
This article shows you how to create an Azure Bastion host using Azure CLI. Once you provision the Azure Bastion service in your virtual network, the seamless RDP/SSH experience is available to all of the VMs in the same virtual network. Azure Bastion deployment is per virtual network, not per subscription/account or virtual machine.
18+
19+
Optionally, you can create an Azure Bastion host by using the [Azure portal](bastion-create-host-portal.md), or using [Azure PowerShell](bastion-create-host-powershell.md).
20+
21+
## Before you begin
22+
23+
Verify that you have an Azure subscription. If you don't already have an Azure subscription, you can activate your [MSDN subscriber benefits](https://azure.microsoft.com/pricing/member-offers/msdn-benefits-details) or sign up for a [free account](https://azure.microsoft.com/pricing/free-trial).
24+
25+
[!INCLUDE [cloudshell cli](../../includes/vpn-gateway-cloud-shell-cli.md)]
26+
27+
## <a name="createhost"></a>Create a bastion host
28+
29+
This section helps you create a new Azure Bastion resource using Azure CLI.
30+
31+
1. Create a virtual network and an Azure Bastion subnet. You must create the Azure Bastion subnet using the name value **AzureBastionSubnet**. This value lets Azure know which subnet to deploy the Bastion resources to. This is different than a Gateway subnet. You must use a subnet of at least /27 or larger subnet (/27, /26, and so on). Create the **AzureBastionSubnet** without any route tables or delegations. If you use Network Security Groups on the **AzureBastionSubnet**, refer to the [Work with NSGs](bastion-nsg.md) article.
32+
33+
```azurecli-interactive
34+
az network vnet create -g MyResourceGroup -n MyVnet --address-prefix 10.0.0.0/16 --subnet-name AzureBastionSubnet --subnet-prefix 10.0.0.0/24
35+
```
36+
37+
2. Create a public IP address for Azure Bastion. The public IP is the public IP address the Bastion resource on which RDP/SSH will be accessed (over port 443). The public IP address must be in the same region as the Bastion resource you are creating.
38+
39+
```azurecli-interactive
40+
az network public-ip create -g MyResourceGroup -n MyIp
41+
```
42+
43+
3. Create a new Azure Bastion resource in the AzureBastionSubnet of your virtual network. It takes about 5 minutes for the Bastion resource to create and deploy.
44+
45+
```azurecli-interactive
46+
az network bastion create --name $name--public-ip-address $publicip--resource-group $RgName --vnet-name $VNetName --location $location
47+
48+
```
49+
50+
## Next steps
51+
52+
* Read the [Bastion FAQ](bastion-faq.md) for additional information.
53+
54+
* To use Network Security Groups with the Azure Bastion subnet, see [Work with NSGs](bastion-nsg.md).
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: include file
3+
description: include file
4+
services: vpn-gateway
5+
author: cherylmc
6+
ms.service: vpn-gateway
7+
ms.topic: include
8+
ms.date: 03/11/2020
9+
ms.author: cherylmc
10+
ms.custom: include file
11+
12+
# this file is used for all cli for bastion, VPN Gateway, Virtual WAN, and ExpressRoute
13+
---
14+
15+
This article uses the Azure CLI. To run commands, you can use Azure Cloud Shell. The Azure Cloud Shell is a free interactive shell that you can use to run the steps in this article. It has common Azure tools preinstalled and configured to use with your account.
16+
17+
To open the Cloud Shell, just select **Try it** from the upper right corner of a code block. You can also launch Cloud Shell in a separate browser tab by going to [https://shell.azure.com](https://shell.azure.com) and toggle the dropdown in the left corner to reflect Bash or PowerShell. Select **Copy** to copy the blocks of code, paste it into the Cloud Shell, and press enter to run it.

0 commit comments

Comments
 (0)