'How to get list of Containers present in Azure using DataLakeServiceClient in python

from azure.storage.filedatalake import DataLakeServiceClient
service_client = DataLakeServiceClient(account_url="{}://{}.dfs.core.windows.net".format(
            "https", storage_account_name), credential=storage_account_key)
containers = service_client.list_containers() 
for c in containers: 
      print (c.name)

But I am Getting an error like this:

AttributeError: 'DataLakeServiceClient' object has no attribute 'list_containers'


Solution 1:[1]

service_client = DataLakeServiceClient(account_url="{}://{}.dfs.core.windows.net".format(
            "https", storage_account_name), credential=storage_account_key)
containers = service_client.list_file_systems() 
for c in containers: 
      print (c.name)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Shanavas M