An Apache Spark-based analytics platform optimized for Azure.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
How to open a password protected .zip file using databricks, where password is stored in key vault.
Hello NIKHIL KUMAR,
Welcome to the MS Q&A platform.
First you need to create a Secret scope at databricks: https://<Databricks link>#secrets/createScope
once you create the secret scope databricks will linked to keyvalut.
You can use the below script
# Import necessary libraries import zipfile from azure.keyvault.secrets import SecretClient from azure.identity import DefaultAzureCredential # Set up Key Vault client credential = DefaultAzureCredential() key_vault_url = "https://<your-key-vault-name>.vault.azure.net/" secret_name = "<your-secret-name>" secret_client = SecretClient(vault_url=key_vault_url, credential=credential) # Retrieve the password from Key Vault password_secret = secret_client.get_secret(secret_name) password = password_secret.value # Open the password-protected .zip file with zipfile.ZipFile("/dbfs/path/to/your/file.zip") as zip_file: zip_file.extractall(pwd=bytes(password, 'utf-8'))
I hope this helps.
Hello Nikhil kumar,
I am checking to see if you got a chance to look into my earlier response.