azure-sdk-for-cpp/eng/common/TestResources/remove-test-resources.yml
Azure SDK Bot 5e071a07d7
Enable Caching of PS Modules (#2363)
- Remove copied AzPowershell utilities
- Add latest AZ module path already on hosted agents to PSModulePath
- Rename setup-az-modules template setup-environments to reflect what is is doing
- Add support for Caching the current user PS Module folder
- Add support for install-module if not already present in module folder
- Organize the live test clean-up script to be in the standard location

Co-authored-by: Wes Haggard <Wes.Haggard@microsoft.com>
2021-05-27 19:04:12 -04:00

39 lines
1.5 KiB
YAML

# Assumes steps in deploy-test-resources.yml was run previously. Requires
# environment variable: AZURE_RESOURCEGROUP_NAME 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 `
-ResourceGroupName "${env:AZURE_RESOURCEGROUP_NAME}" `
-ServiceDirectory "${{ parameters.ServiceDirectory }}" `
@subscriptionConfiguration `
-Force `
-Verbose
displayName: Remove test resources
condition: ne(variables['AZURE_RESOURCEGROUP_NAME'], '')
continueOnError: true