From 537d69688706eb8848e3dc6458a42e0ed7b14e66 Mon Sep 17 00:00:00 2001 From: Viktor Ribchev Date: Thu, 14 Dec 2023 11:23:54 +0200 Subject: [PATCH] Added support for specifying subscription in create_image_definition.sh --- CHANGELOG.md | 1 + create_image_definition.sh | 4 +++- variables.pkr.hcl | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cd736b..ec74ab9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to the Packer template for creating GraphDB Azure VM images - Removed features preventing build with Standard_B1ls VM - Fixed create_image_definition.sh +- Added support for specifying subscription in create_image_definition.sh ## 1.1.0 diff --git a/create_image_definition.sh b/create_image_definition.sh index 11cfd54..8429ad5 100644 --- a/create_image_definition.sh +++ b/create_image_definition.sh @@ -12,6 +12,7 @@ variables_file="variables.pkrvars.hcl" if [ -f "$variables_file" ]; then # Use grep to extract the variable values + subscription_id=$(grep 'subscription_id' "$variables_file" | cut -d '"' -f 2) image_definition_name=$(grep 'image_definition_name' "$variables_file" | cut -d '"' -f 2) gdb_version=$(grep 'gdb_version' "$variables_file" | cut -d '"' -f 2) gallery_resource_group=$(grep 'gallery_resource_group' "$variables_file" | cut -d '"' -f 2) @@ -26,6 +27,7 @@ if [ -f "$variables_file" ]; then # TODO extend command with --features 'IsAcceleratedNetworkSupported=true DiskControllerTypes=SCSI,NVMe' when we have quota for Standard_B2pts_v2 az_command="az sig image-definition create \ + --subscription $subscription_id \ -g $gallery_resource_group \ --gallery-name $gallery_name \ --gallery-image-definition "$image_definition_name" \ @@ -41,7 +43,7 @@ if [ -f "$variables_file" ]; then echo "Extracted variables and constructed Azure CLI command:" eval "$az_command" - az sig image-definition wait -i "$image_definition_name" -r "$gallery_name" -g "$gallery_resource_group" --created + az sig image-definition wait -i "$image_definition_name" -r "$gallery_name" -g "$gallery_resource_group" --created --subscription $subscription_id packer build -var-file="variables.pkrvars.hcl" . else echo "The variables file $variables_file does not exist." diff --git a/variables.pkr.hcl b/variables.pkr.hcl index 60aba9c..9f79dce 100644 --- a/variables.pkr.hcl +++ b/variables.pkr.hcl @@ -66,7 +66,7 @@ variable vm_size { type = string default = "Standard_B1ls" # TODO replace with B2pts_v2 when quota is available in order to build with IsAcceleratedNetworkSupported=true DiskControllerTypes=SCSI,NVMe features - # default = "Standard_B2pts_v2" +# default = "Standard_B2ats_v2" } variable image_replica_count {