From d72135e75310642bee321def903053a791a5d0d1 Mon Sep 17 00:00:00 2001 From: Wes Haggard Date: Thu, 3 Oct 2024 10:16:22 -0700 Subject: [PATCH 1/2] Export the subscription data from the service connection --- eng/common/TestResources/deploy-test-resources.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/eng/common/TestResources/deploy-test-resources.yml b/eng/common/TestResources/deploy-test-resources.yml index 840acfd9e40b..5d80983f983b 100644 --- a/eng/common/TestResources/deploy-test-resources.yml +++ b/eng/common/TestResources/deploy-test-resources.yml @@ -59,6 +59,20 @@ steps: ${{ parameters.SubscriptionConfiguration }} '@ | ConvertFrom-Json -AsHashtable; + $context = (Get-AzContext) + $subscriptionConfiguration["SubscriptionId"] = $context.Subscription.Id + $subscriptionConfiguration["TenantId"] =$context.Subscription.TenantId + $subscriptionConfiguration["TestApplicationId"] = $context.Account.Id + $subscriptionConfiguration["ProvisionerApplicationId"] = $context.Account.Id + + $principal = Get-AzADServicePrincipal -ApplicationId $context.Account.Id + $subscriptionConfiguration["TestApplicationOid"] = $principal.Id + $subscriptionConfiguration["ProvisionerApplicationOid"] = $principal.Id + + Write-Host ($subscriptionConfiguration | ConvertTo-Json) + # Write the new SubscriptionConfiguration to be used by the remove test resources + Write-Host "##vso[task.setvariable variable=SubscriptionConfiguration;]$($subscriptionConfiguration | ConvertTo-Json -Compress)" + # The subscriptionConfiguration may have ArmTemplateParameters defined, so # pass those in via the ArmTemplateParameters flag, and handle any # additional parameters from the pipelines via AdditionalParameters From 890bb4e3c34d9d1370f3a69c96b29df70cc70121 Mon Sep 17 00:00:00 2001 From: Wes Haggard Date: Thu, 3 Oct 2024 14:30:03 -0700 Subject: [PATCH 2/2] Update deploy-test-resources.yml --- eng/common/TestResources/deploy-test-resources.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/common/TestResources/deploy-test-resources.yml b/eng/common/TestResources/deploy-test-resources.yml index 5d80983f983b..a9b224155a11 100644 --- a/eng/common/TestResources/deploy-test-resources.yml +++ b/eng/common/TestResources/deploy-test-resources.yml @@ -59,9 +59,9 @@ steps: ${{ parameters.SubscriptionConfiguration }} '@ | ConvertFrom-Json -AsHashtable; - $context = (Get-AzContext) + $context = Get-AzContext $subscriptionConfiguration["SubscriptionId"] = $context.Subscription.Id - $subscriptionConfiguration["TenantId"] =$context.Subscription.TenantId + $subscriptionConfiguration["TenantId"] = $context.Subscription.TenantId $subscriptionConfiguration["TestApplicationId"] = $context.Account.Id $subscriptionConfiguration["ProvisionerApplicationId"] = $context.Account.Id