Skip to content

Commit ee9ad32

Browse files
Merge pull request #299645 from MicrosoftDocs/main
Merged by Learn.Build PR Management system
2 parents 5a06fc3 + f7e540d commit ee9ad32

12 files changed

+407
-27
lines changed

articles/dev-box/how-to-write-image-definition-file.md

Lines changed: 94 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,18 @@ ms.date: 05/09/2025
1919

2020
[!INCLUDE [note-build-2025](includes/note-build-2025.md)]
2121

22-
2322
The Dev Box customizations feature helps you streamline the setup of cloud-based development environments. Getting developers started on a new project or team can be complex and time-consuming. Customizations let you configure ready-to-code workstations with applications, tools, repositories, code libraries, packages, and build scripts. This article guides you through the process of creating, testing, and editing an image definition file for your dev box using Visual Studio Code (VS Code).
2423

2524
There are two ways to use customizations in Microsoft Dev Box. Team customizations create a shared configuration for a team of developers. User customizations create a personal configuration for an individual developer. The following table summarizes the differences between the two types of customizations.
2625

27-
| Feature | Team customizations | User customizations |
28-
|-----------------------------|---------------------------|---------------------------------|
29-
| Configure on | Dev box pool | Dev box |
30-
| Customizations apply to | All dev boxes in pool | Individual dev box |
31-
| Easily shareable | Yes | No |
32-
| Customizations file name | Imagedefinition.yaml | myfilename.yaml or Workload.yaml |
33-
| Sourced from | Catalog | Uploaded or from personal repository |
34-
| Supports key vault secrets | Yes | Yes |
26+
| Feature | Team customizations | User customizations |
27+
|-----------------------------|---------------------------|--------------------------------------|
28+
| Configure on | Dev box pool | Dev box |
29+
| Customizations apply to | All dev boxes in pool | Individual dev box |
30+
| Easily shareable | Yes | No |
31+
| Customizations file name | Imagedefinition.yaml | myfilename.yaml or Workload.yaml |
32+
| Sourced from | Catalog | Uploaded or from personal repository |
33+
| Supports key vault secrets | Yes | Yes |
3534

3635

3736
## Prerequisites
@@ -55,15 +54,18 @@ To complete the steps in this article, you must:
5554
## Choose a source for customization tasks
5655
Dev Box tasks can be sourced from tasks built-in to the platform, or custom tasks stored in a catalog. Choose the source that best aligns with your customization needs and project requirements.
5756

58-
- **Use WinGet and PowerShell tasks**
59-
Dev Box dev centers support PowerShell and WinGet tasks out of the box. If your customizations require only PowerShell and WinGet, proceed with creating your customizations file: [Create an image definition file](#create-an-image-definition-file).
57+
- **Use WinGet and PowerShell built-in tasks**
58+
Dev Box dev centers support PowerShell and WinGet tasks out of the box; you can get started with these built-in tasks. If your customizations require only PowerShell and WinGet, proceed with creating your customizations file: [Create an image definition file](#create-an-image-definition-file).
59+
60+
The WinGet in-built task is not the WinGet executable. WinGet in-built task is based on the PowerShell WinGet CmdLet.
6061

6162
- **Use a catalog to define custom tasks**
62-
You can create your own custom tasks. To make custom tasks available to your entire organization, attach a catalog that contains custom task definitions to your dev center. Dev Box supports Azure Repos and GitHub catalogs.
63-
To learn more about defining custom tasks, see: [Create tasks for Dev Box team customizations](how-to-create-customization-tasks-catalog.md).
63+
You can create your own custom tasks. To make custom tasks available to your entire organization, attach a catalog that contains custom task definitions to your dev center. Dev Box supports Azure Repos and GitHub catalogs. Because tasks can only be defined at the dev center, you should store tasks and image definitions in separate repositories.
64+
65+
To learn more about defining custom tasks, see: [Create tasks for Dev Box team customizations](how-to-create-customization-tasks-catalog.md).
6466

6567
## Create image definitions at project level
66-
Using a project can help manage Dev Box resources efficiently. By assigning each developer team their own project, you can organize resources effectively. You can attach a catalog that stores image definitions to a project to target developer teams.
68+
Using a project can help manage Dev Box resources efficiently. By assigning each developer team their own project, you can organize resources effectively. You can create multiple image definitions in your catalog repository, each in their own folder to target different developer teams under your project.
6769

6870
### 1. Assign permissions for project admins.
6971
To attach a catalog to a project, you must have Project Admin or Contributor permission for the project.
@@ -81,7 +83,8 @@ To enable the use of project-level catalogs at the dev center level:
8183
For more information about adding catalogs to projects, see [Add and configure a catalog from GitHub or Azure Repos](../deployment-environments/how-to-configure-catalog.md).
8284

8385
## Create an image definition file
84-
You can create and manage image definition files by using VS Code. You can use the Microsoft Dev Box extension in VS Code to discover the tasks in the attached catalog and test the image definition file.
86+
You can create and test image definition files by using VS Code. In addition to using the built-in tasks, you can use the Microsoft Dev Box extension in VS Code to discover the custom tasks available through your dev center.
87+
8588
1. Create a dev box (or use an existing dev box) for testing.
8689
1. On the test dev box, install VS Code and then install the Dev Box extension.
8790
1. Download an example YAML image definition file from the samples repository and open it in VS Code.
@@ -95,12 +98,21 @@ You can create and manage image definition files by using VS Code. You can use t
9598

9699
1. The image definition file runs and applies the specified tasks to your test dev box. Inspect the changes and check the VS Code terminal for any errors or warnings generated during the task execution.
97100
1. When the image definition file runs successfully, upload it to your catalog.
101+
102+
### System Tasks and User Tasks
103+
104+
All tasks in the userTasks section run as the user after the user's first sign-in to the Dev Box. Tasks in the tasks section run as LocalSystem during the Dev Box provisioning stage. Both sections share the same parameters based on the task definitions in your catalog.
105+
106+
### When should I use Run-as-user Tasks?
107+
108+
Use run-as-user tasks to install software and packages under user context. For example, users often prefer to install Python and Visual Studio Code under user context instead of system-wide. Put WinGet tasks in the userTasks section for better results when they don't work under tasks.
109+
110+
## Optional: Customize your dev box by using existing Desired State Configuration files
111+
Desired State Configuration (DSC) is a management platform in PowerShell that enables you to manage your development environment with configuration as code. You can use DSC to define the desired state of your dev box, including software installations, configurations, and settings.
98112

99-
## Optional: Customize your dev box by using existing WinGet Configuration files
100-
WinGet configuration uses a config-as-code approach to define the software and settings needed to prepare your Windows environment for coding.
113+
You can also use DSC configuration files to set up a dev box, by using a built-in WinGet task.
101114

102-
You can also use these configuration files to set up a dev box, by using a WinGet task included in the Microsoft-provided quickstart catalog.
103-
The following example shows a dev box image definition file that calls an existing WinGet Desired State Configuration (DSC) file:
115+
The following example shows a dev box image definition file that calls an existing WinGet DSC file:
104116

105117
```yaml
106118
tasks:
@@ -111,9 +123,71 @@ tasks:
111123
112124
To learn more, see [WinGet configuration](https://aka.ms/winget-configuration).
113125
126+
## Configure catalog sync settings for the project
127+
128+
Configure your project to sync image definitions from the catalog. With this setting, you can use the image definitions in the catalog to create dev box pools.
129+
130+
1. Sign in to the [Azure portal](https://portal.azure.com).
131+
1. In the search box, enter **projects**. In the list of results, select **Projects**.
132+
1. Open the Dev Box project for which you want to configure catalog sync settings.
133+
1. Select **Catalogs**.
134+
1. Select **Sync settings**.
135+
136+
:::image type="content" source="./media/how-to-write-image-definition-file/customizations-project-sync-settings-small.png" alt-text="Screenshot of the Catalogs pane in the Azure portal, with the button for sync settings highlighted." lightbox="./media/how-to-write-image-definition-file/customizations-project-sync-settings.png":::
137+
138+
1. On the **Sync settings** pane, select **Image definitions**, and then select **Save**.
139+
140+
:::image type="content" source="./media/how-to-write-image-definition-file/customizations-project-sync-image-definitions.png" alt-text="Screenshot of the pane for sync settings in the Azure portal, with the checkbox for image definitions highlighted." lightbox="./media/how-to-write-image-definition-file/customizations-project-sync-image-definitions.png":::
141+
142+
## Attach a catalog that contains the definition file
143+
144+
Before you can use a customization file as an image definition, you must attach a catalog that contains the definition file to your dev center or project. The catalog can be from GitHub or Azure Repos.
145+
146+
The **Image definitions** pane lists the image definitions that your project can access.
147+
148+
:::image type="content" source="media/how-to-write-image-definition-file/team-customizations-image-definitions-small.png" alt-text="Screenshot of the Azure portal pane that lists accessible image definitions for a project." lightbox="media/how-to-write-image-definition-file/team-customizations-image-definitions.png":::
149+
150+
For more information about attaching catalogs, see [Add and configure a catalog from GitHub or Azure Repos](../deployment-environments/how-to-configure-catalog.md).
151+
152+
## Configure a dev box pool to use an image definition
153+
154+
Make customizations available to your development teams by configuring a dev box pool to use a customization file (imagedefinition.yaml). Store the customization file in a repository linked to a catalog in your dev center or project. Specify this file as the image definition for the pool, and the customizations are applied to new dev boxes.
155+
156+
The following steps show you how to create a dev box pool and specify an image definition:
157+
158+
1. Sign in to the [Azure portal](https://portal.azure.com).
159+
1. In the search box, enter **projects**. In the list of results, select **Projects**.
160+
1. Open the Dev Box project with which you want to associate the new dev box pool.
161+
1. Select **Dev box pools**, and then select **Create**.
162+
1. On the **Create a dev box pool** pane, enter the following values:
163+
164+
| Setting | Value |
165+
|---|---|
166+
| **Name** |Enter a name for the pool. The pool name is visible to developers to select when they're creating dev boxes. It must be unique within a project. |
167+
| **Definition** | This box lists image definitions from accessible catalogs and dev box definitions. Select an image definition file. |
168+
| **Network connection** | Select **Deploy to a Microsoft hosted network**, or use an existing network connection. |
169+
|**Enable single sign-on** | Select **Yes** to enable single sign-on for the dev boxes in this pool. Single sign-on must be configured for the organization. For more information, see [Enable single sign-on for dev boxes](https://aka.ms/dev-box/single-sign-on). |
170+
| **Dev box Creator Privileges** | Select **Local Administrator** or **Standard User**. |
171+
| **Enable Auto-stop** | **Yes** is the default. Select **No** to disable an autostop schedule. You can configure an autostop schedule after the pool is created. |
172+
| **Stop time** | Select a time to shut down all the dev boxes in the pool. |
173+
| **Time zone** | Select the time zone that the stop time is in. |
174+
| **Licensing** | Select this checkbox to confirm that your organization has Azure Hybrid Benefit licenses that you want to apply to the dev boxes in this pool. |
175+
176+
:::image type="content" source="./media/how-to-write-image-definition-file/pool-specify-image-definition.png" alt-text="Screenshot of the pane for creating a dev box pool." lightbox="./media/how-to-write-image-definition-file/pool-specify-image-definition.png":::
177+
178+
1. Select **Create**.
179+
1. Verify that the new dev box pool appears in the list. You might need to refresh the screen.
180+
181+
### Create a dev box by using the developer portal
182+
183+
To verify that customizations from the image definition file are applied, create a dev box in the Microsoft Dev Box developer portal. Follow the steps in [Quickstart: Create and connect to a dev box by using the Microsoft Dev Box developer portal](quickstart-create-dev-box.md). Then connect to the newly created dev box and verify that the customizations work as you expected.
184+
185+
You can make adjustments to the customization file and create a new dev box to test the changes. When you're happy that the customizations are correct, you can build a reusable image.
186+
187+
114188
## Next step
115189
116-
Now that you have created an image definition file, upload it to a catalog and attach the catalog to a project. The image definition file will be used to configure and create dev boxes for your development teams.
190+
Now that you have an image definition file, upload it to a catalog and attach the catalog to a project. The image definition file is used to configure and create dev boxes for your development teams.
117191
118192
> [!div class="nextstepaction"]
119193
> [Configure imaging for Dev Box team customizations](how-to-configure-customization-imaging.md)
18.6 KB
Loading
68.5 KB
Loading
49.5 KB
Loading
38 KB
Loading
97.5 KB
Loading
70.9 KB
Loading

0 commit comments

Comments
 (0)