Azure / Azure/azvmimagebuilder

Image Builder hangs when building template with anything other than System Elevated powershell script/command

Open
#53 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
PowerShell
Stars
111
Forks
69
PR merge metrics
No merged PRs in 30d

Description

I'm using the base image Windows 11 + VS 2022 (Dev Box Compatible)

I've found that even if I tell it to execute a powershell command of just `ls .` it will hang if I select the `Elevated` without `Run as System` or uncheck both (User Context)

I end up having to run everything as System which causes problems for some tasks.

ARM template

```json
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"defaultValue": "gh-53-repro",
"type": "string"
},
"imageName": {
"defaultValue": "gh-53-repro",
"type": "string"
},
"location": {
"defaultValue": "[resourceGroup().location]",
"type": "string"
},
"imagePublisher": {
"defaultValue": "microsoftvisualstudio",
"type": "string"
},
"imageOffer": {
"defaultValue": "visualstudioplustools",
"type": "string"
},
"imageSku": {
"defaultValue": "vs-2022-ent-general-win11-m365-gen2",
"type": "string"
},
"version": {
"defaultValue": "latest",
"type": "string"
},
"vmSize": {
"defaultValue": "Standard_B4ms",
"type": "string"
},
"osDiskSizeGB": {
"defaultValue": 128,
"type": "int"
},
"userAssignedIdentities": {
"defaultValue": [],
"type": "array"
},
"managedImageResourceId": {
"type": "string"
},
"userAssignedIdentityResourceId": {
"type": "string"
}
},
"variables": {},
"resources": [
{
"type": "Microsoft.VirtualMachineImages/imageTemplates",
"apiVersion": "2022-07-01",
"dependsOn": [],
"name": "[parameters('name')]",
"location": "[parameters('location')]",
"properties": {
"vmProfile": {
"vmSize": "[parameters('vmSize')]",
"osDiskSizeGB": "[parameters('osDiskSizeGB')]",
"userAssignedIdentities": "[parameters('userAssignedIdentities')]"
},
"source": {
"type": "PlatformImage",
"publisher": "[parameters('imagePublisher')]",
"offer": "[parameters('imageOffer')]",
"sku": "[parameters('imageSku')]",
"version": "[parameters('version')]"
},
"distribute": [
{
"type": "ManagedImage",
"imageId": "[parameters('managedImageResourceId')]",
"location": "westus3",
"runOutputName": "runOutputManagedImage"
}
],
"customize": [
{
"type": "PowerShell",
"name": "Elevated User Context",
"inline": [
"ls ."
],
"runElevated": true,
"runAsSystem": false
},
{
"type": "PowerShell",
"name": "User Context",
"inline": [
"ls ."
],
"runElevated": false,
"runAsSystem": false
}
]
},
"tags": {},
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"[parameters('userAssignedIdentityResourceId')]": {}
}
}
}
],
"outputs": {}
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.