azure-sdk-for-cpp/eng/common/TestResources/remove-test-resources.yml
Azure SDK Bot f0e0070223
Sync eng/common directory with azure-sdk-tools for PR 3067 (#3529)
* Infer live resource group name based on service directory name

* Simplify service directory path splitting

* Use common logic for username and basename generation

* Rename GetServiceName to GetServiceLeafDirectoryName

Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
2022-04-07 11:33:38 -07:00

39 lines
1.4 KiB
YAML

# Assumes steps in deploy-test-resources.yml was run previously. Requires
# environment variable: <ServiceDirectory>_RESOURCE_GROUP and Az PowerShell module
parameters:
ServiceDirectory: ''
SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources)
# SubscriptionConfiguration will be splat into the parameters of the test
# resources script. It should be JSON in the form:
# {
# "SubscriptionId": "<subscription id>",
# "TenantId": "<tenant id>",
# "TestApplicationId": "<test app id>",
# "TestApplicationSecret": "<test app secret>",
# "ProvisionerApplicationId": "<provisioner app id>",
# "ProvisionerApplicationSecret": "<provisioner app secret>",
# "Environment": "AzureCloud | AzureGov | AzureChina | <other environment>"
# }
# The Remove-TestResources.ps1 script accommodates extra parameters so it will
# not error when parameters are provided which the script doesn't use.
steps:
- pwsh: |
eng/common/scripts/Import-AzModules.ps1
$subscriptionConfiguration = @"
${{ parameters.SubscriptionConfiguration }}
"@ | ConvertFrom-Json -AsHashtable;
eng/common/TestResources/Remove-TestResources.ps1 `
@subscriptionConfiguration `
-ServiceDirectory "${{ parameters.ServiceDirectory }}" `
-CI `
-Force `
-Verbose
displayName: Remove test resources
condition: eq(variables['CI_HAS_DEPLOYED_RESOURCES'], 'true')
continueOnError: true