Skip to content

Commit f1073bc

Browse files
committed
pass vm size into fips helper script
1 parent e91b84d commit f1073bc

File tree

2 files changed

+9
-19
lines changed

2 files changed

+9
-19
lines changed

vhdbuilder/packer/fips-helper.sh

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -99,22 +99,9 @@ EOF
9999

100100
# Function to create FIPS-enabled VM using REST API
101101
create_fips_vm() {
102+
local vm_size="$1"
102103
echo "Creating VM with FIPS 140-3 encryption using REST API..."
103104

104-
# Prepare VM creation parameters
105-
local VM_SIZE="Standard_D8ds_v5"
106-
107-
# shellcheck disable=SC3010
108-
if [[ "${ARCHITECTURE,,}" == "arm64" ]]; then
109-
VM_SIZE="Standard_D8pds_v5"
110-
fi
111-
112-
# GB200 specific VM options for scanning (uses standard ARM64 VM for now)
113-
if [ "${OS_TYPE}" = "Linux" ] && grep -q "GB200" <<< "$FEATURE_FLAGS"; then
114-
echo "GB200: Using standard ARM64 VM options for scanning"
115-
# Additional GB200-specific VM options can be added here when GB200 SKUs are available
116-
fi
117-
118105
# Build the VM request body for FIPS scenario
119106
local VM_BODY=$(build_fips_vm_body \
120107
"$PACKER_BUILD_LOCATION" \
@@ -124,7 +111,7 @@ create_fips_vm() {
124111
"$VHD_IMAGE" \
125112
"$SCANNING_NIC_ID" \
126113
"$UMSI_RESOURCE_ID" \
127-
"$VM_SIZE")
114+
"$vm_size")
128115

129116
# Create the VM using REST API
130117
az rest \

vhdbuilder/packer/vhd-scanning.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,22 @@ function cleanup() {
7474
trap cleanup EXIT
7575
capture_benchmark "${SCRIPT_NAME}_set_variables_and_create_scan_resource_group"
7676

77-
VM_OPTIONS="--size Standard_D8ds_v5"
77+
VM_SIZE="Standard_D8ds_v5"
78+
VM_OPTIONS="--size $VM_SIZE"
7879
# shellcheck disable=SC3010
7980
if [[ "${ARCHITECTURE,,}" == "arm64" ]]; then
80-
VM_OPTIONS="--size Standard_D8pds_v5"
81+
VM_SIZE="Standard_D8pds_v5"
82+
VM_OPTIONS="--size $VM_SIZE"
8183
fi
8284

8385
if [ "${OS_TYPE}" = "Linux" ] && [ "${ENABLE_TRUSTED_LAUNCH}" = "True" ]; then
8486
VM_OPTIONS+=" --security-type TrustedLaunch --enable-secure-boot true --enable-vtpm true"
8587
fi
8688

8789
if [ "${OS_TYPE}" = "Linux" ] && grep -q "cvm" <<< "$FEATURE_FLAGS"; then
90+
VM_SIZE="Standard_DC8ads_v5"
8891
# We completely re-assign the VM_OPTIONS string here to ensure that no artifacts from earlier conditionals are included
89-
VM_OPTIONS="--size Standard_DC8ads_v5 --security-type ConfidentialVM --enable-secure-boot true --enable-vtpm true --os-disk-security-encryption-type VMGuestStateOnly --specialized true"
92+
VM_OPTIONS="--size $VM_SIZE --security-type ConfidentialVM --enable-secure-boot true --enable-vtpm true --os-disk-security-encryption-type VMGuestStateOnly --specialized true"
9093
fi
9194

9295
# GB200 specific VM options for scanning (uses standard ARM64 VM for now)
@@ -110,7 +113,7 @@ if [ "${OS_SKU}" = "Ubuntu" ] && [ "${OS_VERSION}" = "22.04" ] && [ "$(printf %s
110113

111114
# Register FIPS feature and create VM using REST API
112115
ensure_fips_feature_registered
113-
create_fips_vm
116+
create_fips_vm "$VM_SIZE"
114117
else
115118
echo "Creating VM using standard az vm create command..."
116119

0 commit comments

Comments
 (0)