Azure / Azure/bicep-types-az

Microsoft.AzureStackHCI/marketplaceGalleryImages doesn't work on 23H2

Open
#2,195 0 comments 0 reactions 0 assignees View on GitHub
Needs: Triage :mag:
Dominant language
TypeScript
Stars
108
Forks
44
Avg merge
18h 53m
Merged PRs (30d)
29

Description

**Bicep version**
Bicep CLI version 0.24.24 (5646341b0c)

**Describe the bug**
I'm trying to declare a vm image on a brand new 23H2 HCI cluster from the official marketplace, through bicep.

**To Reproduce**
image.bicep:
``` .bicep
@description('The azure region for all resources')
param location string = resourceGroup().location

@description('Custom HCI location')
param customLocationName string

@allowed(['Windows'])
param osType string = 'Windows'

@description('The image name')
param imageName string

@allowed([
'microsoftwindowsserver:windowsserver:2022-datacenter-azure-edition-core'
'microsoftwindowsserver:windowsserver:2022-datacenter-azure-edition'
'microsoftwindowsserver:windowsserver:2022-datacenter-azure-edition-hotpatch'
'microsoftwindowsdesktop:office-365:win11-21h2-avd-m365'
'microsoftwindowsdesktop:office-365:win10-21h2-avd-m365-g2'
'microsoftwindowsdesktop:windows-10:win10-21h2-avd-g2'
'microsoftwindowsdesktop:windows-11:win11-21h2-avd'
'microsoftwindowsdesktop:windows-11:win11-22h2-avd'
])
param imageURN string

param skuVersion string = 'latest'

@allowed(['V2'])
param hyperVGeneration string = 'V2'

var customLocationId = resourceId('Microsoft.ExtendedLocation/customLocations', customLocationName)
var publisherId = split(imageURN, ':')[0]
var offerId = split(imageURN, ':')[1]
var planId = split(imageURN, ':')[2]

resource image 'Microsoft.AzureStackHCI/marketplaceGalleryImages@2023-09-01-preview' = {
name: imageName
location: location
tags: {}
extendedLocation: {
name: customLocationId
type: 'CustomLocation'
}
properties: {
hyperVGeneration: hyperVGeneration
identifier: {
publisher: publisherId
offer: offerId
sku: planId
}
osType: osType
version: {
name: skuVersion
}
}
}
```
image.bicepparam:
``` .bicepparam
using './image.bicep'

param customLocationName = 's13501hciclus01-mocarb-cl'
param osType = 'Windows'
param imageName = 'win-datacenter-2022-azure-edition'
param imageURN = 'microsoftwindowsserver:windowsserver:2022-datacenter-azure-edition'
param skuVersion = '20348.2461.240510' // 'latest' doesn't work
param hyperVGeneration = 'V2'
```

Result i got:

> {"status":"Failed","error":{"code":"DeploymentFailed","target":"/subscriptions//resourceGroups//providers/Microsoft.Resources/deployments/image","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.","details":[{"code":"ResourceDeploymentFailure","target":"/subscriptions//resourceGroups//providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/win-datacenter-2022-azure-edition","message":"The resource write operation failed to complete successfully, because it reached terminal provisioning state 'Failed'.","details":[{"code":"Failed","message":"moc-operator galleryimage serviceClient returned an error while reconciling: rpc error: code = Unknown desc = ===== RESPONSE ERROR (ErrorCode=NoAuthenticationInformation) =====\nDescription=, Details: (none)\n: Failed","additionalInfo":[{"type":"ErrorInfo","info":{"category":"Uncategorized","recommendedAction":"","troubleshootingURL":""}}]}]}]}}

The resource is created on azure side, but downloading fails

**Additional context**
Official documentation : https://learn.microsoft.com/en-us/azure/templates/microsoft.azurestackhci/marketplacegalleryimages?pivots=deployment-language-bicep (with same apiVersion i used by default)
Note that this documentation do not show bicep example (only cli & portal) : https://learn.microsoft.com/en-us/azure-stack/hci/manage/virtual-machine-image-azure-marketplace?tabs=azurecli

FYI, it doesn't work with bicep but works through az cli:
``` powershell
param(
[string]$subscriptionId,
[string]$rgName,
[string]$customLocationName = "S13501HCICLUS01-mocarb-CL",
[string]$location = "WestEurope",
[string]$name = "win-datacenter-2022-azure-edition",
[string]$osType = "Windows",
[string]$offer = "windowsserver",
[string]$publisher = "microsoftwindowsserver",
[string]$sku = "2022-datacenter-azure-edition",
[string]$version = "20348.2461.240510"
#[string]$storagepathname
)

az account set -s $subscriptionId

az extension add --name "stack-hci-vm" # install extension

$customLocationID = "/subscriptions/$subscriptionId/resourcegroups/$rgName/providers/microsoft.extendedlocation/customlocations/$customLocationName"
# $storagepathid = "/subscriptions/$subscriptionId/resourceGroups/$rgName/providers/Microsoft.AzureStackHCI/storagecontainers/$storagepathname"

az stack-hci-vm image create --subscription $subscriptionId --resource-group $rgName --custom-location $customLocationID --location $location --name $name --os-type $ostype --offer $offer --publisher $publisher --sku $sku --version $version # --storage-path-id $storagepathid
```

Contributor guide

No contributing guide indexed for this repository

Research direction

The repro is in image.bicep and image.bicepparam, with the working az stack-hci-vm image create command as a comparison. Start by comparing the Bicep resource declaration and API version with the documented CLI behavior; done means the equivalent Bicep deployment downloads and provisions the marketplace image successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.