Mariano_IrvinLo
New Contributor II

If you use scala to mount a gen 2 data lake you could try something like this

/Gather relevant Keys/

var ServicePrincipalID = ""

var ServicePrincipalKey = ""

var DirectoryID = ""

/Create configurations for our connection/

var configs = Map ("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" -> ServicePrincipalID,

"fs.azure.account.oauth2.client.secret" -> ServicePrincipalKey, "fs.azure.account.oauth2.client.endpoint" -> DirectoryID)

// Optionally, you can add <directory-name> to the source URI of your mount point.

if (dbutils.fs.mounts.map(mnt => mnt.mountPoint).contains("/mnt/ventas")){

"already mount"

}else{

dbutils.fs.mount( source = "/", mountPoint = "/mnt/", extraConfigs = configs) }