Skip to content

Commit 4125bcf

Browse files
Syntax blocks azurecli.
1 parent 35f1e29 commit 4125bcf

11 files changed

+63
-38
lines changed

articles/virtual-network/create-peering-different-deployment-models-subscriptions.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,10 @@ This tutorial uses different accounts for each subscription. If you're using an
9696
2. Run the classic CLI in Service Management mode by entering the `azure config mode asm` command.
9797
3. Enter the following classic CLI command to create the virtual network (classic):
9898

99-
```azurecli
99+
```console
100100
azure network vnet create --vnet myVnetB --address-space 10.1.0.0 --cidr 16 --location "East US"
101101
```
102+
102103
4. The remaining steps must be completed using a bash shell with the Azure CLI (not the classic CLI).
103104
5. Copy the following script to a text editor on your PC. Replace `<SubscriptionB-Id>` with your subscription ID. If you don't know your subscription Id, enter the `az account show` command. The value for **id** in the output is your subscription Id. Copy the modified script, paste it in to your CLI session, and then press `Enter`.
104105

@@ -165,6 +166,7 @@ This tutorial uses different accounts for each subscription. If you're using an
165166
--vnet-name myVnetA \
166167
--output table
167168
```
169+
168170
The output shows **Connected** in the **PeeringState** column.
169171

170172
Any Azure resources you create in either virtual network are now able to communicate with each other through their IP addresses. If you're using default Azure name resolution for the virtual networks, the resources in the virtual networks are not able to resolve names across the virtual networks. If you want to resolve names across virtual networks in a peering, you must create your own DNS server. Learn how to set up [Name resolution using your own DNS server](virtual-networks-name-resolution-for-vms-and-role-instances.md#name-resolution-that-uses-your-own-dns-server).
@@ -199,8 +201,8 @@ This tutorial uses different accounts for each subscription. If you're using an
199201

200202
5. Log in to UserB's subscription as UserB to use Resource Manager commands by entering the `Connect-AzAccount` command.
201203
6. Assign UserA permissions to virtual network B. Copy the following script to a text editor on your PC and replace `<SubscriptionB-id>` with the ID of subscription B. If you don't know the subscription Id, enter the `Get-AzSubscription` command to view it. The value for **Id** in the returned output is your subscription ID. Azure created the virtual network (classic) you created in step 4 in a resource group named *Default-Networking*. To execute the script, copy the modified script, paste it in to PowerShell, and then press `Enter`.
202-
203-
```powershell
204+
205+
```powershell
204206
New-AzRoleAssignment `
205207
-SignInName [email protected] `
206208
-RoleDefinitionName "Classic Network Contributor" `

articles/virtual-network/ipv6-add-to-existing-vnet-cli.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,17 @@ Before you deploy a dual stack application in Azure, you must configure your sub
3636
az feature register --name AllowIPv6VirtualNetwork --namespace Microsoft.Network
3737
az feature register --name AllowIPv6CAOnStandardLB --namespace Microsoft.Network
3838
```
39+
3940
It takes up to 30 minutes for feature registration to complete. You can check your registration status by running the following Azure CLI command:
4041

41-
```azurelci
42+
```azurecli
4243
az feature show --name AllowIPv6VirtualNetwork --namespace Microsoft.Network
4344
az feature show --name AllowIPv6CAOnStandardLB --namespace Microsoft.Network
4445
```
46+
4547
After the registration is complete, run the following command:
4648

47-
```azurelci
49+
```azurecli
4850
az provider register --namespace Microsoft.Network
4951
```
5052

articles/virtual-network/scripts/virtual-network-cli-sample-ipv6-dual-stack-standard-load-balancer.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,17 @@ To use the IPv6 for Azure virtual network feature, you must configure your subsc
2929
az feature register --name AllowIPv6VirtualNetwork --namespace Microsoft.Network
3030
az feature register --name AllowIPv6CAOnStandardLB --namespace Microsoft.Network
3131
```
32+
3233
It takes up to 30 minutes for feature registration to complete. You can check your registration status by running the following Azure CLI command:
3334

34-
```azurelci
35+
```azurecli
3536
az feature show --name AllowIPv6VirtualNetwork --namespace Microsoft.Network
3637
az feature show --name AllowIPv6CAOnStandardLB --namespace Microsoft.Network
3738
```
39+
3840
After the registration is complete, run the following command:
3941

40-
```azurelci
42+
```azurecli
4143
az provider register --namespace Microsoft.Network
4244
```
4345

@@ -274,6 +276,7 @@ az vm create \
274276
--availability-set dsAVset \
275277
--image MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest
276278
```
279+
277280
## View IPv6 dual stack virtual network in Azure portal
278281
You can view the IPv6 dual stack virtual network in Azure portal as follows:
279282
1. In the portal's search bar, enter *dsVnet*.

articles/virtual-network/scripts/virtual-network-cli-sample-ipv6-dual-stack.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,17 @@ To use the IPv6 for Azure virtual network feature, you must configure your subsc
2929
az feature register --name AllowIPv6VirtualNetwork --namespace Microsoft.Network
3030
az feature register --name AllowIPv6CAOnStandardLB --namespace Microsoft.Network
3131
```
32+
3233
It takes up to 30 minutes for feature registration to complete. You can check your registration status by running the following Azure CLI command:
3334

34-
```azurelci
35+
```azurecli
3536
az feature show --name AllowIPv6VirtualNetwork --namespace Microsoft.Network
3637
az feature show --name AllowIPv6CAOnStandardLB --namespace Microsoft.Network
3738
```
39+
3840
After the registration is complete, run the following command:
3941

40-
```azurelci
42+
```azurecli
4143
az provider register --namespace Microsoft.Network
4244
```
4345

@@ -256,6 +258,7 @@ az vm create \
256258
--image MicrosoftWindowsServer:WindowsServer:2016-Datacenter:latest
257259
258260
```
261+
259262
## Clean up deployment
260263

261264
Run the following command to remove the resource group, VM, and all related resources:

articles/virtual-network/tutorial-create-route-table-cli.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ Before you can create a route table, create a resource group with [az group crea
4747
az group create \
4848
--name myResourceGroup \
4949
--location eastus
50-
```
50+
```
5151

5252
Create a route table with [az network route-table create](/cli/azure/network/route-table#az-network-route-table-create). The following example creates a route table named *myRouteTablePublic*.
5353

54-
```azurecli-interactive
54+
```azurecli-interactive
5555
# Create a route table
5656
az network route-table create \
5757
--resource-group myResourceGroup \
@@ -151,6 +151,7 @@ az vm extension set \
151151
--publisher Microsoft.Azure.Extensions \
152152
--settings '{"commandToExecute":"sudo sysctl -w net.ipv4.ip_forward=1"}'
153153
```
154+
154155
The command may take up to a minute to execute.
155156

156157
## Create virtual machines
@@ -188,7 +189,7 @@ az vm create \
188189

189190
The VM takes a few minutes to create. After the VM is created, the Azure CLI shows information similar to the following example:
190191

191-
```azurecli
192+
```output
192193
{
193194
"fqdns": "",
194195
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVmPrivate",
@@ -200,21 +201,22 @@ The VM takes a few minutes to create. After the VM is created, the Azure CLI sho
200201
"resourceGroup": "myResourceGroup"
201202
}
202203
```
204+
203205
Take note of the **publicIpAddress**. This address is used to access the VM from the internet in a later step.
204206

205207
## Route traffic through an NVA
206208

207209
Use the following command to create an SSH session with the *myVmPrivate* VM. Replace *\<publicIpAddress>* with the public IP address of your VM. In the example above, the IP address is *13.90.242.231*.
208210

209-
```bash
211+
```bash
210212
ssh azureuser@<publicIpAddress>
211213
```
212214

213215
When prompted for a password, enter the password you selected in [Create virtual machines](#create-virtual-machines).
214216

215217
Use the following command to install trace route on the *myVmPrivate* VM:
216218

217-
```bash
219+
```bash
218220
sudo apt-get install traceroute
219221
```
220222

@@ -226,7 +228,7 @@ traceroute myVmPublic
226228

227229
The response is similar to the following example:
228230

229-
```bash
231+
```output
230232
traceroute to myVmPublic (10.0.0.4), 30 hops max, 60 byte packets
231233
1 10.0.0.4 (10.0.0.4) 1.404 ms 1.403 ms 1.398 ms
232234
```
@@ -235,13 +237,13 @@ You can see that traffic is routed directly from the *myVmPrivate* VM to the *my
235237

236238
Use the following command to SSH to the *myVmPublic* VM from the *myVmPrivate* VM:
237239

238-
```bash
240+
```bash
239241
ssh azureuser@myVmPublic
240242
```
241243

242244
Use the following command to install trace route on the *myVmPublic* VM:
243245

244-
```bash
246+
```bash
245247
sudo apt-get install traceroute
246248
```
247249

@@ -258,6 +260,7 @@ traceroute to myVmPrivate (10.0.1.4), 30 hops max, 60 byte packets
258260
1 10.0.2.4 (10.0.2.4) 0.781 ms 0.780 ms 0.775 ms
259261
2 10.0.1.4 (10.0.0.4) 1.404 ms 1.403 ms 1.398 ms
260262
```
263+
261264
You can see that the first hop is 10.0.2.4, which is the NVA's private IP address. The second hop is 10.0.1.4, the private IP address of the *myVmPrivate* VM. The route added to the *myRouteTablePublic* route table and associated to the *Public* subnet caused Azure to route the traffic through the NVA, rather than directly to the *Private* subnet.
262265

263266
Close the SSH sessions to both the *myVmPublic* and *myVmPrivate* VMs.
@@ -266,7 +269,7 @@ Close the SSH sessions to both the *myVmPublic* and *myVmPrivate* VMs.
266269

267270
When no longer needed, use [az group delete](/cli/azure/group) to remove the resource group and all of the resources it contains.
268271

269-
```azurecli-interactive
272+
```azurecli-interactive
270273
az group delete --name myResourceGroup --yes
271274
```
272275

articles/virtual-network/tutorial-tap-virtual-network-cli.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ Read [prerequisites](virtual-network-tap-overview.md#prerequisites) before you c
8282
--query id \
8383
--out tsv)
8484
```
85+
8586
- Create the virtual network TAP using the ID of the frontend IP configuration as the destination and an optional port property. The port specifies the destination port on front end IP configuration where the TAP traffic will be received :
8687
8788
```azurecli-interactive
@@ -136,7 +137,7 @@ Read [prerequisites](virtual-network-tap-overview.md#prerequisites) before you c
136137

137138
## Delete the TAP configuration on a network interface
138139

139-
```azure-cli-interactive
140+
```azurecli-interactive
140141
az network nic vtap-config delete \
141142
--resource-group myResourceGroup \
142143
--nic myNetworkInterface \

articles/virtual-network/virtual-network-ipv4-ipv6-dual-stack-cli.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,17 @@ az feature register --name AllowIPv6CAOnStandardLB --namespace Microsoft.Network
3939
```
4040
It takes up to 30 minutes for feature registration to complete. You can check your registration status by running the following Azure CLI command:
4141

42-
```azurelci
42+
```azurecli
4343
az feature show --name AllowIPv6VirtualNetwork --namespace Microsoft.Network
4444
az feature show --name AllowIPv6CAOnStandardLB --namespace Microsoft.Network
4545
```
46+
4647
After the registration is complete, run the following command:
4748

48-
```azurelci
49+
```azurecli
4950
az provider register --namespace Microsoft.Network
5051
```
52+
5153
## Create a resource group
5254

5355
Before you can create your dual-stack virtual network, you must create a resource group with [az group create](/cli/azure/group). The following example creates a resource group named *DsResourceGroup01* in the *eastus* location:
@@ -146,12 +148,14 @@ az network lb address-pool create \
146148
--name dsLbBackEndPool_v6 \
147149
--resource-group DsResourceGroup01
148150
```
151+
149152
### Create a health probe
150153
Create a health probe with [az network lb probe create](https://docs.microsoft.com/cli/azure/network/lb/probe?view=azure-cli-latest) to monitor the health of the virtual machines.
151154

152155
```azurecli
153156
az network lb probe create -g DsResourceGroup01 --lb-name dsLB -n dsProbe --protocol tcp --port 3389
154157
```
158+
155159
### Create a load balancer rule
156160

157161
A load balancer rule is used to define how traffic is distributed to the VMs. You define the frontend IP configuration for the incoming traffic and the backend IP pool to receive the traffic, along with the required source and destination port.
@@ -295,7 +299,7 @@ az network vnet subnet create \
295299
### Create NICs
296300

297301
Create virtual NICs for each VM with [az network nic create](https://docs.microsoft.com/cli/azure/network/nic?view=azure-cli-latest#az-network-nic-create). The following example creates a virtual NIC for each VM. Each NIC has two IP configurations (1 IPv4 config, 1 IPv6 config). You create the IPV6 configuration with [az network nic ip-config create](https://docs.microsoft.com/cli/azure/network/nic/ip-config?view=azure-cli-latest#az-network-nic-ip-config-create).
298-
302+
299303
```azurecli
300304
# Create NICs
301305
az network nic create \
@@ -358,6 +362,7 @@ Create virtual machine *dsVM0* as follows:
358362
--availability-set dsAVset \
359363
--image MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest
360364
```
365+
361366
Create virtual machine *dsVM1* as follows:
362367

363368
```azurecli

articles/virtual-network/virtual-network-ipv4-ipv6-dual-stack-standard-load-balancer-cli.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,20 @@ To use the IPv6 for Azure virtual network feature, you must configure your subsc
3535
az feature register --name AllowIPv6VirtualNetwork --namespace Microsoft.Network
3636
az feature register --name AllowIPv6CAOnStandardLB --namespace Microsoft.Network
3737
```
38+
3839
It takes up to 30 minutes for feature registration to complete. You can check your registration status by running the following Azure CLI command:
3940

40-
```azurelci
41+
```azurecli
4142
az feature show --name AllowIPv6VirtualNetwork --namespace Microsoft.Network
4243
az feature show --name AllowIPv6CAOnStandardLB --namespace Microsoft.Network
4344
```
45+
4446
After the registration is complete, run the following command:
4547

46-
```azurelci
48+
```azurecli
4749
az provider register --namespace Microsoft.Network
4850
```
51+
4952
## Create a resource group
5053

5154
Before you can create your dual-stack virtual network, you must create a resource group with [az group create](/cli/azure/group). The following example creates a resource group named *DsResourceGroup01* in the *eastus* location:
@@ -151,6 +154,7 @@ Create a health probe with [az network lb probe create](https://docs.microsoft.c
151154
```azurecli
152155
az network lb probe create -g DsResourceGroup01 --lb-name dsLB -n dsProbe --protocol tcp --port 3389
153156
```
157+
154158
### Create a load balancer rule
155159

156160
A load balancer rule is used to define how traffic is distributed to the VMs. You define the frontend IP configuration for the incoming traffic and the backend IP pool to receive the traffic, along with the required source and destination port.
@@ -357,6 +361,7 @@ Create virtual machine *dsVM0* as follows:
357361
--availability-set dsAVset \
358362
--image MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest
359363
```
364+
360365
Create virtual machine *dsVM1* as follows:
361366

362367
```azurecli

articles/virtual-network/virtual-network-multiple-ip-addresses-cli.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ You can add additional private and public IP addresses to an existing Azure netw
171171

172172
To add a private IP address to a NIC, you must create an IP configuration using the command that follows. The static IP address must be an unused address for the subnet.
173173

174-
```bash
174+
```azurecli
175175
az network nic ip-config create \
176176
--resource-group myResourceGroup \
177177
--nic-name myNic1 \
@@ -191,7 +191,7 @@ You can add additional private and public IP addresses to an existing Azure netw
191191

192192
Whenever you add a public IP address in a new IP configuration, you must also add a private IP address, because all IP configurations must have a private IP address. You can either add an existing public IP address resource, or create a new one. To create a new one, enter the following command:
193193

194-
```bash
194+
```azurecli
195195
az network public-ip create \
196196
--resource-group myResourceGroup \
197197
--location westcentralus \
@@ -201,7 +201,7 @@ You can add additional private and public IP addresses to an existing Azure netw
201201

202202
To create a new IP configuration with a static private IP address and the associated *myPublicIP3* public IP address resource, enter the following command:
203203

204-
```bash
204+
```azurecli
205205
az network nic ip-config create \
206206
--resource-group myResourceGroup \
207207
--nic-name myNic1 \
@@ -213,7 +213,7 @@ You can add additional private and public IP addresses to an existing Azure netw
213213
- **Associate the resource to an existing IP configuration**
214214
A public IP address resource can only be associated to an IP configuration that doesn't already have one associated. You can determine whether an IP configuration has an associated public IP address by entering the following command:
215215

216-
```bash
216+
```azurecli
217217
az network nic ip-config list \
218218
--resource-group myResourceGroup \
219219
--nic-name myNic1 \
@@ -230,7 +230,7 @@ You can add additional private and public IP addresses to an existing Azure netw
230230

231231
Since the **PublicIpAddressId** column for *IpConfig-3* is blank in the output, no public IP address resource is currently associated to it. You can add an existing public IP address resource to IpConfig-3, or enter the following command to create one:
232232

233-
```bash
233+
```azurecli
234234
az network public-ip create \
235235
--resource-group myResourceGroup
236236
--location westcentralus \
@@ -241,7 +241,7 @@ You can add additional private and public IP addresses to an existing Azure netw
241241

242242
Enter the following command to associate the public IP address resource to the existing IP configuration named *IPConfig-3*:
243243

244-
```bash
244+
```azurecli
245245
az network nic ip-config update \
246246
--resource-group myResourceGroup \
247247
--nic-name myNic1 \
@@ -251,7 +251,7 @@ You can add additional private and public IP addresses to an existing Azure netw
251251

252252
3. View the private IP addresses and the public IP address resource Ids assigned to the NIC by entering the following command:
253253

254-
```bash
254+
```azurecli
255255
az network nic ip-config list \
256256
--resource-group myResourceGroup \
257257
--nic-name myNic1 \

0 commit comments

Comments
 (0)