diff --git a/eng/common/TestResources/build-test-resource-config.yml b/eng/common/TestResources/build-test-resource-config.yml index 2f158c4754cf..f8b47ea1a69f 100644 --- a/eng/common/TestResources/build-test-resource-config.yml +++ b/eng/common/TestResources/build-test-resource-config.yml @@ -9,6 +9,9 @@ parameters: - name: EnvVars type: object default: null + - name: SubscriptionConfigurationFilePath + type: string + default: '' steps: - ${{ if parameters.SubscriptionConfiguration }}: @@ -44,3 +47,16 @@ steps: displayName: Merge Test Resource Configurations ${{ if parameters.EnvVars }}: env: ${{ parameters.EnvVars }} + + - ${{ if ne(parameters.SubscriptionConfigurationFilePath, '') }}: + - pwsh: | + $configBase = @' + $(SubscriptionConfiguration) + '@ | ConvertFrom-Json -AsHashtable + $config = Get-Content '${{ parameters.SubscriptionConfigurationFilePath }}' ` + | ConvertFrom-Json -AsHashtable + . ./eng/common/TestResources/SubConfig-Helpers.ps1 + UpdateSubscriptionConfiguration $configBase $config + displayName: Merge in Subscription Configuration File Path + ${{ if parameters.EnvVars }}: + env: ${{ parameters.EnvVars }} diff --git a/eng/common/TestResources/deploy-test-resources.yml b/eng/common/TestResources/deploy-test-resources.yml index 724dfd8addb9..8976ad269c62 100644 --- a/eng/common/TestResources/deploy-test-resources.yml +++ b/eng/common/TestResources/deploy-test-resources.yml @@ -8,8 +8,6 @@ parameters: ServiceConnection: not-specified ResourceType: test UseFederatedAuth: false - SubscriptionConfigurationFilePath: '' - # SubscriptionConfiguration will be splatted into the parameters of the test # resources script. It should be JSON in the form: @@ -56,18 +54,9 @@ steps: ScriptType: InlineScript Inline: | eng/common/scripts/Import-AzModules.ps1 - - if ('${{ parameters.SubscriptionConfigurationFilePath }}' -ne '') { - $subscriptionConfiguration = ` - Get-Content '${{ parameters.SubscriptionConfigurationFilePath }}' ` - | ConvertFrom-Json -AsHashtable; - } else { - # Multiline string termination ('@) needs to be at the beginning - # of the line - $subscriptionConfiguration = @' - ${{ parameters.SubscriptionConfiguration }} + $subscriptionConfiguration = @' + ${{ parameters.SubscriptionConfiguration }} '@ | ConvertFrom-Json -AsHashtable; - } # The subscriptionConfiguration may have ArmTemplateParameters defined, so # pass those in via the ArmTemplateParameters flag, and handle any @@ -86,7 +75,6 @@ steps: - ${{ else }}: - pwsh: | eng/common/scripts/Import-AzModules.ps1 - $subscriptionConfiguration = @' ${{ parameters.SubscriptionConfiguration }} '@ | ConvertFrom-Json -AsHashtable; diff --git a/eng/common/TestResources/sub-config/AzurePublicMsft.json b/eng/common/TestResources/sub-config/AzurePublicMsft.json index 78d8a782c26f..3a1a085e13be 100644 --- a/eng/common/TestResources/sub-config/AzurePublicMsft.json +++ b/eng/common/TestResources/sub-config/AzurePublicMsft.json @@ -2,8 +2,10 @@ "SubscriptionId": "2cd617ea-1866-46b1-90e3-fffb087ebf9b", "TenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "TestApplicationId": "f850650c-1fcf-4489-b46f-71af2e30d360", + "TestApplicationSecret": "", "TestApplicationOid": "30511c9d-ba1a-4c7b-b422-5b543da11b3f", "ProvisionerApplicationId": "f850650c-1fcf-4489-b46f-71af2e30d360", + "ProvisionerApplicationSecret": "", "ProvisionerApplicationOid": "30511c9d-ba1a-4c7b-b422-5b543da11b3f", "Environment": "AzureCloud", "AzureSubscription": "Azure SDK Test Resources"