Skip to content

Commit

Permalink
another custom secrets back
Browse files Browse the repository at this point in the history
  • Loading branch information
eriqua committed Sep 5, 2024
1 parent 00116dc commit 63cc4d9
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/actions/templates/avm-validateModuleDeployment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,23 @@ runs:
}
}
# Fetch & add custom secrets, if any
# -----------------------------------
$keyVaultName = "${{ env.CI_KEY_VAULT_NAME }}"
if(-not [String]::IsNullOrEmpty($keyVaultName)) {
# Note: This action requires at least 'Key Vault Secrets User' permissions
$customKeyVaultSecrets = Get-AzKeyVaultSecret -VaultName $keyVaultName | Where-Object { $_.Name -match '^CI-.+' }
foreach($customSecret in $customKeyVaultSecrets) {
$formattedName = $customSecret.Name -replace '^CI-' # e.g. 'CI-mySecret' -> 'mySecret'
if($moduleTemplatePossibleParameters -contains $formattedName) {
Write-Verbose ('Setting value for parameter [{0}]' -f $formattedName) -Verbose
$functionInput.AdditionalParameters += @{
$formattedName = (Get-AzKeyVaultSecret -VaultName $keyVaultName -Name $customSecret.Name).SecretValue
}
}
}
}
Write-Verbose 'Invoke task with' -Verbose
Write-Verbose ($functionInput | ConvertTo-Json | Out-String) -Verbose
Expand Down

0 comments on commit 63cc4d9

Please sign in to comment.