Skip to content

Commit

Permalink
fix: improve verbosity of certificate upload to Key Vault (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickmoore-nc authored Jan 8, 2025
1 parent 3fc5775 commit 5cc7639
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,9 @@ while [[ $# -gt 0 ]]; do
# Key Vault doesn't check thumbprints, and will create a new version even if the thumbprint is identical, causing unnecessary downstream Terraform changes where the cert is used
thumbprint64_kv=$(az keyvault certificate show --vault-name "${kv_name}" --name "${cert_name}" --query "x509Thumbprint" --output tsv || true) # continue on failure
if [[ "${thumbprint64_local}" == "${thumbprint64_kv}" ]]; then
echo "Certificate ${cert_name} with thumbprint ${thumbprint_local} already exists in Key Vault ${kv_name}, skipping import."
echo "Certificate ${cert_name} with thumbprint ${thumbprint_local} already exists in Key Vault ${kv_name}, skipping import..."
else
echo "Importing certificate ${cert_name} into Key Vault ${kv_name}..."
openssl pkcs12 -export -inkey certbot/config/live/${trimmed_domain}/privkey.pem -in certbot/config/live/${trimmed_domain}/fullchain.pem -out ${trimmed_domain}.pfx -password pass:
az keyvault certificate import --vault-name "${kv_name}" --name "${cert_name}" --file "${trimmed_domain}.pfx" --password ""
fi
Expand Down

0 comments on commit 5cc7639

Please sign in to comment.