Skip to content

Commit 63b9e80

Browse files
Merge pull request #191654 from schaffererin/0311-windowsvm-quickstart
Add Bicep quickstart article for Compute/VM-Windows
2 parents 5c0e08f + 6ddccff commit 63b9e80

File tree

3 files changed

+116
-1
lines changed

3 files changed

+116
-1
lines changed

articles/azure-resource-manager/bicep/toc.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@
4444
- name: Analysis Services
4545
href: ../../analysis-services/analysis-services-create-bicep-file.md?toc=/azure/azure-resource-manager/bicep/toc.json
4646
- name: Compute
47-
items:
47+
items:
4848
- name: Linux virtual machine
4949
href: ../../virtual-machines/linux/quick-create-bicep.md?toc=/azure/azure-resource-manager/bicep/toc.json
50+
- name: Windows virtual machine
51+
href: ../../virtual-machines/windows/quick-create-bicep.md?toc=/azure/azure-resource-manager/bicep/toc.json
5052
- name: Web
5153
items:
5254
- name: API Management

articles/virtual-machines/TOC.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@
3030
href: ./windows/quick-create-portal.md
3131
- name: PowerShell
3232
href: ./windows/quick-create-powershell.md
33+
- name: Bicep
34+
displayName: ARM, Resource Manager, Template
35+
href: ./windows/quick-create-bicep.md
3336
- name: ARM template
37+
displayName: Resource Manager
3438
href: ./windows/quick-create-template.md
3539
expanded: true
3640
- name: Tutorials
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
---
2+
title: 'Quickstart: Use a Bicep file to create a Windows VM'
3+
description: In this quickstart, you learn how to use a Bicep file to create a Windows virtual machine
4+
author: schaffererin
5+
ms.service: virtual-machines
6+
ms.collection: windows
7+
ms.topic: quickstart
8+
ms.workload: infrastructure
9+
ms.date: 03/11/2022
10+
ms.author: v-eschaffer
11+
ms.custom: subject-armqs, mode-arm
12+
---
13+
14+
# Quickstart: Create a Windows virtual machine using a Bicep file
15+
16+
**Applies to:** :heavy_check_mark: Windows VMs
17+
18+
This quickstart shows you how to use a Bicep file to deploy a Windows virtual machine (VM) in Azure.
19+
20+
[!INCLUDE [About Bicep](../../../includes/resource-manager-quickstart-bicep-introduction.md)]
21+
22+
## Prerequisites
23+
24+
If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
25+
26+
## Review the Bicep file
27+
28+
The Bicep file used in this quickstart is from [Azure Quickstart Templates](https://azure.microsoft.com/resources/templates/vm-simple-windows/).
29+
30+
:::code language="bicep" source="~/quickstart-templates/quickstarts/microsoft.compute/vm-simple-windows/main.bicep":::
31+
32+
Several resources are defined in the Bicep file:
33+
34+
- [**Microsoft.Network/virtualNetworks/subnets**](/azure/templates/Microsoft.Network/virtualNetworks/subnets): create a subnet.
35+
- [**Microsoft.Storage/storageAccounts**](/azure/templates/Microsoft.Storage/storageAccounts): create a storage account.
36+
- [**Microsoft.Network/publicIPAddresses**](/azure/templates/Microsoft.Network/publicIPAddresses): create a public IP address.
37+
- [**Microsoft.Network/networkSecurityGroups**](/azure/templates/Microsoft.Network/networkSecurityGroups): create a network security group.
38+
- [**Microsoft.Network/virtualNetworks**](/azure/templates/Microsoft.Network/virtualNetworks): create a virtual network.
39+
- [**Microsoft.Network/networkInterfaces**](/azure/templates/Microsoft.Network/networkInterfaces): create a NIC.
40+
- [**Microsoft.Compute/virtualMachines**](/azure/templates/Microsoft.Compute/virtualMachines): create a virtual machine.
41+
42+
## Deploy the Bicep file
43+
44+
1. Save the Bicep file as **main.bicep** to your local computer.
45+
1. Deploy the Bicep file using either Azure CLI or Azure PowerShell.
46+
47+
# [CLI](#tab/CLI)
48+
49+
```azurecli
50+
az group create --name exampleRG --location eastus
51+
az deployment group create --resource-group exampleRG --template-file main.bicep --parameters adminUsername=<admin-username>
52+
```
53+
54+
# [PowerShell](#tab/PowerShell)
55+
56+
```azurepowershell
57+
New-AzResourceGroup -Name exampleRG -Location eastus
58+
New-AzResourceGroupDeployment -ResourceGroupName exampleRG -TemplateFile ./main.bicep -adminUsername "<admin-username>"
59+
```
60+
61+
---
62+
63+
> [!NOTE]
64+
> Replace **\<admin-username\>** with a unique username. You'll also be prompted to enter adminPassword. The minimum password length is 12 characters.
65+
66+
When the deployment finishes, you should see a messaged indicating the deployment succeeded.
67+
68+
## Review deployed resources
69+
70+
Use the Azure portal, Azure CLI, or Azure PowerShell to list the deployed resources in the resource group.
71+
72+
# [CLI](#tab/CLI)
73+
74+
```azurecli-interactive
75+
az resource list --resource-group exampleRG
76+
```
77+
78+
# [PowerShell](#tab/PowerShell)
79+
80+
```azurepowershell-interactive
81+
Get-AzResource -ResourceGroupName exampleRG
82+
```
83+
84+
---
85+
86+
## Clean up resources
87+
88+
When no longer needed, use the Azure portal, Azure CLI, or Azure PowerShell to delete the VM and all of the resources in the resource group.
89+
90+
# [CLI](#tab/CLI)
91+
92+
```azurecli-interactive
93+
az group delete --name exampleRG
94+
```
95+
96+
# [PowerShell](#tab/PowerShell)
97+
98+
```azurepowershell-interactive
99+
Remove-AzResourceGroup -Name exampleRG
100+
```
101+
102+
---
103+
104+
## Next steps
105+
106+
In this quickstart, you deployed a simple virtual machine using a Bicep file. To learn more about Azure virtual machines, continue to the tutorial for Linux VMs.
107+
108+
> [!div class="nextstepaction"]
109+
> [Azure Windows virtual machine tutorials](./tutorial-manage-vm.md)

0 commit comments

Comments
 (0)