-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Data source key vault certificate #2898
Comments
@sirwayne there isn't a Data Source for this at this time; however we'll take this as a feature request for one :) |
@tombuildsstuff |
@sirwayne you can actually use the |
@hbuckle thanks, i will try this |
Is this a duplicate of #4554 ? |
Hi, just tried to data source with azurerm_key_vault_key, but it didn't return me the public key in Base64 as expected. {
"mode": "data",
"type": "azurerm_key_vault_key",
"name": "kv_key_cert1",
"provider": "provider.azurerm",
"instances": [
{
"schema_version": 0,
"attributes": {
"e": "AQAB",
"id": "https://kv-xxxxxx.vault.azure.net/keys/ssl-xxxxxx/xxxxxxxxx",
"key_opts": [
"sign",
"verify",
"wrapKey",
"unwrapKey"
],
"key_size": null,
"key_type": "RSA",
"key_vault_id": "/subscriptions/xxxxxx/resourceGroups/RG/providers/Microsoft.KeyVault/vaults/KV-xxxxxx",
"n": "5T0lkq5Z46QKwYnxxeruWsc_xxxxxx_Opbj9uExL9feLdY7cUgAHD1CX3VMEfO8Xv_xxxxxx...",
"name": "ssl-xxxxxx",
"tags": {
"CN": "xxxxxx"
},
"timeouts": null,
"vault_uri": "https://kv-xxxxxx.vault.azure.net/",
"version": "xxxxxxxxx"
}
}
]
} I'm expected a value like this -> Is it possible to get this value with |
You need to use |
Correct ;) Thanks for your response |
Any way to get .cer format of the certificate |
You can use certificate_data property of the key vault certificate. It returns the public of the certificate as hexadecimal string. (I don't know why :) ) If you need to get as base64, the workaround is using external provider to convert hexadecimal string to base64. I hope hexadecimal string to base64 conversion function will be developed in the future or base64 property provided |
Hi all, I seem to have hit a bit of a dead end with Key Vault Certificates too. In my case, I need to import a private key / PFX certificate from the Key Vault into a Batch Account. The azurerm_batch_certificate resource requires:
The problem I'm having is with injecting the base64 content. As far as the PFX certificate is concerned,
However...
@tombuildsstuff, any ideas? The lack of a straightforward / streamlined / more flexible way of handling certificates has also been brought up here, here and here. Best, |
It appears that you can download base64-encoded PFX certificate content via Azure CLI, see: Azure/azure-cli#7489 (comment) You can do this in terraform using the Azure Key Vault Secret data source.
|
Hi terminalstderr, Thanks although a procedure like the one you described won't be possible in general; the PFX certificate is created, maintained and injected into Azure resources as part of an automated pipeline. The requirement is no manual steps, so everything must happen within Terraform with no external intervention (that is, no extracting the base64 content by other means, either Azure CLI or locally on Powershell, etc).
|
@andreasolza, sorry I wasn't clearer, Terraform Azure provider does have the ability to download the base64-encoded PFX I think! 👍 I found the hack/workaround by reading about Azure CLI issues, but you should be able to use this Terraform code to download the PFX (according to Azure/azure-cli#7489 (comment)).
|
This is not working for me and wondering if anyone has any ideas. I can retrieve something via Confusingly, I can successfully execute I resorted to just dumping output from my TF script. I can see that the cert secret comes back as an object with several properties, the one of interest being Very confused and frustrated right now. Everything security related seems to be made so difficult. Any suggestions would be much appreciated. |
Ooooo....kkkk. My question prompted me to try assuming the So this "unadvertised" behavior of Azure KV stripping the password of an uploaded PFX is where I was getting lost. Hope that might help future travellers. |
This has been released in version 2.14.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example: provider "azurerm" {
version = "~> 2.14.0"
}
# ... other configuration ... |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
Community Note
Description
Hello,
i found no data source for the key vault certificate. I would like to read a ssl certificate which is stored in a key vault. Is this not possible?
The text was updated successfully, but these errors were encountered: