Breyta

Deila með


Configure dev center imaging

Using a customization file simplifies the creation of dev boxes for your team. With dev box customizations, you can create a shared team customization by creating a file called an image definition. You can then create a reusable image from this image definition to optimize customizations and save time during dev box creation.

Images are automatically built by default for catalogs containing image definitions whenever a new image definition is detected or an existing one is updated. While automatic builds help prevent stale configurations and improve dev box reliability, they incur costs through dev box meters during runtime. During the image build process, a dev box is created to run your customization file and generate an image, which incurs costs based on the compute resources and time required to build the image. You can disable automatic image builds during catalog creation or afterward via catalog settings.

In this article, you learn how to configure dev center imaging for your development teams.

Prerequisites

To complete the steps in this article, you need:

Permissions required to configure customizations

To perform the required actions for creating and applying customizations to a dev box, you need the following permissions:

Action Permission/Role
Enable project-level catalogs for a dev center. Platform engineer with write access on the subscription.
Enable catalog sync settings for a project. Platform engineer with write access on the subscription.
Attach a catalog to a project. Project Admin or Contributor permissions on the project.
Add tasks to a catalog. Permission to add to the repository that hosts the catalog.

To manage a dev box pool, you need the following permissions:

Action Permission
Create, delete, or update a dev box pool. - Owner or Contributor permissions on an Azure subscription or a specific resource group.
- DevCenter Project Admin permissions for the project.

Enable project-level catalogs

To attach a catalog to a project, you must enable project-level catalogs. For more information, see Add and manage catalogs in Microsoft Dev Box.

Configure catalog sync settings for the project

  1. Sign in to the Azure portal.

  2. In the search box, enter projects. In the list of results, select Projects.

  3. Open the Dev Box project for which you want to configure catalog sync settings.

  4. Select Catalogs.

  5. Select Sync settings.

    Screenshot of the Catalogs pane in the Azure portal, with the button for sync settings highlighted.

  6. On the Sync settings pane, select Image definitions, then select Save.

    Screenshot of the pane for sync settings in the Azure portal, with the checkbox for image definitions highlighted.

Attach a catalog that contains the definition file

Before you can use a customization file as an image definition, attach a catalog that contains the definition file to your project. The catalog can be from GitHub or Azure Repos. For more information, see Add and configure a catalog from GitHub or Azure Repos.

Note

Image definitions are only supported at the project level. You must attach catalogs containing image definitions to a project, not to a dev center.

The Image definitions pane lists the image definitions that your project can access.

Screenshot of the Azure portal pane that lists accessible image definitions for a project.

Build a reusable image

You can build a reusable image from an image definition to optimize performance and enhance reliability. The built image applies to all dev boxes created from the pool. The DevCenter service creates a dev box behind the scenes, applies your customizations from the image definition, and exports the resulting image to an Azure Compute Gallery in a managed resource group.

There are two ways to build images: automatic or manual. By default, images are automatically built whenever a new image definition is detected or an existing image definition is updated. This feature helps prevent stale configurations and improves dev box reliability. To control when images are built, you can disable automatic image builds and manually trigger builds.

Note

Image builds incur costs through dev box meters during runtime when customizations are applied.

Select the tabs below to learn how to configure automatic and manual image builds.

Configure automatic image builds for existing catalogs

  1. Sign in to the Azure portal.

  2. In the search box, enter projects. In the list of results, select Projects.

  3. Open the project that contains the catalog you want to configure.

  4. On the left menu, select Catalogs.

  5. From the list of catalogs, select the catalog that contains image definitions.

  6. On the catalog details page, enable or disable the use of automatic image builds by using the Automatically build an image checkbox.
    We recommend enabling auto-builds to take advantage of the reliability and performance improvements Dev Center imaging provides.

  7. Select Save to apply your changes. The auto-build capability flattens customizations into a reusable image that dramatically enhances dev box creation performance and reliability.

    Screenshot showing the automatically build an image option in catalog settings.

When automatic image builds are disabled, you must manually trigger image builds when you want to create or update reusable images from your image definitions.

During the image build process, Dev Box creates a temporary storage account in your subscription to store a snapshot. This storage account doesn't allow anonymous blob access and can only be accessed by identities with Storage Blob Reader access. The storage account must be accessible from public networks so the Dev Box service can export your snapshot. If you have Azure policies that block the creation of storage accounts with public network access, create an exception for the subscription that your DevCenter project is in.

Important

When an image is built from an image definition, a dev box is created to apply all the customizations and generate an image. By default, if no custom network is configured at the image definition level, the dev box is connected to a virtual network that Microsoft manages. Use the network configuration property in image definitions for tasks that need access to on-premises or private resources to ensure that image generation is successful.

Configure a dev box pool to use an image definition

To make customizations available to your development teams, configure a dev box pool to use an image definition. Store the customization file (imagedefinition.yaml) in a repository linked to a catalog in your project. When you specify the image definition for the pool, the customizations are applied to new dev boxes.

Create a dev box pool

In Microsoft Dev Box, a dev box pool is a collection of dev boxes that you manage together. You must have at least one dev box pool before users can create a dev box.

The following steps show you how to create a dev box pool in a project.

If you don't have an available dev center and project, follow the steps in Quickstart: Configure Microsoft Dev Box to create them.

  1. Sign in to the Azure portal.

  2. In the search box, enter projects. In the list of results, select Projects.

  3. Open the project where you want to create the dev box pool.

    Screenshot that shows the list of existing projects.

  4. Select Dev box pools, then select Create.

    Screenshot of an empty list of dev box pools within a project, along with selections to start creating a pool.

  5. On the Create a dev box pool pane, on the Basics tab, enter the following values:

    Setting Value
    Name Enter a name for the pool. The pool name is visible to developers to select when they're creating dev boxes. The name must be unique within a project.
    Definition Select an Image definition.
    Compute Select the virtual machine size for the dev boxes in this pool.
    Storage Select the storage size for the dev boxes in this pool.
    Hibernation Shows whether hibernation is supported or not.
    Region
    Network connection 1. Select Deploy to a Microsoft hosted network.
    2. Select your desired deployment region for the dev boxes. Choose a region close to your expected dev box users for the optimal user experience.
    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.

    Screenshot of the Basics pane for creating a dev box pool.

  6. Select Create.

Hibernation support for dev boxes

Dev Box supports hibernation when both these conditions are met:

  • The source image defined in the image definition supports hibernation.
  • The compute resources of the dev box pool support hibernation.

If either the image or the pool doesn't support hibernation, the feature isn't available for dev boxes in that pool. If hibernation isn't supported, verify that the base image specified in your image definition is created with hibernation support and that the pool uses that image definition.

For more information about Dev Box support for hibernation, see Configure hibernation in Microsoft Dev Box.

Create a dev box by using the developer portal

To verify that customizations are applied correctly, 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, then connect to the newly created dev box and verify that the customizations work as expected.

You can make adjustments to the image definition and create a new dev box to test the changes. When the customizations are correct, you can build a reusable image from the image definition.