Skip to content

Commit d95cf17

Browse files
authored
Merge pull request #211449 from mumian/0907-bicep-portal
[Azure portal] Add a Bicep quickstart
2 parents 4ffea83 + e0c7bd9 commit d95cf17

File tree

3 files changed

+119
-22
lines changed

3 files changed

+119
-22
lines changed

articles/azure-portal/TOC.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
href: quickstart-portal-dashboard-azure-cli.md
1919
- name: Azure PowerShell
2020
href: quickstart-portal-dashboard-powershell.md
21+
- name: Bicep
22+
displayName: Resource Manager, ARM, template
23+
href: quick-create-bicep.md
2124
- name: ARM template
2225
displayName: Resource Manager
2326
href: quick-create-template.md
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
---
2+
title: Create an Azure portal dashboard by using a Bicep file
3+
description: Learn how to create an Azure portal dashboard by using a Bicep file.
4+
ms.topic: quickstart
5+
ms.custom: subject-bicepqs,
6+
ms.date: 09/15/2022
7+
---
8+
9+
# Quickstart: Create a dashboard in the Azure portal by using a Bicep file
10+
11+
A dashboard in the Azure portal is a focused and organized view of your cloud resources. This quickstart focuses on the process of deploying a Bicep file to create a dashboard. The dashboard shows the performance of a virtual machine (VM), and some static information and links.
12+
13+
[!INCLUDE [About Bicep](../../includes/resource-manager-quickstart-bicep-introduction.md)]
14+
15+
## Prerequisites
16+
17+
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
18+
- [Azure PowerShell](/powershell/azure/install-az-ps) or [Azure CLI](/cli/azure/install-azure-cli).
19+
20+
## Review the Bicep file
21+
22+
The Bicep file used in this quickstart is from [Azure Quickstart Templates](https://azure.microsoft.com/resources/templates/azure-portal-dashboard/). The Bicep file for this article is too long to show here. To view the Bicep file, see [main.bicep](https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/quickstarts/microsoft.portal/azure-portal-dashboard/main.bicep). The Bicep file defines one Azure resource, a dashboard that displays data about the VM you created:
23+
24+
- [Microsoft.Portal/dashboards](/azure/templates/microsoft.portal/dashboards?pivots=deployment-language-bicep)
25+
26+
## Deploy the Bicep file
27+
28+
1. Save the Bicep file as **main.bicep** to your local computer.
29+
1. Deploy the Bicep file using either Azure CLI or Azure PowerShell.
30+
# [CLI](#tab/CLI)
31+
32+
```azurecli
33+
$resourceGroupName = 'SimpleWinVmResourceGroup'
34+
$location = 'eastus'
35+
$adminUserName = '<admin-user-name>'
36+
$adminPassword = '<admin-password>'
37+
$dnsLabelPrefix = '<dns-label-prefix>'
38+
$virtualMachineName = 'SimpleWinVM'
39+
$vmTemplateUri = 'https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/quickstarts/microsoft.portal/azure-portal-dashboard/prereqs/prereq.azuredeploy.json'
40+
41+
az group create --name $resourceGroupName --location $location
42+
az deployment group create --resource-group $resourceGroupName --template-uri $vmTemplateUri --parameters adminUsername=$adminUserName adminPassword=$adminPassword dnsLabelPrefix=$dnsLabelPrefix
43+
az deployment group create --resource-group $resourceGroupName --template-file main.bicep --parameters virtualMachineName=$virtualMachineName virtualMachineResourceGroup=$resourceGroupName
44+
```
45+
46+
# [PowerShell](#tab/PowerShell)
47+
48+
```azurepowershell
49+
$resourceGroupName = 'SimpleWinVmResourceGroup'
50+
$location = 'eastus'
51+
$adminUserName = '<admin-user-name>'
52+
$adminPassword = '<admin-password>'
53+
$dnsLabelPrefix = '<dns-label-prefix>'
54+
$virtualMachineName = 'SimpleWinVM'
55+
$vmTemplateUri = 'https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/quickstarts/microsoft.portal/azure-portal-dashboard/prereqs/prereq.azuredeploy.json'
56+
57+
$encrypted = ConvertTo-SecureString -string $adminPassword -AsPlainText
58+
59+
New-AzResourceGroup -Name $resourceGroupName -Location $location
60+
New-AzResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateUri $vmTemplateUri -adminUsername $adminUserName -adminPassword $encrypted -dnsLabelPrefix $dnsLabelPrefix
61+
New-AzResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateFile ./main.bicep -virtualMachineName $virtualMachineName -virtualMachineResourceGroup $resourceGroupName
62+
```
63+
64+
---
65+
66+
Replace the following values in the script:
67+
68+
- &lt;admin-user-name>: specify an administrator username.
69+
- &lt;admin-password>: specify an administrator password.
70+
- &lt;dns-label-prefix>: specify a DNS prefix.
71+
72+
The Bicep file requires an existing virtual machine. Before deploying the Bicep file, the script deploys an ARM template located at *https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/quickstarts/microsoft.portal/azure-portal-dashboard/prereqs/prereq.azuredeploy.json* for creating a virtual machine. The virtual machine name is hard-coded as **SimpleWinVM** in the ARM template.
73+
74+
When the deployment finishes, you should see a message indicating the deployment succeeded.
75+
76+
## Review deployed resources
77+
78+
[!INCLUDE [azure-portal-review-deployed-resources](../../includes/azure-portal-review-deployed-resources.md)]
79+
80+
## Clean up resources
81+
82+
If you want to remove the VM and associated dashboard, delete the resource group that contains them.
83+
84+
1. In the Azure portal, search for **SimpleWinVmResourceGroup**, then select it in the search results.
85+
86+
1. On the **SimpleWinVmResourceGroup** page, select **Delete resource group**, enter the resource group name to confirm, then select **Delete**.
87+
88+
> [!CAUTION]
89+
> Deleting a resource group will delete all of the resources contained within it. If the resource group contains additional resources aside from your virtual machine and dashboard, those resources will also be deleted.
90+
91+
## Next steps
92+
93+
For more information about dashboards in the Azure portal, see:
94+
95+
> [!div class="nextstepaction"]
96+
> [Create and share dashboards in the Azure portal](azure-portal-dashboards.md)

articles/azure-portal/quick-create-template.md

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ title: Create an Azure portal dashboard by using an Azure Resource Manager templ
33
description: Learn how to create an Azure portal dashboard by using an Azure Resource Manager template.
44
ms.topic: quickstart
55
ms.custom: subject-armqs, mode-arm
6-
ms.date: 01/13/2022
6+
ms.date: 09/16/2022
77
---
88

99
# Quickstart: Create a dashboard in the Azure portal by using an ARM template
1010

11-
A dashboard in the Azure portal is a focused and organized view of your cloud resources. This quickstart focuses on the process of deploying an Azure Resource Manager template (ARM template) to create a dashboard. The dashboard shows the performance of a virtual machine (VM), as well as some static information and links.
11+
A dashboard in the Azure portal is a focused and organized view of your cloud resources. This quickstart focuses on the process of deploying an Azure Resource Manager template (ARM template) to create a dashboard. The dashboard shows the performance of a virtual machine (VM), and some static information and links.
1212

1313
[!INCLUDE [About Azure Resource Manager](../../includes/resource-manager-quickstart-introduction.md)]
1414

@@ -19,35 +19,33 @@ If your environment meets the prerequisites and you're familiar with using ARM t
1919
## Prerequisites
2020

2121
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
22+
- [Azure PowerShell](/powershell/azure/install-az-ps) or [Azure CLI](/cli/azure/install-azure-cli).
23+
- A virtual machine. The dashboard you create in the next part of this quickstart requires an existing VM. Create a VM by following these steps.
2224

23-
## Create a virtual machine
25+
1. In the Azure portal, select **Cloud Shell** from the global controls at the top of the page.
2426

25-
The dashboard you create in the next part of this quickstart requires an existing VM. Create a VM by following these steps.
27+
:::image type="content" source="media/quick-create-template/cloud-shell.png" alt-text="Screenshot showing the Cloud Shell option in the Azure portal.":::
2628

27-
1. In the Azure portal, select **Cloud Shell** from the global controls at the top of the page.
29+
1. In the **Cloud Shell** window, select **PowerShell**.
2830

29-
:::image type="content" source="media/quick-create-template/cloud-shell.png" alt-text="Screenshot showing the Cloud Shell option in the Azure portal.":::
31+
:::image type="content" source="media/quick-create-template/powershell.png" alt-text="Screenshot showing the PowerShell option in Cloud Shell.":::
3032

31-
1. In the **Cloud Shell** window, select **PowerShell**.
33+
1. Copy the following command and enter it at the command prompt to create a resource group.
3234

33-
:::image type="content" source="media/quick-create-template/powershell.png" alt-text="Screenshot showing the PowerShell option in Cloud Shell.":::
35+
```powershell
36+
New-AzResourceGroup -Name SimpleWinVmResourceGroup -Location EastUS
37+
```
3438
35-
1. Copy the following command and enter it at the command prompt to create a resource group.
39+
1. Next, copy the following command and enter it at the command prompt to create a VM in your new resource group.
3640
37-
```powershell
38-
New-AzResourceGroup -Name SimpleWinVmResourceGroup -Location EastUS
39-
```
41+
```powershell
42+
New-AzVm `
43+
-ResourceGroupName "SimpleWinVmResourceGroup" `
44+
-Name "myVM1" `
45+
-Location "East US"
46+
```
4047
41-
1. Next, copy the following command and enter it at the command prompt to create a VM in your new resource group.
42-
43-
```powershell
44-
New-AzVm `
45-
-ResourceGroupName "SimpleWinVmResourceGroup" `
46-
-Name "myVM1" `
47-
-Location "East US"
48-
```
49-
50-
1. Enter a username and password for the VM. This is a new user name and password; it's not, for example, the account you use to sign in to Azure. For more information, see [username requirements](../virtual-machines/windows/faq.yml#what-are-the-username-requirements-when-creating-a-vm-) and [password requirements](../virtual-machines/windows/faq.yml#what-are-the-password-requirements-when-creating-a-vm-).
48+
1. Enter a username and password for the VM. This is a new user name and password; it's not, for example, the account you use to sign in to Azure. For more information, see [username requirements](../virtual-machines/windows/faq.yml#what-are-the-username-requirements-when-creating-a-vm-) and [password requirements](../virtual-machines/windows/faq.yml#what-are-the-password-requirements-when-creating-a-vm-).
5149
5250
After the VM has been created, move on to the next section.
5351

0 commit comments

Comments
 (0)