119 lines
5.1 KiB
YAML
119 lines
5.1 KiB
YAML
parameters:
|
|
ServiceDirectory: not-set
|
|
ArmTemplateParameters: '@{}'
|
|
DeleteAfterHours: 8
|
|
Location: ''
|
|
EnvVars: {}
|
|
SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources)
|
|
ServiceConnection: not-specified
|
|
ResourceType: test
|
|
UseFederatedAuth: false
|
|
|
|
# SubscriptionConfiguration will be splatted 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>"
|
|
# "EnvironmentVariables": {
|
|
# "SERVICE_MANAGEMENT_URL": "<service management url>",
|
|
# "STORAGE_ENDPOINT_SUFFIX": "<storage endpoint suffix>",
|
|
# "RESOURCE_MANAGER_URL": "<resource manager url>",
|
|
# "SEARCH_ENDPOINT_SUFFIX": "<search endpoint suffix>",
|
|
# "COSMOS_TABLES_ENDPOINT_SUFFIX": "<cosmos tables endpoint suffix>"
|
|
# },
|
|
# "ArmTemplateParameters": {
|
|
# "keyVaultDomainSuffix": "<keyVaultDomainSuffix>",
|
|
# "storageEndpointSuffix": "<storageEndpointSuffix>",
|
|
# "endpointSuffix": "<endpointSuffix>",
|
|
# "azureAuthorityHost": "<azureAuthorityHost>",
|
|
# "keyVaultEndpointSuffix": "<keyVaultEndpointSuffix>"
|
|
# }
|
|
# }
|
|
|
|
|
|
steps:
|
|
- template: /eng/common/pipelines/templates/steps/cache-ps-modules.yml
|
|
|
|
- template: /eng/common/TestResources/setup-environments.yml
|
|
|
|
- ${{ if eq('true', parameters.UseFederatedAuth) }}:
|
|
- task: AzurePowerShell@5
|
|
displayName: 🚀 Deploy test resources
|
|
env:
|
|
TEMP: $(Agent.TempDirectory)
|
|
PoolSubnet: $(PoolSubnet)
|
|
${{ insert }}: ${{ parameters.EnvVars }}
|
|
inputs:
|
|
azureSubscription: ${{ parameters.ServiceConnection }}
|
|
azurePowerShellVersion: LatestVersion
|
|
pwsh: true
|
|
ScriptType: InlineScript
|
|
Inline: |
|
|
eng/common/scripts/Import-AzModules.ps1
|
|
$subscriptionConfiguration = @'
|
|
${{ parameters.SubscriptionConfiguration }}
|
|
'@ | ConvertFrom-Json -AsHashtable;
|
|
|
|
$context = Get-AzContext
|
|
$subscriptionConfiguration["Environment"] = $context.Environment.Name
|
|
$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
|
|
eng/common/TestResources/New-TestResources.ps1 `
|
|
-ResourceType '${{ parameters.ResourceType }}' `
|
|
-ServiceDirectory '${{ parameters.ServiceDirectory }}' `
|
|
-Location '${{ parameters.Location }}' `
|
|
-DeleteAfterHours '${{ parameters.DeleteAfterHours }}' `
|
|
@subscriptionConfiguration `
|
|
-AdditionalParameters ${{ parameters.ArmTemplateParameters }} `
|
|
-AllowIpRanges ('$(azsdk-corp-net-ip-ranges)' -split ',') `
|
|
-CI `
|
|
-Force `
|
|
-Verbose | Out-Null
|
|
|
|
- ${{ else }}:
|
|
- pwsh: |
|
|
eng/common/scripts/Import-AzModules.ps1
|
|
$subscriptionConfiguration = @'
|
|
${{ parameters.SubscriptionConfiguration }}
|
|
'@ | ConvertFrom-Json -AsHashtable;
|
|
|
|
# The subscriptionConfiguration may have ArmTemplateParameters defined, so
|
|
# pass those in via the ArmTemplateParameters flag, and handle any
|
|
# additional parameters from the pipelines via AdditionalParameters
|
|
eng/common/TestResources/New-TestResources.ps1 `
|
|
-ResourceType '${{ parameters.ResourceType }}' `
|
|
-ServiceDirectory '${{ parameters.ServiceDirectory }}' `
|
|
-Location '${{ parameters.Location }}' `
|
|
-DeleteAfterHours '${{ parameters.DeleteAfterHours }}' `
|
|
@subscriptionConfiguration `
|
|
-AdditionalParameters ${{ parameters.ArmTemplateParameters }} `
|
|
-AllowIpRanges ('$(azsdk-corp-net-ip-ranges)' -split ',') `
|
|
-CI `
|
|
-ServicePrincipalAuth `
|
|
-Force `
|
|
-Verbose | Out-Null
|
|
displayName: 🚀 Deploy test resources
|
|
env:
|
|
TEMP: $(Agent.TempDirectory)
|
|
PoolSubnet: $(PoolSubnet)
|
|
${{ insert }}: ${{ parameters.EnvVars }}
|