|
| 1 | +--- |
| 2 | +title: 'Quickstart: Configure Microsoft Dev Box by using an ARM template' |
| 3 | +description: In this quickstart, you learn how to configure the Microsoft Dev Box service to provide dev box workstations for users by using an ARM template. |
| 4 | +services: dev-box |
| 5 | +ms.service: dev-box |
| 6 | +ms.topic: quickstart-arm |
| 7 | +ms.custom: subject-armqs |
| 8 | +author: RoseHJM |
| 9 | +ms.author: rosemalcolm |
| 10 | +ms.date: 09/20/2023 |
| 11 | +#Customer intent: As an enterprise admin, I want to understand how to create and configure dev box components with an ARM template so that I can provide dev box projects for my users. |
| 12 | +--- |
| 13 | + |
| 14 | +# Quickstart: Configure Microsoft Dev Box by using an ARM template |
| 15 | + |
| 16 | +This quickstart describes how to use an Azure Resource Manager (ARM) template to set up the Microsoft Dev Box Service in Azure. |
| 17 | + |
| 18 | +[!INCLUDE [About Azure Resource Manager](../../includes/resource-manager-quickstart-introduction.md)] |
| 19 | + |
| 20 | +If your environment meets the prerequisites and you're familiar with using ARM templates, select the |
| 21 | +**Deploy to Azure** button. The template opens in the Azure portal. |
| 22 | + |
| 23 | +:::image type="content" source="../media/template-deployments/deploy-to-azure.svg" alt-text="Screenshot of the Deploy to Azure button to deploy resources with a template." link="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fquickstarts%2Fmicrosoft.devcenter%2Fdevbox-with-builtin-image%2Fazuredeploy.json"::: |
| 24 | + |
| 25 | +## Prerequisites |
| 26 | + |
| 27 | +- If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin. |
| 28 | +- Owner or Contributor role on an Azure subscription or resource group. |
| 29 | +- Entra AD. Your organization must use Entra AD for identity and access management. |
| 30 | + |
| 31 | +## Review the template |
| 32 | + |
| 33 | +The template used in this QuickStart is from [Azure Quickstart Templates](/samples/azure/azure-quickstart-templates/devbox-with-builtin-image/) |
| 34 | + |
| 35 | +:::code language="json" source="~/quickstart-templates/quickstarts/microsoft.devcenter/devbox-with-builtin-image/azuredeploy.json"::: |
| 36 | + |
| 37 | +Multiple Azure resources are defined in the template: |
| 38 | + |
| 39 | +- [Microsoft.Network/virtualNetworks](/azure/templates/microsoft.network/virtualnetworks): create a virtual network. |
| 40 | +- [Microsoft.Network/virtualNetworks/subnets](/azure/templates/microsoft.network/virtualnetworks/subnets): create a subnet. |
| 41 | +- [Microsoft.DevCenter/devcenters](/azure/templates/microsoft.devcenter/devcenters): create a dev center. |
| 42 | +- [Microsoft.DevCenter/projects](/azure/templates/microsoft.devcenter/projects): create a project. |
| 43 | +- [Microsoft.DevCenter/networkConnections](/azure/templates/microsoft.devcenter/networkConnections): create a network connection. |
| 44 | +- [Microsoft.DevCenter/devcenters/devboxdefinitions](/azure/templates/microsoft.devcenter/devcenters/devboxdefinitions): create a dev box definition. |
| 45 | +- [Microsoft.DevCenter/projects/pools](/azure/templates/microsoft.devcenter/projects/pools): create a dev box pool. |
| 46 | + |
| 47 | +### Find more templates |
| 48 | + |
| 49 | +To find more templates that are related to Microsoft Dev Box, see [Azure Quickstart Templates](https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.devcenter). |
| 50 | + |
| 51 | +For example, the [Dev Box with customized image](https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.devcenter/devbox-with-customized-image) template creates the following Dev Box resources: dev center, project, network connection, dev box definition, and dev box pool. You can then go to the [developer portal](https://aka.ms/devbox-portal) to [create your dev box](/azure/dev-box/quickstart-create-dev-box). |
| 52 | + |
| 53 | +Next, you can use a template to [add other customized images for Base, Java, .NET and Data](https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.devcenter/devbox-with-customized-image#add-other-customized-image-for-base-java-net-and-data). These images have the following software and tools installed: |
| 54 | + |
| 55 | + |
| 56 | +|Image type |Software and tools | |
| 57 | +|---------|---------| |
| 58 | +|Base |Git, Azure CLI, VS Code, VS Code Extension for GitHub Copilot | |
| 59 | +|Java |Git, Azure CLI, VS Code, Maven, OpenJdk11, VS Code Extension for Java Pack | |
| 60 | +|.NET |Git, Azure CLI, VS Code,.NET SDK, Visual Studio | |
| 61 | +|Data |Git, Azure CLI, VS Code,Python 3, VS Code Extension for Python and Jupyter | |
| 62 | + |
| 63 | +## Deploy the template |
| 64 | + |
| 65 | +1. Select **Open Cloudshell** from the following code block to open Azure Cloud Shell, and then follow the instructions to sign in to Azure. |
| 66 | + |
| 67 | + ```azurepowershell-interactive |
| 68 | + $vnetAddressPrefixes = Read-Host -Prompt "Enter a vnet address prefixes like 10.0.0.0/16" |
| 69 | + $subnetAddressPrefixes = Read-Host -Prompt "Enter a vnet address prefixes like 10.0.0.0/24" |
| 70 | + $location = Read-Host -Prompt "Enter the location (e.g. eastus)" |
| 71 | + |
| 72 | + $resourceGroupName = "rg-devbox-test" |
| 73 | + $templateUri = "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/quickstarts/microsoft.devcenter/devbox-with-builtin-image/azuredeploy.json" |
| 74 | + New-AzResourceGroup -Name $resourceGroupName -Location $location |
| 75 | + New-AzResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateUri $templateUri -vnetAddressPrefixes $vnetAddressPrefixes -subnetAddressPrefixes $subnetAddressPrefixes -location $location |
| 76 | +
|
| 77 | + Write-Host "After all the resources are provisioned, go to https://devportal.microsoft.com/ to create a Dev Box. You can also refer to this guide: [Quickstart: Create a dev box - Microsoft Dev Box | Microsoft Learn](https://learn.microsoft.com/azure/dev-box/quickstart-create-dev-box)." |
| 78 | + Write-Host "Press [ENTER] to continue." |
| 79 | + ``` |
| 80 | + |
| 81 | + Wait until you see the prompt from the console. |
| 82 | + |
| 83 | +2. Select **Copy** from the previous code block to copy the PowerShell script. |
| 84 | +3. Right-click the shell console pane and then select **Paste**. |
| 85 | +4. Enter the values. |
| 86 | + |
| 87 | +It takes about 10 minutes to deploy the template. When completed, the output is similar to: |
| 88 | + |
| 89 | + :::image type="content" source="media/quickstart-configure-dev-box-arm-template/dev-box-template-output.png" alt-text="Screenshot showing the output of the template."::: |
| 90 | + |
| 91 | +Azure PowerShell is used to deploy the template. You can also use the Azure portal and Azure CLI. To learn other deployment methods, see [Deploy templates](/azure/azure-resource-manager/templates/deploy-portal). |
| 92 | + |
| 93 | +#### Depending on your configuration, you may want to change the following parameters: |
| 94 | + |
| 95 | +- *Resource group name:* The default resource group name is “rg-devbox-test”; you can change it by editing `$resourceGroupName = "rg-devbox-test` in the template. |
| 96 | + |
| 97 | +- *Subnet:* If you have an existing subnet, you can use the parameter `-existingSubnetId` to pass the existing subnet ID. The template doesn't create a new Virtual network and subnet if you specify an existing one. |
| 98 | + |
| 99 | +- *Dev Box User role:* To grant the role [*DevCenter Dev Box User*](how-to-dev-box-user.md) to your user at Dev box project level, pass the principal ID to the `-principalId` parameter. |
| 100 | + - **User:** You can find the principal ID listed as the object ID on the user Overview page. |
| 101 | + :::image type="content" source="media/quickstart-configure-dev-box-arm-template/user-object-id.png" alt-text="Screenshot showing the user overview page with object ID highlighted."::: |
| 102 | + - **Group:** You can find the principal ID listed as the object ID on the group Overview page. |
| 103 | + :::image type="content" source="media/quickstart-configure-dev-box-arm-template/group-object-id.png" alt-text="Screenshot showing the group overview page with object ID highlighted."::: |
| 104 | + |
| 105 | +Alternatively, you can provide access to a dev box project in the Azure portal, see [Provide user-level access to projects for developers](how-to-dev-box-user.md) |
| 106 | + |
| 107 | +## Review deployed resources |
| 108 | + |
| 109 | +1. Sign in to the [Azure portal](https://portal.azure.com). |
| 110 | +2. Select **Resource groups** from the left pane. |
| 111 | +3. Select the resource group that you created in the previous section. |
| 112 | + |
| 113 | + :::image type="content" source="media/quickstart-configure-dev-box-arm-template/dev-box-template-resources.png" alt-text="Screenshot showing the newly created dev box resource group and the resources it contains in the Azure portal."::: |
| 114 | + |
| 115 | +1. Select the Dev Center. Its default name is dc-*resource-token*. |
| 116 | + |
| 117 | +## Clean up resources |
| 118 | + |
| 119 | +When you no longer need them, delete the resource group: Go to the Azure portal, select the resource group that contains these resources, and then select Delete. |
| 120 | + |
| 121 | + ## Next steps |
| 122 | + |
| 123 | +- [Quickstart: Create a dev box](/azure/dev-box/quickstart-create-dev-box) |
| 124 | +- [Configure Azure Compute Gallery for Microsoft Dev Box](how-to-configure-azure-compute-gallery.md) |
0 commit comments