Imaging Add-On: Fixed UI Definition & Resource Group Names (#1109)

* Removed default value for customizations

* Removed empty line & unnecessary try catch

* Compiled bicep changes

* Added element for minor version number, Fixed tool tips & default values

* Fixed RG names & var value
This commit is contained in:
Jason Masten 2024-10-17 11:12:23 -04:00 коммит произвёл GitHub
Родитель bc51f17e83
Коммит 555f125e69
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
4 изменённых файлов: 54 добавлений и 45 удалений

Просмотреть файл

@ -8,7 +8,6 @@ param(
[Parameter(Mandatory=$true)]
[string]$UserAssignedIdentityClientId,
[Parameter(Mandatory=$true)]
[string]$VmResourceId
)
@ -16,28 +15,23 @@ param(
$ErrorActionPreference = 'Stop'
$WarningPreference = 'SilentlyContinue'
Try {
# Fix the resource manager URI since only AzureCloud contains a trailing slash
$ResourceManagerUriFixed = if($ResourceManagerUri[-1] -eq '/'){$ResourceManagerUri.Substring(0,$ResourceManagerUri.Length - 1)} else {$ResourceManagerUri}
# Fix the resource manager URI since only AzureCloud contains a trailing slash
$ResourceManagerUriFixed = if($ResourceManagerUri[-1] -eq '/'){$ResourceManagerUri.Substring(0,$ResourceManagerUri.Length - 1)} else {$ResourceManagerUri}
# Get an access token for Azure resources
$AzureManagementAccessToken = (Invoke-RestMethod `
-Headers @{Metadata="true"} `
-Uri $('http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=' + $ResourceManagerUriFixed + '&client_id=' + $UserAssignedIdentityClientId)).access_token
# Get an access token for Azure resources
$AzureManagementAccessToken = (Invoke-RestMethod `
-Headers @{Metadata="true"} `
-Uri $('http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=' + $ResourceManagerUriFixed + '&client_id=' + $UserAssignedIdentityClientId)).access_token
# Set header for Azure Management API
$AzureManagementHeader = @{
'Content-Type'='application/json'
'Authorization'='Bearer ' + $AzureManagementAccessToken
}
ForEach($RunCommand in $RunCommands) {
Invoke-RestMethod `
-Headers $AzureManagementHeader `
-Method 'Delete' `
-Uri $($ResourceManagerUriFixed + $VmResourceId + '/runCommands/' + $RunCommand + '?api-version=2024-03-01')
}
# Set header for Azure Management API
$AzureManagementHeader = @{
'Content-Type'='application/json'
'Authorization'='Bearer ' + $AzureManagementAccessToken
}
catch {
throw
ForEach($RunCommand in $RunCommands) {
Invoke-RestMethod `
-Headers $AzureManagementHeader `
-Method 'Delete' `
-Uri $($ResourceManagerUriFixed + $VmResourceId + '/runCommands/' + $RunCommand + '?api-version=2024-03-01')
}

Просмотреть файл

@ -13,14 +13,19 @@ param computeGalleryImageResourceId string = ''
param containerName string
@description('The array of customizations to apply to the image. Limit of 25 runCommands per virtual machine applies. Depending on other features used, the limit may be lower.')
param customizations array = [
param customizations array = []
// Example customizations array
/*
[
{
name: 'InstallBundle'
blobName: 'Install-BundleSoftware.ps1'
arguments: '-BundleManifestBlob bundlemanifest.json'
enabled: false
}
]
]
*/
@description('Choose whether to deploy a diagnostic setting for the Activity Log.')
param deployActivityLogDiagnosticSetting bool = false
@ -252,7 +257,7 @@ param wsusServer string = ''
var keyVaultPrivateDnsZoneResourceId = resourceId(split(hubVirtualNetworkResourceId, '/')[2], split(hubVirtualNetworkResourceId, '/')[4], 'Microsoft.Network/privateDnsZones', replace('privatelink${environment().suffixes.keyvaultDns}', 'vault', 'vaultcore'))
var imageDefinitionName = empty(computeGalleryImageResourceId) ? '${imageDefinitionNamePrefix}-${marketplaceImageSKU}' : '${imageDefinitionNamePrefix}-${split(computeGalleryImageResourceId, '/')[10]}'
var subscriptionId = subscription().subscriptionId
var workloadName = 'Imaging'
var workloadName = 'imaging'
var workloadShortName = 'img'
module tier3 '../tier3/solution.bicep' = {
@ -295,7 +300,7 @@ module baseline 'modules/baseline.bicep' = {
exemptPolicyAssignmentIds: exemptPolicyAssignmentIds
location: location
mlzTags: tier3.outputs.mlzTags
resourceGroupName: replace(tier3.outputs.namingConvention.resourceGroup, tier3.outputs.tokens.service, workloadShortName)
resourceGroupName: replace(tier3.outputs.namingConvention.resourceGroup, tier3.outputs.tokens.service, 'network')
storageAccountResourceId: storageAccountResourceId
subscriptionId: subscriptionId
tags: tags
@ -358,7 +363,7 @@ module buildAutomation 'modules/buildAutomation.bicep' = if (enableBuildAutomati
officeInstaller: officeInstaller
oUPath: oUPath
replicaCount: replicaCount
resourceGroupName: replace(tier3.outputs.namingConvention.resourceGroup, tier3.outputs.tokens.service, workloadShortName)
resourceGroupName: replace(tier3.outputs.namingConvention.resourceGroup, tier3.outputs.tokens.service, 'network')
sourceImageType: sourceImageType
storageAccountResourceId: storageAccountResourceId
subnetResourceId: tier3.outputs.subnets[0].id
@ -422,7 +427,7 @@ module imageBuild 'modules/imageBuild.bicep' = {
msrdcwebrtcsvcInstaller: msrdcwebrtcsvcInstaller
officeInstaller: officeInstaller
replicaCount: replicaCount
resourceGroupName: replace(tier3.outputs.namingConvention.resourceGroup, tier3.outputs.tokens.service, workloadShortName)
resourceGroupName: replace(tier3.outputs.namingConvention.resourceGroup, tier3.outputs.tokens.service, 'network')
sourceImageType: sourceImageType
storageAccountResourceId: storageAccountResourceId
subnetResourceId: tier3.outputs.subnets[0].id

Просмотреть файл

@ -5,7 +5,7 @@
"_generator": {
"name": "bicep",
"version": "0.30.23.60470",
"templateHash": "4939632488731720064"
"templateHash": "7574127122781673801"
}
},
"parameters": {
@ -37,14 +37,7 @@
},
"customizations": {
"type": "array",
"defaultValue": [
{
"name": "InstallBundle",
"blobName": "Install-BundleSoftware.ps1",
"arguments": "-BundleManifestBlob bundlemanifest.json",
"enabled": false
}
],
"defaultValue": [],
"metadata": {
"description": "The array of customizations to apply to the image. Limit of 25 runCommands per virtual machine applies. Depending on other features used, the limit may be lower."
}
@ -513,7 +506,7 @@
"keyVaultPrivateDnsZoneResourceId": "[resourceId(split(parameters('hubVirtualNetworkResourceId'), '/')[2], split(parameters('hubVirtualNetworkResourceId'), '/')[4], 'Microsoft.Network/privateDnsZones', replace(format('privatelink{0}', environment().suffixes.keyvaultDns), 'vault', 'vaultcore'))]",
"imageDefinitionName": "[if(empty(parameters('computeGalleryImageResourceId')), format('{0}-{1}', parameters('imageDefinitionNamePrefix'), parameters('marketplaceImageSKU')), format('{0}-{1}', parameters('imageDefinitionNamePrefix'), split(parameters('computeGalleryImageResourceId'), '/')[10]))]",
"subscriptionId": "[subscription().subscriptionId]",
"workloadName": "Imaging",
"workloadName": "imaging",
"workloadShortName": "img"
},
"resources": [
@ -5006,7 +4999,7 @@
"value": "[reference(subscriptionResourceId('Microsoft.Resources/deployments', format('deploy-tier3-{0}', parameters('deploymentNameSuffix'))), '2022-09-01').outputs.mlzTags.value]"
},
"resourceGroupName": {
"value": "[replace(reference(subscriptionResourceId('Microsoft.Resources/deployments', format('deploy-tier3-{0}', parameters('deploymentNameSuffix'))), '2022-09-01').outputs.namingConvention.value.resourceGroup, reference(subscriptionResourceId('Microsoft.Resources/deployments', format('deploy-tier3-{0}', parameters('deploymentNameSuffix'))), '2022-09-01').outputs.tokens.value.service, variables('workloadShortName'))]"
"value": "[replace(reference(subscriptionResourceId('Microsoft.Resources/deployments', format('deploy-tier3-{0}', parameters('deploymentNameSuffix'))), '2022-09-01').outputs.namingConvention.value.resourceGroup, reference(subscriptionResourceId('Microsoft.Resources/deployments', format('deploy-tier3-{0}', parameters('deploymentNameSuffix'))), '2022-09-01').outputs.tokens.value.service, 'network')]"
},
"storageAccountResourceId": {
"value": "[parameters('storageAccountResourceId')]"
@ -5675,7 +5668,7 @@
"value": "[parameters('replicaCount')]"
},
"resourceGroupName": {
"value": "[replace(reference(subscriptionResourceId('Microsoft.Resources/deployments', format('deploy-tier3-{0}', parameters('deploymentNameSuffix'))), '2022-09-01').outputs.namingConvention.value.resourceGroup, reference(subscriptionResourceId('Microsoft.Resources/deployments', format('deploy-tier3-{0}', parameters('deploymentNameSuffix'))), '2022-09-01').outputs.tokens.value.service, variables('workloadShortName'))]"
"value": "[replace(reference(subscriptionResourceId('Microsoft.Resources/deployments', format('deploy-tier3-{0}', parameters('deploymentNameSuffix'))), '2022-09-01').outputs.namingConvention.value.resourceGroup, reference(subscriptionResourceId('Microsoft.Resources/deployments', format('deploy-tier3-{0}', parameters('deploymentNameSuffix'))), '2022-09-01').outputs.tokens.value.service, 'network')]"
},
"sourceImageType": {
"value": "[parameters('sourceImageType')]"
@ -9597,7 +9590,7 @@
"value": "[parameters('replicaCount')]"
},
"resourceGroupName": {
"value": "[replace(reference(subscriptionResourceId('Microsoft.Resources/deployments', format('deploy-tier3-{0}', parameters('deploymentNameSuffix'))), '2022-09-01').outputs.namingConvention.value.resourceGroup, reference(subscriptionResourceId('Microsoft.Resources/deployments', format('deploy-tier3-{0}', parameters('deploymentNameSuffix'))), '2022-09-01').outputs.tokens.value.service, variables('workloadShortName'))]"
"value": "[replace(reference(subscriptionResourceId('Microsoft.Resources/deployments', format('deploy-tier3-{0}', parameters('deploymentNameSuffix'))), '2022-09-01').outputs.namingConvention.value.resourceGroup, reference(subscriptionResourceId('Microsoft.Resources/deployments', format('deploy-tier3-{0}', parameters('deploymentNameSuffix'))), '2022-09-01').outputs.tokens.value.service, 'network')]"
},
"sourceImageType": {
"value": "[parameters('sourceImageType')]"

Просмотреть файл

@ -358,7 +358,23 @@
"subLabel": "Maj. Version",
"defaultValue": 1,
"showStepMarkers": false,
"toolTip": "Pick the size in MB",
"toolTip": "Input the major version number",
"constraints": {
"required": false
},
"visible": true,
"required": true
},
{
"name": "minorVersion",
"type": "Microsoft.Common.Slider",
"min": 0,
"max": 12,
"label": "Image version - minor version number",
"subLabel": "Min. Version",
"defaultValue": 0,
"showStepMarkers": false,
"toolTip": "Input the minor version number",
"constraints": {
"required": false
},
@ -368,13 +384,13 @@
{
"name": "patchVersion",
"type": "Microsoft.Common.Slider",
"min": 1,
"min": 0,
"max": 12,
"label": "Image version - patch version number",
"subLabel": "Patch Version",
"defaultValue": 1,
"defaultValue": 0,
"showStepMarkers": false,
"toolTip": "Pick the size in MB",
"toolTip": "Input the patch version number",
"constraints": {
"required": false
},
@ -1513,6 +1529,7 @@
"identifier": "[steps('basics').naming.identifier]",
"imageDefinitionNamePrefix": "[steps('image').destination.imageDefinitionNamePrefix]",
"imageMajorVersion": "[steps('image').destination.majorVersion]",
"imageMinorVersion": "[steps('image').destination.minorVersion]",
"imagePatchVersion": "[steps('image').destination.patchVersion]",
"installAccess": "[if(steps('customizations').office.installOffice, steps('customizations').office.installAccess,'false')]",
"installArcGisPro": "[if(steps('customizations').specialitySoftware.installArcGisPro, steps('customizations').specialitySoftware.installArcGisPro,'false')]",