diff --git a/eng/common/TestResources/build-test-resource-config.yml b/eng/common/TestResources/build-test-resource-config.yml index bc34a9f6135b7..a1c6a41d6cb53 100644 --- a/eng/common/TestResources/build-test-resource-config.yml +++ b/eng/common/TestResources/build-test-resource-config.yml @@ -66,14 +66,16 @@ steps: if ($subConfigFilesRaw) { $subConfigFiles = $subConfigFilesRaw | ConvertFrom-Json -AsHashtable - # Handle cases where $subConfigFilesRaw converts to an empty string - # instead of an array of strings - if ($subConfigFiles) { - foreach ($file in $subConfigFiles) { - Write-Host "Merging sub config from file: $file" - $subConfig = Get-Content $file | ConvertFrom-Json -AsHashtable - $finalConfig = UpdateSubscriptionConfiguration $finalConfig $subConfig + foreach ($file in $subConfigFiles) { + # In some cases, $file could be an empty string. Get-Content will fail + # if $file is an empty string, so skip those cases. + if (!$file) { + continue } + + Write-Host "Merging sub config from file: $file" + $subConfig = Get-Content $file | ConvertFrom-Json -AsHashtable + $finalConfig = UpdateSubscriptionConfiguration $finalConfig $subConfig } }