Skip to content

Commit a7959bf

Browse files
authored
Merge pull request #304505 from RoseHJM/dtl-image-factory-deprecation
DTL - Image Factory -> Image Builder note
2 parents 7eea1f9 + d9681e0 commit a7959bf

File tree

5 files changed

+43
-22
lines changed

5 files changed

+43
-22
lines changed

articles/devtest-labs/image-factory-create.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ ms.custom: UpdateFrequency2
1111
# Create a custom image factory in Azure DevTest Labs
1212
This article shows you how to set up a custom image factory by using sample scripts available in the [Git repository](https://github.com/Azure/azure-devtestlab/tree/master/samples/DevTestLabs/Scripts/ImageFactory).
1313

14+
[!INCLUDE [direct-azure-image-builder](includes/direct-azure-image-builder.md)]
15+
1416
## What's an image factory?
1517
An image factory is a configuration-as-code solution that builds and distributes images automatically regularly with all the desired configurations. The images in the image factory are always up to date, and the ongoing maintenance is almost zero once the whole process is automated. And, because all the required configurations are already in the image, it saves the time from manually configuring the system after a VM has been created with the base OS.
1618

@@ -38,7 +40,7 @@ Using the DevTest Labs extension is an easy way to get started with automaticall
3840

3941
There's an alternate implementation using PowerShell script for a more complex scenario. Using PowerShell, you can fully automate an image factory based on DevTest Labs that can be used in your Continuous Integration and Continuous Delivery (CI/CD) toolchain. The principles followed in this alternate solution are:
4042

41-
- Common updates should require no changes to the image factory. (for example, adding a new type of custom image, automatically retiring old images, adding a new endpoint DevTest Labs to receive custom images, and so on.)
43+
- Common updates should require no changes to the image factory. (for example, adding a new type of custom image, automatically retiring old images, adding a new 'endpoint' DevTest Labs to receive custom images, and so on.)
4244
- Common changes are backed by source code control (infrastructure as code)
4345
- DevTest Labs receiving custom images may not be in the same Azure Subscription (labs span subscriptions)
4446
- PowerShell scripts must be reusable so you can spin up more factories as needed

articles/devtest-labs/image-factory-save-distribute-custom-images.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ ms.custom: UpdateFrequency2
1111
# Save custom images and distribute to multiple labs
1212
This article gives you the steps to save custom images from the already created virtual machines (VMs). It also covers how to distribute these custom images to other DevTest Labs in the organization.
1313

14+
[!INCLUDE [direct-azure-image-builder](includes/direct-azure-image-builder.md)]
15+
1416
## Prerequisites
1517
The following items should already be in place:
1618

articles/devtest-labs/image-factory-set-retention-policy-cleanup.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ ms.custom: UpdateFrequency2
1212

1313
# Set up an image retention policy in Azure DevTest Labs
1414

15-
This article covers setting an image retention policy, cleaning up an image factory, and retiring old images from all the DevTest labs in an organization.
15+
This article covers setting an image retention policy, cleaning up an image factory, and retiring old images from all the DevTest Labs in an organization.
16+
17+
[!INCLUDE [direct-azure-image-builder](includes/direct-azure-image-builder.md)]
1618

1719
## Prerequisites
1820

@@ -53,14 +55,14 @@ The script parameters are:
5355

5456
## Queue the build
5557

56-
After you complete the build definition, queue up a new build to make sure everything is working. After the build completes successfully, the new custom images show up in the destination lab. If you check the image factory lab, you see no provisioned VMs. If you queue up further builds, you see the cleanup tasks retiring old custom images from the DevTest labs. The retirement proceeds according to the retention value set in the build variables.
58+
After you complete the build definition, queue up a new build to make sure everything is working. After the build completes successfully, the new custom images show up in the destination lab. If you check the image factory lab, you see no provisioned VMs. If you queue up further builds, you see the cleanup tasks retiring old custom images from the DevTest Labs. The retirement proceeds according to the retention value set in the build variables.
5759

5860
> [!NOTE]
5961
> If you ran the build pipeline at the end of the previous article in this series, manually delete the virtual machines that you created in the image factory lab before queuing a new build. You only need the manual cleanup step when you set everything up and verify that it works.
6062
6163
## Summary
6264

63-
You now have a running image factory that can generate custom images and distribute them to your labs on demand. At this point, it's just a matter of getting your images set up properly and identifying the target labs. As mentioned in the previous article, the *Labs.json* file located in your *Configuration* folder specifies which images should be made available in each of the target labs. As you add other DevTest labs to your organization, you simply need to add an entry in *Labs.json* for the new lab.
65+
You now have a running image factory that can generate custom images and distribute them to your labs on demand. At this point, it's just a matter of getting your images set up properly and identifying the target labs. As mentioned in the previous article, the *Labs.json* file located in your *Configuration* folder specifies which images should be made available in each of the target labs. As you add other DevTest Labs to your organization, you simply need to add an entry in *Labs.json* for the new lab.
6466

6567
Adding a new image to your factory is also easy. When you want to include a new image in your factory, go to your factory lab in the Azure portal. Select the button to add a VM, and then choose the marketplace image and artifacts that you want. Instead of selecting the **Create** button to create the new VM, select **View Azure Resource Manager template**. Save the template as a .json file somewhere in the *GoldenImages* folder in your repository. The next time you run your image factory, it will create your custom image.
6668

articles/devtest-labs/image-factory-set-up-devops-lab.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@ ms.custom: UpdateFrequency2
1111
# Run an image factory from Azure DevOps
1212
This article covers all the preparations needed to run the image factory from Azure DevOps (formerly Visual Studio Team Services).
1313

14-
> [!NOTE]
14+
> [!TIP]
1515
> Any orchestration engine will work! Azure DevOps is not mandatory. The image factory is run using Azure PowerShell scripts, so it could be run manually, by using Windows Task Scheduler, other CI/CD systems, and so on.
1616
17+
[!INCLUDE [direct-azure-image-builder](includes/direct-azure-image-builder.md)]
18+
1719
## Create a lab for the image factory
18-
The first step in setting up the image factory is to create a lab in Azure DevTest Labs. This lab is the image factory lab where we create the virtual machines and save custom images. This lab is considered as part of the overall image factory process. Once you create a lab, make sure to save the name since youll need it later.
20+
The first step in setting up the image factory is to create a lab in Azure DevTest Labs. This lab is the image factory lab where we create the virtual machines and save custom images. This lab is considered as part of the overall image factory process. Once you create a lab, make sure to save the name since you'll need it later.
1921

2022
## Scripts and templates
21-
The next step in adopting the image factory for your team is to understand whats available. The image factory scripts and templates are available publicly in the [DevTest Labs GitHub Repo](https://github.com/Azure/azure-devtestlab/tree/master/samples/DevTestLabs/Scripts/ImageFactory). Here is an outline of the pieces:
23+
The next step in adopting the image factory for your team is to understand what's available. The image factory scripts and templates are available publicly in the [DevTest Labs GitHub Repo](https://github.com/Azure/azure-devtestlab/tree/master/samples/DevTestLabs/Scripts/ImageFactory). Here is an outline of the pieces:
2224

2325
- Image Factory. It's the root folder.
2426
- Configuration. The inputs to the image factory
@@ -29,14 +31,14 @@ The next step in adopting the image factory for your team is to understand what
2931
The articles in this section provide more details about these scripts and templates.
3032

3133
## Create an Azure DevOps team project
32-
Azure DevOps let you store the source code, run the Azure PowerShell in one place. You can schedule recurring runs to keep images up to date. There are good facilities for logging the results to diagnose any issues. Using Azure DevOps isnt a requirement however, you can use any harness/engine that can connect to Azure and can run Azure PowerShell.
34+
Azure DevOps lets you store the source code, run the Azure PowerShell in one place. You can schedule recurring runs to keep images up to date. There are good facilities for logging the results to diagnose any issues. Using Azure DevOps isn't a requirement however, you can use any harness/engine that can connect to Azure and can run Azure PowerShell.
3335

3436
If you have an existing DevOps account or project you would like to use instead, skip this step.
3537

36-
To get started, create a free account in Azure DevOps. Visit https://www.visualstudio.com/ and select **Get started for free** right under **Azure DevOps** (formerly VSTS). Youll need to choose a unique account name and make sure to choose to manage code using Git. Once you create the account, save the URL to your team project. Here is a sample URL: `https://<accountname>.visualstudio.com/MyFirstProject`.
38+
To get started, create a free account in Azure DevOps. Visit https://www.visualstudio.com/ and select **Get started for free** right under **Azure DevOps** (formerly VSTS). You'll need to choose a unique account name and make sure to choose to manage code using Git. Once you create the account, save the URL to your team project. Here is a sample URL: `https://<accountname>.visualstudio.com/MyFirstProject`.
3739

3840
## Check in the image factory to Git
39-
All the PowerShell, templates and configuration for the image factory are located in the [public DevTest Labs GitHub repo](https://github.com/Azure/azure-devtestlab/tree/master/samples/DevTestLabs/Scripts/ImageFactory). The fastest way to get the code into your new team project is to import a repository. Importing pulls in the whole DevTest Labs repository (so youll get extra docs, and samples).
41+
All the PowerShell, templates and configuration for the image factory are located in the [public DevTest Labs GitHub repo](https://github.com/Azure/azure-devtestlab/tree/master/samples/DevTestLabs/Scripts/ImageFactory). The fastest way to get the code into your new team project is to import a repository. Importing pulls in the whole DevTest Labs repository (so you'll get extra docs, and samples).
4042

4143
1. Visit the Azure DevOps project that you created in the previous step (URL looks like **https:\//\<accountname>.visualstudio.com/MyFirstProject**).
4244
2. Select **Import a Repository**.
@@ -45,13 +47,13 @@ All the PowerShell, templates and configuration for the image factory are locate
4547

4648
![Screenshot that shows Import Git repo.](./media/set-up-devops-lab/import-git-repo.png)
4749

48-
If you decide to only check in exactly whats needed (the image factory files), follow the steps [here](https://www.visualstudio.com/en-us/docs/git/share-your-code-in-git-vs) to clone the Git repo and push only the files located in the **scripts/ImageFactory** directory.
50+
If you decide to only check in exactly what's needed (the image factory files), follow the steps [here](https://www.visualstudio.com/docs/git/share-your-code-in-git-vs) to clone the Git repo and push only the files located in the **scripts/ImageFactory** directory.
4951

5052
## Create a build and connect to Azure
5153
At this point, you have the source files stored in a Git repo in Azure DevOps. Now, you need to set up a pipeline to run the Azure PowerShell. There are lots of options to do these steps. In this article, you use build definition for simplicity, but it works with DevOps Build, DevOps Release (single or multiple environments), other execution engines like Windows Task Scheduler or any other harness that can execute Azure PowerShell.
5254

5355
> [!NOTE]
54-
> One important point to keep in mind that some of the PowerShell files take a long time to run when there are a lot (10+) custom images to create. Free hosted DevOps Build/Release agents have a timeout of 30 min, so you cant use the free hosted agent once you start building many images. This timeout challenge applies to whatever harness you decide to use, its good to verify up front that you can extend the typical timeouts for long running Azure PowerShell scripts. In the case of Azure DevOps, you can either use paid hosted Agents or use your own build agent.
56+
> One important point to keep in mind that some of the PowerShell files take a long time to run when there are a lot (10+) custom images to create. Free hosted DevOps Build/Release agents have a timeout of 30 min, so you can't use the free hosted agent once you start building many images. This timeout challenge applies to whatever harness you decide to use, it's good to verify up front that you can extend the typical timeouts for long running Azure PowerShell scripts. In the case of Azure DevOps, you can either use paid hosted Agents or use your own build agent.
5557
5658
1. To start, select **Set up Build** on the homepage of your DevOps Project:
5759

@@ -64,24 +66,24 @@ At this point, you have the source files stored in a Git repo in Azure DevOps. N
6466
![Screenshot that shows Build definition.](./media/set-up-devops-lab/build-definition.png)
6567

6668
## Configure the build variables
67-
To simplify the command-line parameters, encapsulate the key values that drive the image factory to a set of build variables. Select the **Variables** tab and youll see a list of several default variables. Heres the list of variables to enter in to Azure DevOps:
69+
To simplify the command-line parameters, encapsulate the key values that drive the image factory to a set of build variables. Select the **Variables** tab and you'll see a list of several default variables. Here's the list of variables to enter in to Azure DevOps:
6870

6971

70-
| Variable Name | Value | Notes |
72+
| Variable Name | Value | Notes |
7173
| ------------- | ----- | ----- |
7274
| ConfigurationLocation | /Scripts/ImageFactory/Configuration | This location is the full path in the repository to the **Configuration** folder. If you imported the whole repo above, the value to the left is correct. Otherwise update to point to the Configuration location. |
73-
| DevTestLabName | MyImageFactory | The name of the lab in Azure DevTest Labs used as the factory to produce images. If you dont have one, create one. Make sure that the Lab is in the same subscription that the service endpoint has access to. |
75+
| DevTestLabName | MyImageFactory | The name of the lab in Azure DevTest Labs used as the factory to produce images. If you don't have one, create one. Make sure that the Lab is in the same subscription that the service endpoint has access to. |
7476
| ImageRetention | 1 | The number of images you want to save of each type. Set default value to 1. |
75-
| MachinePassword | ******* | The built-in admin account password for the virtual machines. This account is transient, so make sure that its secure. Select the little lock icon on the right to ensure its a secure string. |
77+
| MachinePassword | ******* | The built-in admin account password for the virtual machines. This account is transient, so make sure that it's secure. Select the little lock icon on the right to ensure it's a secure string. |
7678
| MachineUserName | ImageFactoryUser | The built-in admin account username for the virtual machines. This account is transient. |
7779
| StandardTimeoutMinutes | 30 | The timeout we should wait for regular Azure operations. |
78-
| SubscriptionId | 0000000000-0000-0000-0000-0000000000000 | The ID of the subscription where the lab exists and that the service endpoint has access to. |
80+
| SubscriptionId | 0000000000-0000-0000-0000-0000000000000 | The ID of the subscription where the lab exists and that the service endpoint has access to. |
7981
| VMSize | Standard_A3 | The size of the virtual machine to use for the **Create** step. The VMs created are transient. The size must be the one that's [enabled for the lab](devtest-lab-set-lab-policy.md). Confirm that there's enough [subscription cores quota](../azure-resource-manager/management/azure-subscription-service-limits.md).
8082

8183
![Screenshot that shows Build variables.](./media/set-up-devops-lab/configure-build-variables.png)
8284

8385
## Connect to Azure
84-
The next step is to set up a service principal. A service principal is an identity in Microsoft Entra ID that enables the DevOps build agent to operate in Azure on the users behalf. To set it up, start with adding you first Azure PowerShell Build Step.
86+
The next step is to set up a service principal. A service principal is an identity in Microsoft Entra ID that enables the DevOps build agent to operate in Azure on the user's behalf. To set it up, start with adding you first Azure PowerShell Build Step.
8587

8688
1. Select **Add Task**.
8789
2. Search for **Azure PowerShell**.
@@ -95,10 +97,10 @@ The fastest way to set up a service principal is to let Azure DevOps do it for y
9597
2. For **Azure Connection Type**, choose **Azure Resource Manager**.
9698
3. Select the **Manage** link to set up the service principal.
9799

98-
For more information, see this [blog post](https://devblogs.microsoft.com/devops/automating-azure-resource-group-deployment-using-a-service-principal-in-visual-studio-online-buildrelease-management/). When you select the **Manage** link, youll land in the right place in DevOps (second screenshot in the blog post) to set up the connection to Azure. Make sure to choose **Azure Resource Manager Service Endpoint** when setting up the connection.
100+
For more information, see this [blog post](https://devblogs.microsoft.com/devops/automating-azure-resource-group-deployment-using-a-service-principal-in-visual-studio-online-buildrelease-management/). When you select the **Manage** link, you'll land in the right place in DevOps (second screenshot in the blog post) to set up the connection to Azure. Make sure to choose **Azure Resource Manager Service Endpoint** when setting up the connection.
99101

100102
## Complete the build task
101-
If you select the build task, youll see all the details on the right pane that should be filled in.
103+
If you select the build task, you'll see all the details on the right pane that should be filled in.
102104

103105
1. First, name the build task: **Create Virtual Machines**.
104106
2. Choose the **service principal** you created by choosing **Azure Resource Manager**
@@ -111,9 +113,9 @@ If you select the build task, you’ll see all the details on the right pane tha
111113

112114

113115
## Queue the build
114-
Lets verify that you have everything set up correctly by queuing up a new build. While the build is running, switch to the [Azure portal](https://portal.azure.com) and select on **All Virtual Machines** in your image factory lab to confirm that everything is working correctly. You should see three virtual machines get created in the lab.
116+
Let's verify that you have everything set up correctly by queuing up a new build. While the build is running, switch to the [Azure portal](https://portal.azure.com) and select on **All Virtual Machines** in your image factory lab to confirm that everything is working correctly. You should see three virtual machines get created in the lab.
115117

116-
![VMs in the lab](./media/set-up-devops-lab/vms-in-lab.png)
118+
![Screenshot showing VMs in the lab](./media/set-up-devops-lab/vms-in-lab.png)
117119

118120
## Next steps
119121
The first step in setting up the image factory based on Azure DevTest Labs is complete. In the next article in the series, you get those VMs generalized and saved to custom images. Then, you have them distributed to all your other labs. See the next article in the series: [Save custom images and distribute to multiple labs](image-factory-save-distribute-custom-images.md).
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
author: RoseHJM
3+
ms.author: rosemalcolm
4+
ms.date: 08/27/2025
5+
ms.topic: include
6+
ms.service: devtest-labs
7+
---
8+
9+
> [!NOTE]
10+
> Azure VM Image Builder is the recommended solution for building images. VM Image Builder is designed to streamline the process of creating standardized virtual machine images for use in Azure. It supersedes Image Factory.
11+
>
12+
> To learn more about Azure VM Image Builder, see [Azure VM Image Builder](/azure/virtual-machines/image-builder-overview?tabs=azure-powershell).
13+

0 commit comments

Comments
 (0)