diff --git a/Actions/ReadSecrets/ReadSecretsHelper.psm1 b/Actions/ReadSecrets/ReadSecretsHelper.psm1 index caa10acd0..4f7b48044 100644 --- a/Actions/ReadSecrets/ReadSecretsHelper.psm1 +++ b/Actions/ReadSecrets/ReadSecretsHelper.psm1 @@ -26,7 +26,6 @@ function GetAzureCredentials { return $null } - function MaskValue { Param( [string] $key, @@ -119,6 +118,16 @@ function GetKeyVaultCredentials { $creds = $null } } + if ($creds) { + try { + # check that we have access to get secrets from the keyvault by trying to get a dummy secret + GetKeyVaultSecret -secretName 'algodummysecret' -keyVaultCredentials $creds -encrypted | Out-Null + } + catch { + Write-Host "Unable to get secrets from Azure Key Vault. Error was $($_.Exception.Message). Using Github secrets instead." + $creds = $null + } + } return $creds } diff --git a/RELEASENOTES.md b/RELEASENOTES.md index d3d2a363f..0c55fefbc 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -10,6 +10,7 @@ - Fix issue with github ref when running reusable workflows - Issue 1098 Support for specifying the name of the AZURE_CREDENTIALS secret by adding a AZURE_CREDENTIALSSecretName setting - Fix placeholder syntax for git ref in PullRequestHandler.yaml +- Issue 1164 Getting secrets from Azure key vault fails in Preview ### Dependencies to PowerShell modules