Skip to content

Commit a8ddc38

Browse files
committed
Azure VM Image Builder: Isolated Builds & BYO ACI Subnet documentation
1 parent 4039e87 commit a8ddc38

File tree

5 files changed

+71
-26
lines changed

5 files changed

+71
-26
lines changed

articles/virtual-machines/TOC.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@
687687
href: ./windows/image-builder-virtual-desktop.md
688688
- name: Security
689689
items:
690-
- name: Security mechanisms
690+
- name: Isolated image builds
691691
displayName: Image builder, images, building
692692
href: ./security-isolated-image-builds-image-builder.md
693693
- name: Security controls by Azure Policy

articles/virtual-machines/image-builder-best-practices.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ This article describes best practices to be followed while using Azure VM Image
2020
- Make sure your image templates are set up for disaster recovery by following [reliability recommendation for AIB](../reliability/reliability-image-builder.md?toc=/azure/virtual-machines/toc.json&bc=/azure/virtual-machines/breadcrumb/toc.json).
2121
- Set up AIB [triggers](image-builder-triggers-how-to.md) to automatically rebuild your images and keep them updated.
2222
- Enable [VM Boot Optimization](vm-boot-optimization.md) in AIB to improve the create time for your VMs.
23+
- Specify your own Build VM and ACI subnets for a tighter control over deployment of networking related resource by AIB in your subscription. Specifying both these subnets also leads to faster image build times. See [template reference](./linux/image-builder-json.md#vnetconfig-optional) to learn more about specifying these options.
2324
- Follow the [principle of least privilege](/entra/identity-platform/secure-least-privileged-access) for your AIB resources.
2425
- **Image Template**: A principal that has access to your image template is able to run, delete, or tamper with it. Having this access, in turn, allows the principal to change the images created by that image template.
2526
- **Staging Resource Group**: AIB uses a staging resource group in your subscription to customize your VM image. You must consider this resource group as sensitive and restrict access to this resource group only to required principals. Since the process of customizing your image takes place in this resource group, a principal with access to the resource group is able to compromise the image building process - for example, by injecting malware into the image. AIB also delegates privileges associated with the Template identity and Build VM identity to resources in this resource group. Hence, a principal with access to the resource group is able to get access to these identities. Further, AIB maintains a copy of your customizer artifacts in this resource group. Hence, a principal with access to the resource group is able to inspect these copies.

articles/virtual-machines/linux/image-builder-json.md

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ The basic format is:
4444
"vmSize": "<vmSize>",
4545
"osDiskSizeGB": <sizeInGB>,
4646
"vnetConfig": {
47-
"subnetId": "/subscriptions/<subscriptionID>/resourceGroups/<vnetRgName>/providers/Microsoft.Network/virtualNetworks/<vnetName>/subnets/<subnetName>",
47+
"subnetId": "/subscriptions/<subscriptionID>/resourceGroups/<vnetRgName>/providers/Microsoft.Network/virtualNetworks/<vnetName>/subnets/<subnetName1>",
48+
"containerInstanceSubnetId": "/subscriptions/<subscriptionID>/resourceGroups/<vnetRgName>/providers/Microsoft.Network/virtualNetworks/<vnetName>/subnets/<subnetName2>",
4849
"proxyVmSize": "<vmSize>"
4950
},
5051
"userAssignedIdentities": [
@@ -80,7 +81,8 @@ resource azureImageBuilder 'Microsoft.VirtualMachineImages/imageTemplates@2022-0
8081
vmSize: '<vmSize>'
8182
osDiskSizeGB: <sizeInGB>
8283
vnetConfig: {
83-
subnetId: '/subscriptions/<subscriptionID>/resourceGroups/<vnetRgName>/providers/Microsoft.Network/virtualNetworks/<vnetName>/subnets/<subnetName>'
84+
subnetId: '/subscriptions/<subscriptionID>/resourceGroups/<vnetRgName>/providers/Microsoft.Network/virtualNetworks/<vnetName>/subnets/<subnetName1>'
85+
containerInstanceSubnetId: '/subscriptions/<subscriptionID>/resourceGroups/<vnetRgName>/providers/Microsoft.Network/virtualNetworks/<vnetName>/subnets/<subnetName2>'
8486
proxyVmSize: '<vmSize>'
8587
}
8688
userAssignedIdentities: [
@@ -1704,18 +1706,41 @@ If you don't specify any VNet properties, Image Builder creates its own VNet, Pu
17041706

17051707
```json
17061708
"vnetConfig": {
1707-
"subnetId": "/subscriptions/<subscriptionID>/resourceGroups/<vnetRgName>/providers/Microsoft.Network/virtualNetworks/<vnetName>/subnets/<subnetName>"
1709+
"subnetId": "/subscriptions/<subscriptionID>/resourceGroups/<vnetRgName>/providers/Microsoft.Network/virtualNetworks/<vnetName>/subnets/<subnetName1>",
1710+
"containerInstanceSubnetId": "/subscriptions/<subscriptionID>/resourceGroups/<vnetRgName>/providers/Microsoft.Network/virtualNetworks/<vnetName>/subnets/<subnetName2>",
1711+
"proxyVmSize": "<vmSize>"
17081712
}
17091713
```
17101714

17111715
# [Bicep](#tab/bicep)
17121716

17131717
```bicep
17141718
vnetConfig: {
1715-
subnetId: '/subscriptions/<subscriptionID>/resourceGroups/<vnetRgName>/providers/Microsoft.Network/virtualNetworks/<vnetName>/subnets/<subnetName>'
1719+
subnetId: '/subscriptions/<subscriptionID>/resourceGroups/<vnetRgName>/providers/Microsoft.Network/virtualNetworks/<vnetName>/subnets/<subnetName1>'
1720+
containerInstanceSubnetId: '/subscriptions/<subscriptionID>/resourceGroups/<vnetRgName>/providers/Microsoft.Network/virtualNetworks/<vnetName>/subnets/<subnetName2>'
1721+
proxyVmSize: '<vmSize>'
17161722
}
17171723
```
17181724

1725+
#### subnetId
1726+
Resource id of a pre-existing subnet on which the build VM and validation VM will be deployed.
1727+
1728+
#### containerInstanceSubnetId (optional)
1729+
Resource id of a pre-existing subnet on which Azure Container Instance (ACI) will be deployed for [Isolated Builds](../security-isolated-image-builds-image-builder.md). This property is only available in API versions `2024-02-01` or newer though existing templates created using earlier API versions can be updated to specify this property.
1730+
1731+
This field may be specified only if `subnetId` is also specified and must meet the following requirements:
1732+
- It must not be the same subnet as the one specified in `subnetId`.
1733+
- It must be on the same Virtual Network as the subnet specified in `subnetId`.
1734+
- There must be a network path from the ACI subnet to the Build VM subnet. This is required so that the container instance running in the ACI can connect to the Build VM over ssh/WinRM to perform customizations & validations. Specifically, if there are Network Security Groups (NSGs) associated with the ACI and Build VM subnets then they must allow access from the ACI subnet to the Build VM subnet on port 5986 (for Windows) or port 22 (for Linux).
1735+
- This subnet needs to be delegated to the ACI service so that it can be used to deploy ACI resources . This can be achieved in one of the two ways:
1736+
- You manage the delegation: The subnet must be delegated to ACI and must contain no resources (or only other ACI resources).
1737+
- AIB manages the delegation: The subnet must not be delegated to any service and must contain no resources.
1738+
1739+
You can read more about subnet delegation for Azure services [here](../../virtual-network/manage-subnet-delegation.md). ACI specific subnet delegation information is available [here](../../container-instances/container-instances-virtual-network-concepts.md).
1740+
1741+
#### proxyVmSize (optional)
1742+
Size of the proxy virtual machine used to pass traffic to the build VM and validation VM. This must not be specified if `containerInstanceSubnetId` is specified because no proxy virtual machine is deployed in that case. Omit or specify empty string to use the default (Standard_A1_v2).
1743+
17191744
---
17201745

17211746
## Image Template Operations

articles/virtual-machines/linux/image-builder-troubleshoot.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Use this article to troubleshoot and resolve common issues that you might encoun
2222
When you're creating a build, do the following:
2323

2424
- The VM Image Builder service communicates to the build VM by using WinRM or Secure Shell (SSH). Don't* disable these settings as part of the build.
25-
- VM Image Builder creates resources in the staging resource group as part of the builds. Be sure to verify that Azure Policy doesn't prevent VM Image Builder from creating or using necessary resources.
25+
- VM Image Builder creates resources in the staging resource group as part of the builds. The exact list of resources depends on the [networking configuration](./image-builder-json.md#vnetconfig-optional) specified in the image template. Be sure to verify that Azure Policy doesn't prevent VM Image Builder from creating or using necessary resources.
2626
- Create an IT_ resource group.
2727
- Create a storage account without a firewall.
2828
- Deploy [Azure Container Instances](../../container-instances/container-instances-overview.md).
@@ -800,7 +800,7 @@ Azure Image Builder builds can fail for reasons listed elsewhere in this documen
800800

801801
#### Solution
802802
If you determine that a build is failing due to Isolated Image Builds, you can do the following:
803-
- Ensure there's no [Azure Policy](../../governance/policy/overview.md) blocking the deployment of resources mentioned in the Prerequisites section, specifically Azure Container Instances, Azure Virtual Networks, and Azure Private Endpoints.
803+
- Ensure there's no [Azure Policy](../../governance/policy/overview.md) blocking the deployment of resources mentioned in the [Prerequisites section](./image-builder-troubleshoot.md#prerequisites), specifically Azure Container Instances.
804804
- Ensure your subscription has sufficient quota of Azure Container Instances to support all your concurrent image builds. For more information, see, Azure Container Instances [quota exceeded](./image-builder-troubleshoot.md#azure-container-instances-quota-exceeded).
805805

806806
Azure Image Builder is currently in the process of deploying Isolated Image Builds. Specific image templates are not tied to Isolated Image Builds and the same image template might or might not utilize Isolated Image Builds during different builds. You can do the following to temporarily run your build without Isolated Image Builds.

0 commit comments

Comments
 (0)