From what you shared, I understand that your YAML defines a DevOps pipeline step using the AzureImageBuilderTask@1
task, which translates into an Azure Image Builder template.
The JSON equivalent of this YAML file follows the structure expected by Azure VM Image Builder API.
Azure Image Builder JSON format includes:
-
properties
(describes source image, customization, distribution) -
source
(marketplace image details) -
customize
(PowerShell scripts and configurations) -
distribute
(Shared Image Gallery details) -
replicationRegions
(where the final image is available)
Online tools like yaml2json can help, but manual adjustments will still be needed.
{
"location": "northeurope",
"properties": {
"buildTimeoutInMinutes": 120,
"vmProfile": {
"vmSize": "Standard_D2_v5",
"osDiskSizeGB": 127
},
"source": {
"type": "PlatformImage",
"publisher": "MicrosoftWindowsDesktop",
"offer": "office-365",
"sku": "win10-21h2-avd-m365",
"version": "latest"
},
"customize": [
{
"type": "PowerShell",
"name": "Run Custom Scripts",
"runElevated": true,
"inline": [
"C:\\buildartifacts\\_xGEN_Repo\\Main_Script.ps1",
"C:\\buildartifacts\\__xGEN_Repo\\CS_Install_Choco.ps1",
"C:\\buildartifacts\\__xGEN_Repo\\CS_Install_Chocolatey_Apps.ps1",
"C:\\buildartifacts\\__xGEN_Repo\\CS_Install_LanguagePack.ps1",
"C:\\buildartifacts\\__xGEN_Repo\\CS_Install_MSTeams.ps1",
"C:\\buildartifacts\\__xGEN_Repo\\CS_Install_Sophos.ps1",
"C:\\buildartifacts\\__xGEN_Repo\\CS_Virtual-Desktop-Optimization-Tool-main_v3.ps1"
]
},
{
"type": "WindowsUpdate",
"searchCriteria": "IsInstalled=0",
"filters": ["exclude:KB123456"],
"updateLimit": 40
}
],
"distribute": [
{
"type": "SharedImageGallery",
"galleryImageId": "/subscriptions/cxxx/resourceGroups/wvdImageDemoRg/providers/Microsoft.Compute/galleries/myaibsig01/images/win10wvd",
"replicationRegions": ["uksouth"],
"runOutputName": "myImageOutput"
}
],
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/cxxx/resourceGroups/wvdImageDemoRg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/aibIdentity1xxx": {}
}
}
}
}
Once you create the JSON file (aib-template.json
), deploy it using Azure CLI:
az resource create \
--resource-group wvdImageDemoRg \
--properties @aib-template.json \
--is-full-object \
--resource-type Microsoft.VirtualMachineImages/imageTemplates \
--name MyImageTemplate