|
| 1 | +--- |
| 2 | +title: Configure an Azure Compute Gallery |
| 3 | +titleSuffix: Microsoft Dev Box |
| 4 | +description: 'Learn how to create a repository for managing and sharing Dev Box images.' |
| 5 | +services: dev-box |
| 6 | +ms.service: dev-box |
| 7 | +author: RoseHJM |
| 8 | +ms.author: rosemalcolm |
| 9 | +ms.date: 07/28/2022 |
| 10 | +ms.topic: how-to |
| 11 | +--- |
| 12 | + |
| 13 | +# Configure an Azure Compute Gallery |
| 14 | + |
| 15 | + An Azure Compute Gallery is a repository in Azure for managing and sharing images. It's stored in your Azure subscription and helps you build structure and organization around your image resources. You can use Azure Compute Gallery to provide custom images for your dev box users. |
| 16 | + |
| 17 | +Advantages of using a gallery include: |
| 18 | +- You maintain the images in a single location and use them across dev centers, projects, and pools. |
| 19 | +- Development teams can use the *latest* image version of an image definition to ensure they always receive the most recent image when creating dev boxes. |
| 20 | +- Development teams can use a specific image version to standardize on a supported image version until a newer version is validated. |
| 21 | + |
| 22 | + |
| 23 | +You can learn more about Azure Compute Galleries and how to create them here: |
| 24 | +- [Store and share images in an Azure Compute Gallery](../virtual-machines/shared-image-galleries.md) |
| 25 | +- [Create a gallery for storing and sharing resources](../virtual-machines/create-gallery.md#create-a-gallery-for-storing-and-sharing-resources) |
| 26 | + |
| 27 | +## Pre-requisites |
| 28 | +- A dev center. If don't have an available dev center, follow these steps: [Create a dev center](./quickstart-configure-dev-box-service.md#create-a-dev-center). |
| 29 | +- An Azure Compute Gallery. In order to use this gallery to configure Dev Box definitions, it must have at least [one image definition and one image version](../virtual-machines/image-version.md). |
| 30 | + - The image definition must have [Trusted Launch enabled as the Security Type](../virtual-machines/trusted-launch.md). You configure the security type when creating the image definition. |
| 31 | + - The image version must meet the [Windows 365 image requirements](/windows-365/enterprise/device-images#image-requirements). |
| 32 | + - Generation 2 |
| 33 | + - Hyper-V v2 |
| 34 | + - Windows OS |
| 35 | + - Generalized image |
| 36 | + |
| 37 | + :::image type="content" source="media/how-to-configure-azure-compute-gallery/image-definition.png" alt-text="Screenshot showing the Windows 365 image requirement settings."::: |
| 38 | + |
| 39 | +> [!IMPORTANT] |
| 40 | +> If you have existing images that do not meet the Windows 365 image requirements, those images will not be listed for image creation. |
| 41 | +
|
| 42 | +## Provide permissions for services to access the gallery |
| 43 | +When using an Azure Compute Gallery image to create a dev box definition, the Windows 365 service validates the image to ensure that it meets the requirements to be provisioned for a dev box. In addition, the Dev Box service replicates the image to the regions specified in the attached network connections so the images are present in the region required for dev box creation. |
| 44 | + |
| 45 | +To allow the services to perform these actions, you must provide permissions to your gallery as follows: |
| 46 | + |
| 47 | +### Add a user assigned identity to dev center |
| 48 | +1. Use these steps to [Create a user-assigned managed identity](/azure/active-directory/managed-identities-azure-resources/how-manage-user-assigned-managed-identities?pivots=identity-mi-methods-azp#create-a-user-assigned-managed-identity). |
| 49 | +1. Sign in to the [Azure portal](https://portal.azure.com). |
| 50 | +1. In the search box, type *Dev box* and select **Dev centers** from the list. |
| 51 | +1. Open your DevCenter and select **Identity** from the left menu. |
| 52 | +1. On the **User assigned** tab, select **+ Add**. |
| 53 | +1. In Add user assigned managed identity, select the user-assigned managed identity that you created in step 1 and then select **Add**. |
| 54 | + |
| 55 | + :::image type="content" source="media/how-to-configure-azure-compute-gallery/assign-managed-id.png" alt-text="Screenshot showing the Add user assigned managed identity pane, with the managed ID highlighted."::: |
| 56 | + |
| 57 | +### How does the Dev Box service assign permissions? |
| 58 | +The Dev Box service behaves differently depending how you attach your gallery. |
| 59 | +- When you use the Azure portal to attach the gallery to your Dev center, the Dev Box service creates the necessary role assignments automatically when you attach the gallery. |
| 60 | +- When you use the CLI to attach the gallery to your Dev center, you must manually create the Windows 365 Service Principal and dev center Managed Identity role assignments before attempting to attach the gallery. |
| 61 | + |
| 62 | +Follow these steps to manually assign each role: |
| 63 | + |
| 64 | +#### Windows 365 Service Principal |
| 65 | +1. Sign in to the [Azure portal](https://portal.azure.com). |
| 66 | + |
| 67 | +1. In the search box, type *Azure Compute Gallery* and select the gallery you want to attach to the dev center. |
| 68 | + |
| 69 | +1. Select the **Access Control (IAM)** menu item. |
| 70 | + |
| 71 | +1. Select **+ Add** > **Add role assignment**. |
| 72 | + |
| 73 | +1. On the Role tab, select **Reader**, and then select **Next**. |
| 74 | + |
| 75 | +1. On the Members tab, select **+ Select Members**. |
| 76 | + |
| 77 | +1. In Select members, search for and select **Cloud PC**, and then select **Select**. |
| 78 | + |
| 79 | +1. On the Members tab, select **Next**. |
| 80 | + |
| 81 | +1. On the Review + assign tab, select **Review + assign**. |
| 82 | + |
| 83 | +#### Dev center Managed Identity |
| 84 | +1. Open the gallery you want to attach to the dev center from the [Azure portal](https://ms.portal.azure.com/#blade/HubsExtension/BrowseResource/resourceType/Microsoft.Compute%2Fgalleries). You can also search for Azure Compute Galleries to find your gallery. |
| 85 | + |
| 86 | +1. Select **Access Control (IAM)** from the left menu. |
| 87 | + |
| 88 | +1. Select **+ Add** > **Add role assignment**. |
| 89 | + |
| 90 | +1. On the Role tab, select the **Owner** role, and then select **Next**. |
| 91 | + |
| 92 | +1. On the Members tab, under **Assign access to**, select **Managed Identity**, and then select **+ Select Members**. |
| 93 | + |
| 94 | +1. In Select managed identities, search for and select the user assigned managed identity you created in "Create a Dev center Managed Identity" and then select |
| 95 | +**Select**. |
| 96 | + |
| 97 | +1. On the Members tab, select **Next**. |
| 98 | + |
| 99 | +1. On the Review + assign tab, select **Review + assign**. |
| 100 | + |
| 101 | +You can use the same managed identity in multiple DevCenters and Azure Compute Galleries. Any DevCenter with the managed identity added will have the necessary permissions to the images in the Azure Compute Gallery you've added the owner role assignment to. |
| 102 | + |
| 103 | +## Attach a gallery to a dev center |
| 104 | +In order to use the images from a gallery in dev box definitions, you must first associate it with the dev center. |
| 105 | + |
| 106 | +1. Sign in to the [Azure portal](https://portal.azure.com). |
| 107 | + |
| 108 | +2. In the search box, type *Dev box* and select **Dev centers** from the list. |
| 109 | + |
| 110 | +3. Select the dev center you want to attach the gallery to. |
| 111 | + |
| 112 | +:::image type="content" source="media/how-to-configure-azure-compute-gallery/devcenter-grid.png" alt-text="Screenshot showing the list of existing dev centers."::: |
| 113 | + |
| 114 | +4. From the left menu, select **Azure compute galleries** to list the galleries attached to this dev center. |
| 115 | + |
| 116 | +:::image type="content" source="media/how-to-configure-azure-compute-gallery/gallery-grid-empty.png" alt-text="Screenshot showing the Azure compute galleries page. There are no existing Azure compute galleries."::: |
| 117 | + |
| 118 | +5. Select **+ Add** to select a gallery to attach. |
| 119 | + |
| 120 | +6. In Add Azure compute gallery, select your gallery. If you have access to more than one gallery with the same name, the subscription name is shown in parentheses. |
| 121 | + |
| 122 | +:::image type="content" source="media/how-to-configure-azure-compute-gallery/gallery-add.png" alt-text="Screenshot showing the Select a Gallery to add option."::: |
| 123 | + |
| 124 | +7. If there's a name conflict in the dev center, then you must provide a unique name to use for this gallery. |
| 125 | + |
| 126 | +8. Select **Add**. |
| 127 | + |
| 128 | +:::image type="content" source="media/how-to-configure-azure-compute-gallery/gallery-grid.png" alt-text="Screenshot showing the Azure compute galleries page with example galleries listed."::: |
| 129 | + |
| 130 | +After successful addition, the images in the gallery will be available to select from when creating and updating dev box definitions. |
| 131 | + |
| 132 | +## Remove a gallery from a dev center |
| 133 | +You can detach galleries from dev centers so that their images can no longer be used to create dev box definitions in the dev center. Galleries that are being actively used in dev box definitions cannot be removed from the dev center. The associated dev box definition must be deleted or updated to use an image from a different gallery before you can remove the gallery. |
| 134 | + |
| 135 | +1. Sign in to the [Azure portal](https://portal.azure.com). |
| 136 | + |
| 137 | +2. In the search box, type *Dev box* and select **Dev centers** from the list. |
| 138 | + |
| 139 | +3. Select the dev center you want to remove the gallery from. |
| 140 | + |
| 141 | +4. From the left menu, select **Azure compute galleries** to list the galleries attached to this dev center. |
| 142 | + |
| 143 | +5. Select the gallery you want to remove, and then select **Remove**. |
| 144 | + |
| 145 | + :::image type="content" source="media/how-to-configure-azure-compute-gallery/remove-gallery-from-devcenter.png" alt-text="Screenshot showing the Azure compute galleries page with a gallery selected and the Remove button highlighted."::: |
| 146 | + |
| 147 | +6. Select **Continue** from the confirmation dialog. |
| 148 | + |
| 149 | +The gallery will be detached from the dev center. The gallery and its images won't be deleted, and you can reattach it if necessary. |
| 150 | + |
| 151 | +## Next steps |
| 152 | +Learn more about Microsoft Dev Box: |
| 153 | +- [Microsoft Dev Box key concepts](./concept-dev-box-concepts.md) |
0 commit comments