|
11 | 11 | vmImage: ${{ parameters.imageName }}
|
12 | 12 | displayName: ${{ parameters.displayName }}
|
13 | 13 | steps:
|
| 14 | + - ${{ parameters.powershellExecutable }}: | |
| 15 | + Install-Module -Name 'Microsoft.PowerShell.SecretManagement' -force -SkipPublisherCheck -AllowClobber |
| 16 | + Install-Module -Name 'Microsoft.PowerShell.SecretStore' -force -SkipPublisherCheck -AllowClobber |
| 17 | + $vaultPassword = ConvertTo-SecureString $("a!!"+ (Get-Random -Maximum ([int]::MaxValue))) -AsPlainText -Force |
| 18 | + Set-SecretStoreConfiguration -Authentication None -Interaction None -Confirm:$false -Password $vaultPassword |
| 19 | + Register-SecretVault -Name SecretStore -ModuleName Microsoft.PowerShell.SecretStore -DefaultVault |
| 20 | + displayName: Install Secret store |
| 21 | +
|
14 | 22 | - task: DownloadBuildArtifacts@0
|
15 | 23 | displayName: 'Download artifacts'
|
16 | 24 | inputs:
|
|
53 | 61 | displayName: Install module for test from downloaded artifact
|
54 | 62 | workingDirectory: ${{ parameters.buildDirectory }}
|
55 | 63 |
|
| 64 | + - task: AzurePowerShell@5 |
| 65 | + inputs: |
| 66 | + azureSubscription: PSResourceGetACR |
| 67 | + azurePowerShellVersion: LatestVersion |
| 68 | + ScriptType: InlineScript |
| 69 | + pwsh: true |
| 70 | + inline: | |
| 71 | + Write-Verbose -Verbose "Getting Azure Container Registry" |
| 72 | + Get-AzContainerRegistry -ResourceGroupName 'PSResourceGet' -Name 'psresourcegettest' | Select-Object -Property * |
| 73 | + Write-Verbose -Verbose "Setting up secret for Azure Container Registry" |
| 74 | + $azt = Get-AzAccessToken |
| 75 | + $tenantId = $azt.TenantID |
| 76 | + Set-Secret -Name $tenantId -Secret $azt.Token -Verbose |
| 77 | + $vstsCommandString = "vso[task.setvariable variable=TenantId]$tenantId" |
| 78 | + Write-Host "sending " + $vstsCommandString |
| 79 | + Write-Host "##$vstsCommandString" |
| 80 | + displayName: 'Setup Azure Container Registry secret' |
| 81 | + |
56 | 82 | - ${{ parameters.powershellExecutable }}: |
|
57 | 83 | $modulePath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'TempModules'
|
58 | 84 | $env:PSModulePath = $modulePath + [System.IO.Path]::PathSeparator + $env:PSModulePath
|
|
68 | 94 | workingDirectory: ${{ parameters.buildDirectory }}
|
69 | 95 | errorActionPreference: continue
|
70 | 96 | condition: succeededOrFailed()
|
71 |
| -
|
|
0 commit comments