Created
May 12, 2020 11:27
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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