{"library":"adlfs","code":"import os\nfrom adlfs import AzureBlobFileSystem\n\n# Recommended: Use environment variables for credentials\n# e.g., AZURE_STORAGE_ACCOUNT_NAME, AZURE_STORAGE_ACCOUNT_KEY, AZURE_STORAGE_SAS_TOKEN\n# For DefaultAzureCredential, ensure AZURE_STORAGE_ACCOUNT_NAME is set and anon=False\n\naccount_name = os.environ.get('AZURE_STORAGE_ACCOUNT_NAME', 'your_account_name')\n# For demonstration, using anonymous access to a public container\n# In real scenarios, provide proper credentials (account_key, sas_token, or use anon=False)\nfs = AzureBlobFileSystem(account_name=account_name, anon=True)\n\n# Example: List contents of a public container\ncontainer_name = \"azureopendatastorage\" # A known public container\npath_to_list = f\"az://{container_name}/\" \n\ntry:\n    print(f\"Listing contents of {path_to_list}:\")\n    contents = fs.ls(path_to_list, detail=False)\n    for item in contents[:5]: # Print first 5 items\n        print(item)\n    if not contents: print(\"Container is empty or access denied (check credentials/permissions).\")\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n    print(\"Please ensure 'AZURE_STORAGE_ACCOUNT_NAME' is set, or if accessing a private container, provide valid credentials.\")\n\n# Example: Read a file (requires appropriate permissions)\n# Replace with a real path if you have authenticated access\n# file_path = f\"az://{container_name}/path/to/your/file.txt\"\n# try:\n#     with fs.open(file_path, 'rb') as f:\n#         data = f.read()\n#         print(f\"\\nContent of {file_path[:50]}...: {data.decode()[:100]}...\")\n# except Exception as e:\n#     print(f\"\\nCould not read file {file_path[:50]}...: {e}\")","lang":"python","description":"This quickstart demonstrates how to initialize `adlfs.AzureBlobFileSystem` and list contents of a public Azure Blob Storage container. For private containers, authentication relies on `storage_options` parameters (like `account_key`, `sas_token`, `connection_string`, or service principal details) or automatic credential resolution via `DefaultAzureCredential` (by setting `anon=False` and ensuring `AZURE_STORAGE_ACCOUNT_NAME` is set).","tag":null,"tag_description":null,"last_tested":"2026-04-24","results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":-1},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":-1},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":-1},{"runtime":"python:3.13-alpine","exit_code":0},{"runtime":"python:3.13-slim","exit_code":-1},{"runtime":"python:3.9-alpine","exit_code":0},{"runtime":"python:3.9-slim","exit_code":-1}]}