File tree Expand file tree Collapse file tree 2 files changed +42
-13
lines changed
Expand file tree Collapse file tree 2 files changed +42
-13
lines changed Original file line number Diff line number Diff line change @@ -26,16 +26,9 @@ stages:
2626 parameters :
2727 RunLiveTests : true
2828 ServiceDirectory : ' azidentity'
29- PreSteps :
30- - pwsh : |
31- [System.Convert]::FromBase64String($env:PFX_CONTENTS) | Set-Content -Path $(Agent.TempDirectory)/test.pfx -AsByteStream
32- Set-Content -Path $(Agent.TempDirectory)/test.pem -Value $env:PEM_CONTENTS
33- [System.Convert]::FromBase64String($env:SNI_CONTENTS) | Set-Content -Path $(Agent.TempDirectory)/testsni.pfx -AsByteStream
34- env:
35- PFX_CONTENTS: $(net-identity-spcert-pfx)
36- PEM_CONTENTS: $(net-identity-spcert-pem)
37- SNI_CONTENTS: $(net-identity-spcert-sni)
38- EnvVars :
39- IDENTITY_SP_CERT_PEM : $(Agent.TempDirectory)/test.pem
40- IDENTITY_SP_CERT_PFX : $(Agent.TempDirectory)/test.pfx
41- IDENTITY_SP_CERT_SNI : $(Agent.TempDirectory)/testsni.pfx
29+ CloudConfig :
30+ Public :
31+ SubscriptionConfigurations :
32+ - $(sub-config-azure-cloud-test-resources)
33+ # Contains alternate tenant, AAD app and cert info for testing
34+ - $(sub-config-identity-test-resources)
Original file line number Diff line number Diff line change 1+ [CmdletBinding (SupportsShouldProcess = $true , ConfirmImpact = ' Medium' )]
2+ param (
3+ # Captures any arguments from eng/New-TestResources.ps1 not declared here (no parameter errors).
4+ [Parameter (ValueFromRemainingArguments = $true )]
5+ $RemainingArguments
6+ )
7+
8+ if (! $CI ) {
9+ # TODO: Remove this once auto-cloud config downloads are supported locally
10+ Write-Host " Skipping cert setup in local testing mode"
11+ return
12+ }
13+
14+ if ($EnvironmentVariables -eq $null -or $EnvironmentVariables.Count -eq 0 ) {
15+ throw " EnvironmentVariables must be set in the calling script New-TestResources.ps1"
16+ }
17+
18+ $tmp = $env: TEMP ? $env: TEMP : [System.IO.Path ]::GetTempPath()
19+ $pfxPath = Join-Path $tmp " test.pfx"
20+ $pemPath = Join-Path $tmp " test.pem"
21+ $sniPath = Join-Path $tmp " testsni.pfx"
22+
23+ Write-Host " Creating identity test files: $pfxPath $pemPath $sniPath "
24+
25+ [System.Convert ]::FromBase64String($EnvironmentVariables [' PFX_CONTENTS' ]) | Set-Content - Path $pfxPath - AsByteStream
26+ Set-Content - Path $pemPath - Value $EnvironmentVariables [' PEM_CONTENTS' ]
27+ [System.Convert ]::FromBase64String($EnvironmentVariables [' SNI_CONTENTS' ]) | Set-Content - Path $sniPath - AsByteStream
28+
29+ # Set for pipeline
30+ Write-Host " ##vso[task.setvariable variable=IDENTITY_SP_CERT_PFX;]$pfxPath "
31+ Write-Host " ##vso[task.setvariable variable=IDENTITY_SP_CERT_PEM;]$pemPath "
32+ Write-Host " ##vso[task.setvariable variable=IDENTITY_SP_CERT_SNI;]$sniPath "
33+ # Set for local
34+ $env: IDENTITY_SP_CERT_PFX = $pfxPath
35+ $env: IDENTITY_SP_CERT_PEM = $pemPath
36+ $env: IDENTITY_SP_CERT_SNI = $sniPath
You can’t perform that action at this time.
0 commit comments