1parameters:
2  rootFolder: '$(Build.SourcesDirectory)'
3
4steps:
5  - pwsh: |
6        $(Build.SourcesDirectory)/eng/common/scripts/trust-proxy-certificate.ps1
7    displayName: 'Language Specific Certificate Trust'
8
9  - pwsh: |
10      Write-Host "##vso[task.setvariable variable=OriginalPath]$env:PATH"
11    displayName: 'Store Path Value'
12
13  - pwsh: |
14      Write-Host "##vso[task.setvariable variable=ASPNETCORE_Kestrel__Certificates__Default__Path]$(Build.SourcesDirectory)/eng/common/testproxy/dotnet-devcert.pfx"
15      Write-Host "##vso[task.setvariable variable=ASPNETCORE_Kestrel__Certificates__Default__Password]password"
16    displayName: 'Configure Kestrel Environment Variables'
17
18  - task: UseDotNet@2
19    displayName: "Use .NET Core SDK"
20    inputs:
21      packageType: sdk
22      version: 5.0.205
23
24  - pwsh: |
25      dotnet tool install azure.sdk.tools.testproxy `
26        --tool-path $(Build.BinariesDirectory)/test-proxy `
27        --add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json `
28        --version 1.0.0-dev.20210811.2
29    displayName: "Install test-proxy"
30
31  - pwsh: |
32      Start-Process $(Build.BinariesDirectory)/test-proxy/test-proxy.exe `
33        -ArgumentList "--storage-location '${{ parameters.rootFolder }}'" `
34        -NoNewWindow -PassThru
35    displayName: 'Run the testproxy - windows'
36    condition: and(succeeded(), eq(variables['Agent.OS'],'Windows_NT'))
37
38  # nohup does NOT continue beyond the current session if you use it within powershell
39  - bash: |
40      sudo nohup $(Build.BinariesDirectory)/test-proxy/test-proxy &
41    displayName: "Run the testproxy - linux/mac"
42    condition: and(succeeded(), ne(variables['Agent.OS'],'Windows_NT'))
43    workingDirectory: "${{ parameters.rootFolder }}"
44
45  - pwsh: |
46      Write-Host "##vso[task.setvariable variable=PATH]$(OriginalPath)"
47    displayName: 'Restore .NET version by resetting path'