1 | initial version |
Key Vault can be utilized to access Azure blob storage in Databricks by following these steps:
dbutils.secrets.get
command to retrieve the storage account key from the Key Vault.Here's an example code snippet that shows how to utilize Key Vault to access Azure blob storage in Databricks:
# Import the Azure Blob Storage Connector
from azure.storage.blob import BlobServiceClient
# Retrieve the storage account key from Key Vault
storage_account_key = dbutils.secrets.get(scope="<Key Vault Scope>", key="<Storage Account Key Secret Name>")
# Connect to Blob Storage using the storage account name and retrieved key
blob_service_client = BlobServiceClient(account_url="https://<Storage Account Name>.blob.core.windows.net", credential=storage_account_key)
# List the containers in the Blob Storage account
containers = blob_service_client.list_containers()
for container in containers:
print(container.name)
Note: Replace <Key Vault Scope>
, <Storage Account Key Secret Name>
, and <Storage Account Name>
with your specific values.