Skip to content

Instantly share code, notes, and snippets.

@7effrey89
Last active December 9, 2025 09:08
Show Gist options
  • Select an option

  • Save 7effrey89/8c49173e8fed40cd7098ec94ebd2e047 to your computer and use it in GitHub Desktop.

Select an option

Save 7effrey89/8c49173e8fed40cd7098ec94ebd2e047 to your computer and use it in GitHub Desktop.
Fabric - Keyvault integration
KEYVAULT_NAME = "https://atpkvdemo.vault.azure.net"
SECRET_NAME = "adslgen2key"
# get access token for keyvault resource
# you can also use full audience here like https://vault.azure.net
accountKey = notebookutils.credentials.getSecret(KEYVAULT_NAME, SECRET_NAME)
#use secret with the storage account primary access key
notebookutils.fs.mount(
"abfss://mycontainer@amlwsatp0010067670284.blob.core.windows.net",
"/myAdslMount",
{"accountKey":accountKey}
)
#File read
with open(notebookutils.fs.getMountPath('/myAdslMount') + "/FOD.csv", "r") as f:
print(f.read())
#File write
# with open(notebookutils.fs.getMountPath('/Dst') + "/myFile.txt", "w") as f:
# print(f.write("dummy data"))
# Unmount
# notebookutils.fs.unmount("/myAdsl")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment