Skip to content

Commit 7063cf2

Browse files
author
RoseHJM
committed
Finalize draft
1 parent 32e2b78 commit 7063cf2

File tree

3 files changed

+22
-27
lines changed

3 files changed

+22
-27
lines changed
34 KB
Loading

articles/dev-box/quickstart-configure-dev-box-arm-template.md

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Multiple Azure resources are defined in the template:
4646
- [Microsoft.DevCenter/projects](/azure/templates/microsoft.devcenter/projects): create a project.
4747
- [Microsoft.DevCenter/networkConnections](/azure/templates/microsoft.devcenter/networkConnections): create a network connection.
4848
- [Microsoft.DevCenter/devcenters/devboxdefinitions](/azure/templates/microsoft.devcenter/devcenters/devboxdefinitions): create a dev box definition.
49+
- [Microsoft.DevCenter/devcenters/galleries](/azure/templates/microsoft.devcenter/devcenters/galleries): create an Azure Compute Gallery.
4950
- [Microsoft.DevCenter/projects/pools](/azure/templates/microsoft.devcenter/projects/pools): create a dev box pool.
5051

5152
### Find more templates
@@ -67,17 +68,21 @@ For example, you can use a template to [add other customized images for Base, Ja
6768
1. Select **Open Cloudshell** from the following code block to open Azure Cloud Shell, and then follow the instructions to sign in to Azure.
6869

6970
```azurepowershell-interactive
70-
$vnetAddressPrefixes = Read-Host -Prompt "Enter a vnet address prefixes like 10.0.0.0/16"
71-
$subnetAddressPrefixes = Read-Host -Prompt "Enter a vnet address prefixes like 10.0.0.0/24"
72-
$location = Read-Host -Prompt "Enter the location (e.g. eastus)"
73-
74-
$resourceGroupName = "rg-devbox-test"
75-
$templateUri = "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/quickstarts/microsoft.devcenter/devbox-with-builtin-image/azuredeploy.json"
76-
New-AzResourceGroup -Name $resourceGroupName -Location $location
77-
New-AzResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateUri $templateUri -vnetAddressPrefixes $vnetAddressPrefixes -subnetAddressPrefixes $subnetAddressPrefixes -location $location
78-
79-
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)."
80-
Write-Host "Press [ENTER] to continue."
71+
$userPrincipalName = Read-Host "Please enter user principal name e.g. [email protected]"
72+
$resourceGroupName = Read-Host "Please enter resource group name e.g. rg-devbox-dev"
73+
$location = Read-Host "Please enter region name e.g. eastus"
74+
$templateUri = "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/quickstarts/microsoft.devcenter/devbox-with-customized-image/azuredeploy.json"
75+
$userPrincipalId=(Get-AzADUser -UserPrincipalName $userPrincipalName).Id
76+
if($userPrincipalId){
77+
Write-Host "Start provisioning..."
78+
az group create -l $location -n $resourceGroupName
79+
az group deployment create -g $resourceGroupName --template-uri $templateUri --parameters userPrincipalId=$userPrincipalId
80+
}else {
81+
Write-Host "User Principal Name cannot be found."
82+
}
83+
84+
Write-Host "Provisioning Completed."
85+
8186
```
8287

8388
Wait until you see the prompt from the console.
@@ -86,25 +91,17 @@ For example, you can use a template to [add other customized images for Base, Ja
8691
3. Right-click the shell console pane and then select **Paste**.
8792
4. Enter the values.
8893

89-
It takes about 10 minutes to deploy the template. When completed, the output is similar to:
90-
91-
:::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.":::
94+
It takes about 30 minutes to deploy the template.
9295

9396
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-resource-manager/templates/deploy-portal.md).
9497

95-
#### Depending on your configuration, you might want to change the following parameters:
96-
97-
- *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.
98+
#### When deploying this template, you're prompted to provide the following parameters:
9899

99-
- *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.
100+
- *User Principal Id*: The user principal ID of the user or group that will be granted the *Devcenter Dev Box User* role.
101+
- *User Principal Type*: The type of user principal. Valid values are *User* or *Group*.
102+
- *Location*: The location where the resources will be deployed. Choose a location close to the users who will be using the dev boxes to reduce latency.
100103

101-
- *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.
102-
- **User:** You can find the principal ID listed as the object ID on the user Overview page.
103-
:::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.":::
104-
- **Group:** You can find the principal ID listed as the object ID on the group Overview page.
105-
:::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.":::
106-
107-
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)
104+
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).
108105

109106
## Review deployed resources
110107

@@ -113,8 +110,6 @@ Alternatively, you can provide access to a dev box project in the Azure portal,
113110
3. Select the resource group that you created in the previous section.
114111

115112
:::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.":::
116-
117-
1. Select the Dev Center. Its default name is dc-*resource-token*.
118113

119114
## Clean up resources
120115

0 commit comments

Comments
 (0)