Databricks External Locations "Invalid Azure path" when listing files in ADLS container root

NS97631-0872 21 Reputation points
2022-09-28T19:20:57.72+00:00

I am running into an issue listing files in the root path of a container belonging to an ADLS Gen2 storage account on both Databricks runtime 11.2 and 10.4.

My workspace is connected to Unity Catalog and I created an external location called externalloc1 mapped to
abfss://******@storageaccount.dfs.core.windows.net

My user has "READ FILES" and "WRITE FILES" permission on externalloc1. The managed identity for Databricks has "Storage Blob Data Contributor" to the storage account.

I placed input folders and files in the root of the container. Running this command in a Python notebook on runtime 10.4 to list files and folders in the root raises an exception:

   %python  
   dbutils.fs.ls("abfss://******@storageaccount.dfs.core.windows.net/")  


   com.databricks.common.client.DatabricksServiceHttpClientException: INVALID_STATE: Invalid Azure path: abfss://******@storageaccount.dfs.core.windows.net  

Listing files in a folder works without issue:

   %python  
   dbutils.fs.ls("abfss://******@storageaccount.dfs.core.windows.net/data")  


   Out[4]: [FileInfo(path='abfss://******@storageaccount.dfs.core.windows.net/data/test.csv', name='test.csv', size=4, modificationTime=1664392087000)]  

Am I able to list files in the root of the container? I have seen references of other users listing files in the root of an external location on ADLS and S3 so I assume it would be possible.

Azure Data Lake Storage
Azure Data Lake Storage
An Azure service that provides an enterprise-wide hyper-scale repository for big data analytic workloads and is integrated with Azure Blob Storage.
1,562 questions
Azure Databricks
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
2,527 questions
{count} votes

1 answer

Sort by: Most helpful
  1. HimanshuSinha-msft 19,491 Reputation points Microsoft Employee Moderator
    2022-10-01T00:33:00.743+00:00

    Hello @NS97631-0872 ,
    Thanks for the question and using MS Q&A platform.
    As we understand the ask here is how to get the files and folder names on the root level of the container , please do let us know if its not accurate.

    I did tried the setop on my side and it jkust works fine for me

    246569-image.png

    I did tried out few things and it was behaving as expected . I started looking at the error merssage again "INVALID_STATE: Invalid Azure path:" , is it possible the name of the files/folder in the root is the culprit .
    I suggest you to try a different ADLS gen2 account and create few folders or files and check .

    Please do let me if you have any queries.
    Thanks
    Himanshu


    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
      • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.