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
#customer intent: As a DevTest Labs administrator, I want to learn about how to use a Bicep template so I can use Bicep to quickly and easily create labs with VMs.
9
10
---
10
11
11
12
# Quickstart: Use Bicep to create a lab in DevTest Labs
12
13
13
14
This quickstart uses Bicep to create a lab in Azure DevTest Labs that has one Windows Server 2019 Datacenter virtual machine (VM) in it.
14
15
15
-
In this quickstart, you take the following actions:
@@ -22,13 +25,22 @@ In this quickstart, you take the following actions:
22
25
23
26
## Prerequisites
24
27
25
-
If you don't have an Azure subscription, [create a free account](https://azure.microsoft.com/pricing/purchase-options/azure-account?cid=msft_learn) before you begin.
28
+
- An Azure subscription where you have permissions to create and manage resources. If you don't have one, [create a free account](https://azure.microsoft.com/pricing/purchase-options/azure-account?cid=msft_learn).
Review the Bicep file. The file uses the following resource types to take the following actions:
32
44
33
45
-[Microsoft.DevTestLab/labs](/azure/templates/microsoft.devtestlab/labs) creates the lab.
34
46
-[Microsoft.DevTestLab/labs/virtualnetworks](/azure/templates/microsoft.devtestlab/labs/virtualnetworks) creates a virtual network.
@@ -38,72 +50,79 @@ The Bicep file defines the following resource types:
38
50
39
51
## Deploy the Bicep file
40
52
41
-
1. Save the Bicep file as **main.bicep** to your local computer.
42
-
1. Deploy the Bicep file using either Azure CLI or Azure PowerShell.
53
+
1. Save the Bicep file as *main.bicep* to your local computer.
54
+
1. Run the following commands using either Azure CLI or Azure PowerShell from the folder where you saved the Bicep file. In the commands, replace the following placeholders:
55
+
-`<location>`: Azure region you want to use.
56
+
-`<lab-name>`: Name for the new lab.
57
+
-`<vm-name>`: Name for the new VM.
58
+
-`<user-name>`: Username of a local account to create on the new VM. You're prompted to enter a password for the local account. Be sure not to use any [disallowed usernames or passwords](/rest/api/compute/virtual-machines/create-or-update?tabs=HTTP#osprofile).
43
59
44
-
# [CLI](#tab/CLI)
60
+
# [Azure CLI](#tab/CLI)
45
61
46
-
```azurecli
47
-
az group create --name exampleRG --location eastus
48
-
az deployment group create --resource-group exampleRG --template-file main.bicep --parameters labName=<lab-name> vmName=<vm-name> userName=<user-name>
49
-
```
62
+
```azurecli
63
+
az group create --name exampleRG --location <location>
64
+
az deployment group create --resource-group exampleRG --template-file main.bicep --parameters labName=<lab-name> vmName=<vm-name> userName=<user-name>
> Replace **\<lab-name\>** with the name of the new lab instance. Replace **\<vm-name\>** with the name of the new VM. Replace **\<user-name\>** with username of the local account that will be created on the new VM. You'll also be prompted to enter a password for the local account.
76
+
The deployment also creates a resource group for the VM named `<lab-name>`-`<vm-name>`-`<numerical-string>`. This resource group contains VM resources like the IP address, network interface, and disk.
62
77
63
-
When the deployment finishes, you should see a message indicating the deployment succeeded.
78
+
When the deployment completes, the output shows data about the resources and the deployment.
64
79
65
80
## Validate the deployment
66
81
67
-
Use the Azure portal, Azure CLI, or Azure PowerShell to list the deployed resources in the resource group.
82
+
Use Azure CLI or Azure PowerShell to list the deployed resources in the resource group. You can also use the Azure portal.
68
83
69
-
# [CLI](#tab/CLI)
84
+
# [Azure CLI](#tab/CLI)
70
85
71
-
```azurecli-interactive
86
+
```azurecli
72
87
az resource list --resource-group exampleRG
73
88
```
74
89
75
-
# [PowerShell](#tab/PowerShell)
90
+
# [Azure PowerShell](#tab/PowerShell)
76
91
77
-
```azurepowershell-interactive
92
+
```azurepowershell
78
93
Get-AzResource -ResourceGroupName exampleRG
79
94
```
80
95
81
96
---
82
97
83
-
> [!NOTE]
84
-
> The deployment also creates a resource group for the VM. The resource group contains VM resources like the IP address, network interface, and disk. The resource group appears in your subscription's **Resource groups** list with the name **\<lab name>-\<vm name>-\<numerical string>**.
85
-
86
98
## Clean up resources
87
99
88
-
When no longer needed, use the Azure portal, Azure CLI, or Azure PowerShell to delete the resource group and all of its resources.
100
+
You can use Azure CLI or Azure PowerShell to delete the resource group and all of its resources when you don't need them anymore. You can also use the Azure portal.
101
+
102
+
If you want to manually delete the lab's resource group, you must delete the lab first. You can't delete a resource group that has a lab in it.
89
103
90
104
# [CLI](#tab/CLI)
91
105
92
-
```azurecli-interactive
106
+
```azurecli
93
107
az group delete --name exampleRG
94
108
```
95
109
96
110
# [PowerShell](#tab/PowerShell)
97
111
98
-
```azurepowershell-interactive
112
+
```azurepowershell
99
113
Remove-AzResourceGroup -Name exampleRG
100
114
```
101
115
102
116
---
103
117
104
-
## Next steps
118
+
## Next step
105
119
106
-
In this quickstart, you created a lab that has a Windows VM. To learn how to connect to and manage lab VMs, see the next tutorial:
120
+
To connect to lab VMs, see the next tutorial.
107
121
108
122
> [!div class="nextstepaction"]
109
-
> [Tutorial: Work with lab VMs](tutorial-use-custom-lab.md)
123
+
> [Access, claim, and connect to a DevTest Labs VM](tutorial-use-custom-lab.md)
124
+
125
+
## Related content
126
+
127
+
-[Tutorial: Create a lab and VM and add a user in DevTest Labs](tutorial-create-custom-lab.md)
0 commit comments