Skip to content

Instantly share code, notes, and snippets.

@finesse-fingers
Created May 12, 2020 11:27
Show Gist options
  • Save finesse-fingers/72d2cde3219e7d9555c080204ebbb8d5 to your computer and use it in GitHub Desktop.
Save finesse-fingers/72d2cde3219e7d9555c080204ebbb8d5 to your computer and use it in GitHub Desktop.
Pscore snippet checking to see if a secret exists in azure keyvault
# check to see if secret exists in keyvault, otherwise throw error
$SecretName = "HttpClientConfiguration--ApiKey"
$doesExist=$(az keyvault secret show `
--vault-name $KeyVaultName `
--name $SecretName `
--query id -o tsv)
if ($doesExist) {
echo "Secret '$SecretName' found in vault '$KeyVaultName' OK"
} else {
echo "Expecting secret '$SecretName' to be in vault '$KeyVaultName'"
exit 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment