|
1 | 1 | parameters:
|
2 | 2 | dockerProjectName: ''
|
| 3 | + azureServiceConnection: '' |
3 | 4 |
|
4 | 5 | steps:
|
5 | 6 | - bash: |
|
|
9 | 10 | fi
|
10 | 11 | env:
|
11 | 12 | PROJECT_NAME: ${{ parameters.dockerProjectName }}
|
| 13 | + - task: AzureCLI@2 |
| 14 | + displayName: 'Import secrets from Azure Key Vault' |
| 15 | + inputs: |
| 16 | + azureSubscription: '${{ parameters.azureServiceConnection }}' |
| 17 | + addSpnToEnvironment: true |
| 18 | + scriptType: 'pscore' |
| 19 | + scriptLocation: 'inlineScript' |
| 20 | + inlineScript: | |
| 21 | + Set-PSRepository -Name PSGallery -InstallationPolicy Trusted |
| 22 | + Install-Module -Name Arcus.Scripting.DevOps -AllowClobber |
| 23 | +
|
| 24 | + Set-AzDevOpsVariable 'Arcus.Security.TenantId' -Value $env:tenantId -AsSecret |
| 25 | + Set-AzDevOpsVariable 'Arcus.Security.ServicePrincipal.ClientId' -Value $env:servicePrincipalId -AsSecret |
| 26 | + Set-AzDevOpsVariable 'Arcus.Security.ServicePrincipal.ClientSecret' -Value $env:servicePrincipalKey -AsSecret |
| 27 | +
|
| 28 | + $unauthorizedClientId = az keyvault secret show --name $env:ARCUS_GENERAL_UNAUTHORIZED_SERVICEPRINCIPAL_CLIENTID_SECRETNAME --vault-name $env:ARCUS_GENERAL_KEYVAULT_NAME | ConvertFrom-Json |
| 29 | + $unauthorizedClientSecret = az keyvault secret show --name $env:ARCUS_GENERAL_UNAUTHORIZED_SERVICEPRINCIPAL_CLIENTSECRET_SECRETNAME --vault-name $env:ARCUS_GENERAL_KEYVAULT_NAME | ConvertFrom-Json |
| 30 | + Set-AzDevOpsVariable 'Arcus.Security.Unauthorized.ServicePrincipal.ClientId' -Value $unauthorizedClientId.value -AsSecret |
| 31 | + Set-AzDevOpsVariable 'Arcus.Security.Unauthorized.ServicePrincipal.ClientSecret' -Value $unauthorizedClientSecret.value -AsSecret |
| 32 | +
|
| 33 | + $testSecret = az keyvault secret show --name $env:ARCUS_SECURITY_KEYVAULT_TESTSECRETNAME --vault-name $env:ARCUS_SECURITY_KEYVAULT_NAME | ConvertFrom-Json |
| 34 | + $testSecretVersion = $testSecret.id.Split('/') | Select-Object -Last 1 |
| 35 | + Write-Host "Test secret '$($testSecret.name)' version is '$testSecretVersion'" |
| 36 | + $testSecretValue = $testSecret.value |
| 37 | +
|
| 38 | + Set-AzDevOpsVariable -AsSecret -Name 'Arcus.Security.KeyVault.TestSecretValue' -Value $testSecretValue |
| 39 | + Set-AzDevOpsVariable -AsSecret -Name 'Arcus.Security.KeyVault.TestSecretVersion' -Value $testSecretVersion |
| 40 | + - template: 'download-hashicorp-vault.yml' |
| 41 | + parameters: |
| 42 | + targetFolder: '$(Build.SourcesDirectory)' |
| 43 | + version: $(HashiCorp.Vault.Version) |
| 44 | + vaultBinVariableName: 'Arcus.HashiCorp.VaultBin' |
12 | 45 | - task: UseDotNet@2
|
13 | 46 | displayName: 'Import .NET Core SDK ($(DotNet.Sdk.VersionBC))'
|
14 | 47 | inputs:
|
|
0 commit comments