How to mount storage account in Databricks



mount storage account in Databricks

  • mount
    • Please find the below video for reference and below code .

 


client_id               = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
tenant_id               = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
client_secret           = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
storage_account_name    = "sabloblargefiles"


configs = {"fs.azure.account.auth.type": "OAuth",
           "fs.azure.account.oauth.provider.type": "org.apache.hadoop.fs.azurebfs.oauth2.ClientCredsTokenProvider",
           "fs.azure.account.oauth2.client.id": f"{client_id}",
           "fs.azure.account.oauth2.client.secret": f"{client_secret}",
           "fs.azure.account.oauth2.client.endpoint": f"https://login.microsoftonline.com/{tenant_id}/oauth2/token"}


dbutils.fs.mount(
  source = f"abfss://sourcefiles@{storage_account_name}.dfs.core.windows.net/",
  mount_point = f"/mnt/{storage_account_name}/sourcefiles",
  extra_configs = configs)



display(dbutils.fs.mounts())


display(dbutils.fs.ls("/mnt/sabloblargefiles/sourcefiles"))




Post a Comment