Reputation: 3057
I would like to retrieve content of a key that is on the Azure key vault via python. This block of code returns me the key properties, and not the content (I would like to have the binary content of the key):
from azure.identity import DefaultAzureCredential
from azure.keyvault.keys import KeyClient
credential = DefaultAzureCredential()
key_client = KeyClient(vault_url="https://my-key-vault.vault.azure.net/", credential=credential)
key = key_client.get_key("key-name")
print(key.name)
I have found this code for retrieving secrets from Key vault, but I need to retrieve the Key
How can I retrieve (binary) content of a key from azure keyvault?
Upvotes: 0
Views: 968
Reputation: 136146
How can I retrieve (binary) content of a key from azure keyvault?
Simple answer is that you cannot. Once a key is stored in KeyVault, its value cannot be retrieved. That's the whole purpose of storing a Key in a KeyVault.
Upvotes: 2