Unable to mount Azure Data Lake Storage Gen1 account

Learn how to resolve errors that occur when mounting Azure Data Lake Storage Gen1 to Databricks.

Written by Adam Pavlacka

Last published at: February 25th, 2022

Problem

When you try to mount an Azure Data Lake Storage (ADLS) Gen1 account on Databricks, it fails with the error:

com.microsoft.azure.datalake.store.ADLException: Error creating directory /
Error fetching access token
Operation null failed with exception java.io.IOException : Server returned HTTP response code: 401 for URL: https://login.windows.net/18b0b5d6-b6eb-4f5d-964b-c03a6dfdeb22/oauth2/token
Last encountered exception thrown after 5 tries. [java.io.IOException,java.io.IOException,java.io.IOException,java.io.IOException,java.io.IOException]
 [ServerRequestId:null]
at com.microsoft.azure.datalake.store.ADLStoreClient.getExceptionFromResponse(ADLStoreClient.java:1169)
at com.microsoft.azure.datalake.store.ADLStoreClient.createDirectory(ADLStoreClient.java:589)
at com.databricks.adl.AdlFileSystem.mkdirs(AdlFileSystem.java:533)
At com.databricks.backend.daemon.data.client.DatabricksFileSystemV2$$anonfun$mkdirs$1$$anonfun$apply$mcZ$sp$7$$anonfun$apply$mcZ$sp$8.apply$mcZ$sp(DatabricksFileSystemV2.scala:638)

Cause

This error can occur if the ADLS Gen1 account was previously mounted in the workspace, but not unmounted, and the credential used for that mount subsequently expired. When you try to mount the same account with a new credential, there is a conflict between the expired and new credentials.

Solution

You need to unmount all existing mounts, and then create a new mount with a new, unexpired credential.

For more information, see Mount Azure Data Lake Storage Gen1 with DBFS (AWS) and Mount Azure Data Lake Storage Gen1 with DBFS (Azure).