You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/virtual-machines/linux/image-builder-devops-task.md
+33-31Lines changed: 33 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: In this article, you use an Azure DevOps task to inject build artif
4
4
author: kof-f
5
5
ms.author: kofiforson
6
6
ms.reviewer: cynthn
7
-
ms.date: 01/27/2021
7
+
ms.date: 04/11/2023
8
8
ms.topic: article
9
9
ms.service: virtual-machines
10
10
ms.subservice: image-builder
@@ -22,10 +22,9 @@ In this article, you learn how to use an Azure DevOps task to inject build artif
22
22
23
23
At this time, there are two Azure VM Image Builder DevOps tasks:
24
24
25
-
*[*Stable* VM Image Builder task](https://marketplace.visualstudio.com/items?itemName=AzureImageBuilder.devOps-task-for-azure-image-builder): The latest stable build that's been tested, and reports no [General Data Protection Regulation (GDPR)](https://www.microsoft.com/trust-center/privacy/gdpr-overview) issues.
25
+
*[*Stable* VM Image Builder task](https://marketplace.visualstudio.com/items?itemName=AzureImageBuilder.devOps-task-for-azure-image-builder): The latest stable build that's been tested, and reports no [General Data Protection Regulation (GDPR)](https://www.microsoft.com/trust-center/privacy/gdpr-overview) issues.
26
26
27
-
28
-
*[*Unstable* VM Image Builder task](https://marketplace.visualstudio.com/items?itemName=AzureImageBuilder.devOps-task-for-azure-image-builder-canary): We offer a so-called *unstable* task so that you can test the latest updates and features before we release the task code as *stable*. After about a week, if there are no customer-reported or telemetry issues, we promote the task code to *stable*.
27
+
*[*Unstable* VM Image Builder task](https://marketplace.visualstudio.com/items?itemName=AzureImageBuilder.devOps-task-for-azure-image-builder-canary): We offer a so-called *unstable* task so that you can test the latest updates and features before we release the task code as *stable*. After about a week, if there are no customer-reported or telemetry issues, we promote the task code to *stable*.
29
28
30
29
## Prerequisites
31
30
@@ -39,12 +38,12 @@ Before you begin, you must:
39
38
* Have an Azure DevOps Services (formerly Visual Studio Team Services, or VSTS) account, and a Build Pipeline created.
40
39
41
40
* Register and enable the VM Image Builder feature requirements in the subscription that's used by the pipelines:
* Create a standard Azure storage account in the source image resource group. You can use other resource groups or storage accounts. The storage account is used transfer the build artifacts from the DevOps task to the image.
@@ -78,12 +77,13 @@ In the dropdown list, select the subscription that you want VM Image Builder to
78
77
### Resource group
79
78
80
79
Use the resource group where the temporary image template artifact will be stored. When you create a template artifact, another temporary VM Image Builder resource group, `IT_<DestinationResourceGroup>_<TemplateName>_guid`, is created. The temporary resource group stores the image metadata, such as scripts. At the end of the task, the image template artifact and temporary VM Image Builder resource group is deleted.
81
-
80
+
82
81
### Location
83
82
84
83
The location is the region where VM Image Builder will run. Only a set number of [regions](../image-builder-overview.md#regions) are supported. The source images must be present in this location. For example, if you're using Azure Compute Gallery (formerly Shared Image Gallery), a replica must exist in that region.
85
84
86
85
### Managed identity (required)
86
+
87
87
VM Image Builder requires a managed identity, which it uses to read source custom images, connect to Azure Storage, and create custom images. For more information, see [Learn about VM Image Builder](../image-builder-overview.md#permissions).
88
88
89
89
### Virtual network support
@@ -95,11 +95,13 @@ You can configure the created VM to be in a specific virtual network. When you c
95
95
The source images must be of the supported VM Image Builder operating systems. You can choose existing custom images in the same region that VM Image Builder is running from:
96
96
97
97
* Managed Image: Pass in the resource ID. For example:
@@ -135,6 +137,7 @@ The task runs the following Windows Update configuration:
135
137
"exclude:$_.Title -like '*Preview*'",
136
138
"include:$true"
137
139
```
140
+
138
141
The task installs important and recommended Windows Updates that aren't *preview* versions.
139
142
140
143
#### Handling reboots
@@ -151,73 +154,73 @@ Select the **Build Path** button to choose the build folder that you want to be
151
154
152
155
> [!IMPORTANT]
153
156
> When you're adding a repo artifact, you might find that the directory name is prefixed with an underscore character (_). The underscore can cause issues with the inline commands. Be sure to use the appropriate quotation marks in the commands.
154
-
>
157
+
>
155
158
156
159
The following example explains how this works:
157
160
158
161
:::image type="content" source="./media/image-builder-devops-task/build-artifacts.png" alt-text="Screenshot of a directory structure showing hierarchy.":::
159
162
160
163
* For Windows: Files exist in the *C:* drive. A directory named *buildArtifacts* is created, which includes the *webapp* directory.
161
164
162
-
* For Linux: Files exist in the */tmp* directory. The *webapp* directory is created, which includes all the files and directories. Because this is a temporary directory, you must move the files out of it. Otherwise, they'll be deleted.
165
+
* For Linux: Files exist in the `/tmp` directory. The `webapp` directory is created, which includes all the files and directories. Because this is a temporary directory, you must move the files out of it. Otherwise, they'll be deleted.
163
166
164
167
#### Inline customization script
165
168
166
169
* For Windows: You can enter PowerShell inline commands, separated by commas. If you want to run a script in your build directory, you can use:
167
170
168
-
```PowerShell
171
+
```azurepowershell-interactive
169
172
& 'c:\buildArtifacts\webapp\webconfig.ps1'
170
173
```
171
174
172
175
You can reference multiple scripts or add more commands. For example:
173
176
174
-
```PowerShell
177
+
```azurepowershell-interactive
175
178
& 'c:\buildArtifacts\webapp\webconfig.ps1'
176
179
& 'c:\buildArtifacts\webapp\installAgent.ps1'
177
180
```
181
+
178
182
* For Linux: The build artifacts are put into the */tmp* directory. However, on many Linux operating systems, on a reboot, the */tmp* directory contents are deleted. If you want the artifacts to exist in the image, you must create another directory and copy them over. For example:
#### What happens to the build artifacts after the image build?
195
199
196
200
> [!NOTE]
197
201
> VM Image Builder doesn't automatically remove the build artifacts. We strongly suggest that you always use code to remove the build artifacts.
198
-
>
202
+
>
199
203
200
204
* For Windows: VM Image Builder deploys files to the *C:\buildArtifacts* directory. Because the directory is persisted, you must remove it by running a script. For example:
* For Linux: The build artifacts are put into the */tmp* directory. However, on many Linux operating systems, the */tmp* directory contents are deleted on reboot. We suggest that you use code to remove the contents and not rely on the operating system to remove the contents. For example:
211
215
212
216
```bash
213
217
sudo rm -R "/tmp/AppsAndImageBuilderLinux"
214
218
```
215
-
219
+
216
220
#### Total length of image build
217
221
218
222
Total length can't be changed in the DevOps pipeline task yet. It uses the default of 240 minutes. If you want to increase the [buildTimeoutInMinutes](./image-builder-json.md#properties-buildtimeoutinminutes), you can use an Azure CLI task in the release pipeline. Configure the task to copy a template and submit it. For an example solution, see [Use environment variables and parameters with VM Image Builder](https://github.com/danielsollondon/azvmimagebuilder/tree/master/solutions/4_Using_ENV_Variables#using-environment-variables-and-parameters-with-image-builder), or use Azure PowerShell.
219
223
220
-
221
224
#### Storage account
222
225
223
226
Select the storage account you created in the prerequisites. If you don't see it in the list, VM Image Builder doesn't have permissions to it.
@@ -236,7 +239,7 @@ The following three distribute types are supported.
The VM Image Builder template resource artifact is in the resource group that was specified initially in the task. When you're done troubleshooting, delete the artifact. If you're deleting it by using the Azure portal, within the resource group, select **Show Hidden Types** to view the artifact.
361
364
362
-
363
365
## Next steps
364
366
365
-
For more information, see [VM Image Builder overview](../image-builder-overview.md).
367
+
For more information, see [VM Image Builder overview](../image-builder-overview.md).
0 commit comments