# Databricks notebook source
storage_account_name = "storageaccount20210929"
client_id            = "715c262c-06bf-422a-82a1-90157d201641"
tenant_id            = "b09fc1e7-af5e-4bb6-8226-79c4c3df0391"
client_secret        = "FTA7Q~UHmjsV4~w2~k2k3loaXDjW6acBcgumX"

# COMMAND ----------

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"}

# COMMAND ----------

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

# COMMAND ----------

dbutils.fs.ls(f"/mnt/{storage_account_name}/{container_name}")

# COMMAND ----------

dbutils.fs.mounts()

# COMMAND ----------

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

# COMMAND ----------

mount_adls("f1-data-processed")

# COMMAND ----------

dbutils.fs.ls("/mnt/storageaccount20210929/f1-data-processed")
