Skip to content

Commit bb1262b

Browse files
committed
[Azure portal] add bicep quickstart
1 parent e7c3069 commit bb1262b

File tree

2 files changed

+37
-45
lines changed

2 files changed

+37
-45
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

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

Lines changed: 34 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Create an Azure portal dashboard by using a Bicep file
33
description: Learn how to create an Azure portal dashboard by using a Bicep file.
44
ms.topic: quickstart
55
ms.custom: subject-bicepqs,
6-
ms.date: 09/07/2022
6+
ms.date: 09/15/2022
77
---
88

99
# Quickstart: Create a dashboard in the Azure portal by using a Bicep file
@@ -17,37 +17,6 @@ A dashboard in the Azure portal is a focused and organized view of your cloud re
1717
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
1818
- [Azure PowerShell](/powershell/azure/install-az-ps) or [Azure CLI](/cli/azure/install-azure-cli).
1919

20-
## Create a virtual machine
21-
22-
The dashboard you create in the next part of this quickstart requires an existing VM. Create a VM by following these steps.
23-
24-
1. In the Azure portal, select **Cloud Shell** from the global controls at the top of the page.
25-
26-
:::image type="content" source="media/quick-create-template/cloud-shell.png" alt-text="Screenshot showing the Cloud Shell option in the Azure portal.":::
27-
28-
1. In the **Cloud Shell** window, select **PowerShell**.
29-
30-
:::image type="content" source="media/quick-create-template/powershell.png" alt-text="Screenshot showing the PowerShell option in Cloud Shell.":::
31-
32-
1. Copy the following command and enter it at the command prompt to create a resource group.
33-
34-
```powershell
35-
New-AzResourceGroup -Name SimpleWinVmResourceGroup -Location EastUS
36-
```
37-
38-
1. Next, copy the following command and enter it at the command prompt to create a VM in your new resource group.
39-
40-
```powershell
41-
New-AzVm `
42-
-ResourceGroupName "SimpleWinVmResourceGroup" `
43-
-Name "myVM1" `
44-
-Location "East US"
45-
```
46-
47-
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-
49-
After the VM has been created, move on to the next section.
50-
5120
## Review the Bicep file
5221

5322
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:
@@ -56,25 +25,45 @@ The Bicep file used in this quickstart is from [Azure Quickstart Templates](http
5625

5726
## Deploy the Bicep file
5827

59-
This example uses the Azure portal to deploy the template. You can also use other methods to deploy ARM templates, such as [Azure PowerShell](../azure-resource-manager/templates/deploy-powershell.md), [Azure CLI](../azure-resource-manager/templates/deploy-cli.md), or [REST API](../azure-resource-manager/templates/deploy-rest.md).
60-
61-
1. Select the following image to sign in to Azure and open a template.
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 = '<resource-group-name>'
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+
```
6245
63-
[![Deploy to Azure](../media/template-deployments/deploy-to-azure.svg)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fquickstarts%2Fmicrosoft.portal%2Fazure-portal-dashboard%2Fazuredeploy.json)
46+
# [PowerShell](#tab/PowerShell)
6447
65-
1. Select or enter the following values, then select **Review + create**.
48+
```azurepowershell
49+
$resourceGroupName = '<resource-group-name>'
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'
6656
67-
:::image type="content" source="media/quick-create-template/create-dashboard-using-template-portal.png" alt-text="Screenshot of the dashboard template deployment screen in the Azure portal.":::
57+
$encrypted = ConvertTo-SecureString -string $adminPassword -AsPlainText
6858
69-
Unless it's specified, use the default values to create the dashboard.
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+
```
7063
71-
- **Subscription**: select the Azure subscription.
72-
- **Resource group**: select **SimpleWinVmResourceGroup**.
73-
- **Location**: If not automatically selected, choose **East US**.
74-
- **Virtual Machine Name**: enter **myVM1**.
75-
- **Virtual Machine Resource Group**: enter **SimpleWinVmResourceGroup**.
64+
---
7665
77-
1. Select **Create**. You'll see a notification confirming when the dashboard has been deployed successfully.
66+
When the deployment finishes, you should see a message indicating the deployment succeeded.
7867
7968
## Review deployed resources
8069

0 commit comments

Comments
 (0)