In the earlier lessons, many examples used small DataFrames created directly inside a Databricks notebook. In a real data engineering project, source files usually live outside Databricks in cloud storage. On Azure, a common choice is Azure Data Lake Storage Gen2 (ADLS Gen2).
This lesson explains how Azure Databricks connects to ADLS Gen2 using the current Unity Catalog approach. You will create an ADLS Gen2 storage account, create a container, create an Azure Databricks Access Connector with a managed identity, grant that identity access to storage, register the identity in Unity Catalog, create an external location, and then use a Unity Catalog volume to work with files.
🚀 Learn It in 5 Minutes
Skip the long read.
See the key concepts in one easy-to-follow infographic.
Prerequisites
Before starting, make sure you have the following. Some steps require an Azure administrator or a Unity Catalog metastore administrator if your account does not have the required permissions.
- An active Azure subscription.
- An Azure Databricks workspace.
- The workspace must be attached to a Unity Catalog metastore.
- Permission to create an Azure storage account and an Access Connector, or an administrator who create them for you.
- Permission to assign Azure RBAC roles on the ADLS Gen2 storage account.
- Permission in Unity Catalog to create a storage credential and external location, or an administrator who can perform those steps.
- A Databricks compute resource that can run a notebook for the final test.
What Is Azure Data Lake Storage Gen2?
Azure Data Lake Storage Gen2 is Microsoft’s cloud storage service for large-scale data. It is built on Azure Blob Storage and adds a hierarchical namespace, which provides folder-like organization and file-system capabilities.
A storage account can contain one or more containers. A container is a top-level storage boundary where files and folders can be stored. For example, a container named raw might contain folders such as sales/2026/09/.
Why Does Databricks Need to Connect to ADLS Gen2?
Databricks compute is used to process data, but the data itself needs durable storage. ADLS Gen2 can store source files and other data that must remain available after a cluster or notebook session stops.
- Databricks reads source files from cloud storage.
- Databricks writes processed files and results to cloud storage.
- Unity Catalog can govern who is allowed to access those storage locations.
- Using Unity Catalog avoids putting long-lived storage secrets directly into notebooks.
Legacy Access vs. the Current Unity Catalog Approach
Older Databricks tutorials often show storage account keys, SAS tokens, service principals, Databricks secrets, dbutils.fs.mount(), and Spark configuration properties. These patterns are still useful to recognize when supporting older projects, but they are not the main approach used in this lesson.
| Approach | How access is handled | Use in this lesson |
| Storage account key | A storage account key is supplied to the workload. | Not used for the hands-on path. |
| SAS token | A scoped shared token is supplied to the workload. | Not used for the hands-on path. |
| Service principal + secret | Application identity authenticates with a client secret. | Legacy/background concept. |
| Unity Catalog + managed identity | Unity Catalog uses an Azure managed identity through an Access Connector and governs access with securable objects. | Recommended hands-on approach. |
Architecture Used in This Lesson
The complete flow is easier to understand when you see how the Azure and Databricks pieces connect.
Below image shows the architecture how to connect ADLS gen2 with azure databricks.

Hands-On Walkthrough: Connect Azure Databricks to ADLS Gen2
Step 1: Create an ADLS Gen2 Storage Account
Start in the Azure portal. You will create the storage account that will hold the files used in this lesson.
1. Open a web browser.
Open the Azure portal https://portal.azure.com/#home
Select Sign in.

2. Search for Storage accounts.
3. Select Create.
4. Select the Azure subscription you want to use.
5. Select an existing resource group or create a new one.
6. Enter a globally unique Storage account name. For example: <storageaccountname>.

7. Choose the region you want to use.
8. On the Advanced tab, find Hierarchical namespace.
9. Set Hierarchical namespace to Enabled.

10. Review the remaining settings and select Review + create.
11. After validation succeeds, select Create.
12. Wait until deployment finishes and open the new storage account.

Step 2: Create a Container
The container will act as the top-level location for the lesson’s files.
- In the storage account, select Data storage > Containers.

2. Select + Container.
3. Enter the container name: raw.
4. Select Create.

Step 3: Create an Access Connector for Azure Databricks
The Access Connector is an Azure resource that provides a managed identity that Unity Catalog can use to access your ADLS Gen2 storage. This removes the need to put a client secret in your notebook.
1. In the Azure portal, select Create a resource.
2. Search for Access Connector for Azure Databricks.


4. Choose the Azure subscription.
5. Choose the resource group where you want the Access Connector to live.
6. Enter an Access Connector name, for example: <access-connector-name>.
7. Select the appropriate region.
8. Use the system-assigned managed identity option for this beginner exercise unless your organization requires a user-assigned identity.

Simple comparison
| System-assigned | User-assigned | |
| Who creates it? | Azure creates it with the resource | You create it separately |
| Identity belongs to | One Azure resource | Separate reusable resource |
| Can multiple resources use it? | No | Yes |
| Deleted when resource is deleted? | Yes | No |
| Management | Simpler | More control/reuse |
| Beginner setup | Easier | More advanced |
A system-assigned managed identity is created and managed automatically by Azure for the Access Connector. A user-assigned managed identity is created separately and can be reused by multiple Azure resources. In this lesson, we use a system-assigned managed identity because it provides a simple way for the Access Connector to authenticate to ADLS Gen2 without storing credentials or secrets.
9. Review the configuration and select Create.
10. After deployment completes, open the Access Connector.
Step 4: Grant the Access Connector Permission on ADLS Gen2
Creating the managed identity is not enough. The identity must also be allowed to read and write data in the storage account. Azure RBAC controls this permission.
1. Open your ADLS Gen2 storage account.
2. Select Access Control (IAM).
3. Select Add > Add role assignment.

- On the role selection page, search for Storage Blob Data Contributor.
If you do not have permission to assign Azure roles, ask your Azure administrator to grant the Storage Blob Data Contributor role to the Access Connector for Azure Databricks on the storage account.
4. Select Storage Blob Data Contributor and select Next.
5. For Assign access to, select Managed identity.
6. Select + Select members.
7. Choose the subscription and select the Access Connector for Azure Databricks that you created.
10. Select Review + assign.
11. Complete the role assignment.
Optional: File Events Permissions
For the simple read/write test in this lesson, Storage Blob Data Contributor is the important data-access role. If you later enable Azure Databricks file events for an external location, additional Azure permissions may be required. Microsoft documents Storage Queue Data Contributor for subscribing to file event notifications and additional permissions when Azure Databricks is expected to configure the events automatically.
Step 5: Copy the Access Connector Resource ID
Unity Catalog needs the Access Connector resource ID when you create the storage credential.
1. Open the Access Connector resource in the Azure portal.
2. On the Overview page, locate Resource ID.
3. Copy the complete Resource ID and keep it temporarily in a safe place.
4. The value normally looks similar to the following:
| /subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.Databricks/accessConnectors/<access-connector-name> |

Step 6: Confirm Unity Catalog Is Available
Now move to your Azure Databricks workspace. The following steps require a Unity Catalog-enabled workspace.
- Open the Azure Databricks workspace.


2. In the left sidebar, select Catalog.
3. Confirm that Catalog Explorer opens and that you can see the catalogs available to your workspace.

4. If you do not see the required catalog or credential options, contact your Databricks administrator before continuing.
Step 7: Create a Storage Credential
A storage credential is a Unity Catalog object that represents the identity Unity Catalog uses to access cloud storage. In this lesson, the credential uses the Azure managed identity provided by the Access Connector.
1. In Catalog Explorer, select the create/add (+) option.
2. Select Create a credential.

- For Credential type, select Azure Managed Identity.

4. Enter a storage credential name, for example: azure_adls_dev
5. Paste the Access Connector Resource ID copied in Step 5 into Access Connector ID.
6. If your organization uses a user-assigned managed identity, enter its Managed Identity ID where required.
7. Select Create.
8. Wait for validation to complete.

Step 8: Create an External Location
An external location combines a storage credential with a specific cloud storage path. In this lesson, the path points to the raw container you created earlier.
1. In Catalog Explorer, select the create/add (+) option.
2. Select Create an external location.

3. Enter an external location name, E.g azure_f1_raw_dev
4. For Storage type, select Azure.
5. For URL, enter the ADLS Gen2 container path using this format:
| abfss://raw@<storage-account-name>.dfs.core.windows.net/ |
For Storage credential, select azure_adls_dev.

2. If your workspace shows file-event options, keep the default only if your organization has the required permissions and intends to use file events. For this basic lesson, the connection itself does not depend on file events.
3. Review the configuration.
4. Select Create.

abfss://<container>@<storage-account>.dfs.core.windows.net/<optional-folder>
Step 9: Grant Unity Catalog Permissions on the External Location
Creating an external location does not automatically give every user permission to use it. Unity Catalog permissions determine which users, groups, or service principals can use the location.
1. Open Catalog Explorer > External Locations.
2. Select azure_f1_raw_dev
3. Open the Permissions tab.
4. Select Grant.
5. Choose your user or the appropriate data-engineering group.
6. For a simple read/write file exercise, grant READ FILES and WRITE FILES as required by your organization’s access policy.
7. Remember that WRITE FILES requires READ FILES as well.
8. Select Grant.


Step 10: Create a Catalog and Schema for the Exercise
The external location protects the underlying cloud path. A Unity Catalog volume must live inside a catalog and schema. If your organization already provides a catalog and schema for labs, use those instead of creating new ones.
- In Catalog Explorer, select Create catalog.

- Create a catalog named: test_catalog.

If you are using a Serverless workspace, do not select “Use default storage.” Instead, select the external location created for this environment and specify the required storage path. Since you are using a Serverless workspace, leave Use default storage unchecked and select the required external location.
Leave the Subpath field blank if you want to use the root path of the selected external location.
- Open the new catalog and select Create schema.

4. Create a schema named: raw.
5. Make sure you have USE CATALOG and USE SCHEMA permissions for the objects you will use.


Step 11: Create an External Volume
Databricks recommends Unity Catalog volumes for managing non-tabular files in cloud object storage. An external volume is registered against a directory inside an external location.
1. Open test_catalog > raw.
2. Select Create > Volume.
3. Choose External volume.

4. Enter the volume name: raw_files.
5. For the location, use a subdirectory inside the external location. For example:
| abfss://raw@<storage-account-name>.dfs.core.windows.net/raw_files/ |

A Managed volume stores files in storage managed by Unity Catalog, while an External volume uses a storage location that we have already configured in ADLS Gen2. We select External volume because the files for this lesson are stored in our existing ADLS Gen2 external location. This allows Unity Catalog to govern access to files stored in that external storage location.
1. Select Create.
2. Open the newly created volume and confirm that its path is displayed.

Step 12: Access a File Stored in ADLS Gen2
- Create sampletest.csv locally.
- Upload sampletest.csv to the ADLS Gen2 folder used by your External Volume.
- In Databricks, open the Unity Catalog External Volume.
- Verify that sampletest.csv is visible.
Read the file from Databricks.
For example:
df = spark.read.option("header", "true").csv(
"/Volumes/test_catalog/raw/raw_files/sampletest.csv"
)
display(df)
The file lives in ADLS Gen2. Unity Catalog governs access to that storage, and Databricks reads the file through the External Volume.

Note: Step 13 demonstrates another way of working with the External Volume by uploading a test file
through Databricks. Because the External Volume points to an ADLS Gen2 location, the uploaded file is
stored in the underlying ADLS Gen2 storage. You can then verify the file from both Databricks and
Azure Storage.
Then Steps 14–15 can demonstrate write and read-back.
Step 13: Upload a Test File to the Volume
You will upload a small CSV file to the Unity Catalog external volume. The volume points to your ADLS
Gen2 storage location, so the file is ultimately stored in ADLS Gen2.
You are uploading the file through the Unity Catalog volume, not directly through the Azure Storage
portal. Because this is an External Volume, the file is physically stored in the underlying ADLS Gen2
location configured for the volume. External volumes provide Unity Catalog governance over existing
cloud-storage directories.
1. Create a small local CSV file named sampletest.csv with a few rows, for example columns id and name.
2. In the Databricks workspace, select New > Add or upload data.
3. Select Upload files to a volume.

4. Choose test_catalog > raw > raw_files as the destination.
5. Select your sample_test.csv file.
6. Wait for the upload to complete.
7. Open the volume and confirm that the file is visible.

Step 13: Read the File from a Databricks Notebook
Now create a notebook and read the file using the Unity Catalog volume path. Notice that there is no client secret, Spark OAuth configuration, or storage-account key in the notebook.
- Create or open a Databricks notebook.

2. Attach the notebook to an available compute resource.
3. Use the following code and replace the placeholders with your catalog, schema, volume, and file name.
file_path = "/Volumes/lesson19_catalog/raw/lesson19_files/lesson19_test.csv"
df = (
spark.read
.option("header", "true")
.option("inferSchema", "true")
.csv(file_path)
)
display(df)

Run the cell. The rows from the CSV file should be displayed.

Step 14: Write a Test File to the Volume
To confirm write access as well as read access, create a small DataFrame and write it to another folder in the volume.
test_df = spark.range(10).withColumnRenamed("id", "name")
output_path = "/Volumes/test_catalog/raw/lesson19_files/test_output"
(
test_df.write
.mode("overwrite")
.option("header", "true")
.csv(output_path)
)
print("Test file written successfully.")
1. Run the cell.
2. Open the raw_files volume in Catalog Explorer.
3. Confirm that the test_output directory was created.
4. If the write fails with PERMISSION_DENIED, return to Step 9 and verify WRITE FILES and READ FILES permissions.

Step 15: Read the Written Data Back
read_back_df = (
spark.read
.option("header", "true")
.csv("/Volumes/test_catalog/raw/raw_files/test_output")
)
display(read_back_df)
Finally, read the data that you just wrote. This verifies the complete read/write path.

What Happened Behind the Scenes?
1. The notebook requested access to a file under a Unity Catalog volume.
2. Unity Catalog checked the user’s permissions on the catalog, schema, and volume.
3. The volume is registered against a governed external storage location.
4. The external location uses a storage credential.
5. The storage credential uses the Azure managed identity provided by the Access Connector.
6. Azure RBAC allows that managed identity to access the ADLS Gen2 storage.
7. The file was therefore read or written without placing an Azure storage secret in the notebook.
Troubleshooting Common Errors
| Problem | What to check |
| Storage credential validation fails | Confirm the Access Connector Resource ID and verify Storage Blob Data Contributor on the correct storage account. |
| External location cannot be created | Confirm Unity Catalog is enabled and that your account has CREATE EXTERNAL LOCATION on the metastore and storage credential. |
| PERMISSION_DENIED when reading | Check READ FILES or the appropriate volume READ VOLUME permission and confirm USE CATALOG / USE SCHEMA. |
| PERMISSION_DENIED when writing | Check WRITE FILES plus READ FILES on an external location, or WRITE VOLUME on a volume. |
| External volume cannot be created | Confirm the target path is inside an external location and that you have CREATE EXTERNAL VOLUME. |
| Path does not exist | Check the catalog, schema, volume name, and file path. Volume paths use /Volumes/<catalog>/<schema>/<volume>/… |
| File-event warning appears | For this basic read/write exercise, file events are not the same thing as basic storage access. If file events are required, configure the additional Azure permissions documented by Databricks. |
| No Catalog / Credentials options | Ask the workspace administrator to confirm Unity Catalog/metastore configuration and your privileges. |
Legacy Pattern You May Still See
You may encounter older code such as dbutils.fs.mount(), Databricks secret scopes containing storage credentials, or Spark configuration properties for OAuth authentication. Do not assume that code is wrong simply because it is old, it may belong to a legacy project. The important point is that a new Unity Catalog-enabled implementation should normally be designed around Unity Catalog governance rather than adding new legacy mounts.
# Legacy-style example you may encounter in older projects
# This is intentionally shown only for recognition.
# Do not use it as the main implementation for this lesson.
dbutils.fs.mount(
source="wasbs://<container>@<storage-account>.blob.core.windows.net/",
mount_point="/mnt/<name>",
extra_configs={...}
)
Conclusion
Connecting Azure Databricks to ADLS Gen2 is a foundational step for real-world data engineering. The important idea is not just that Databricks can reach a storage account, but that the access should be governed and manageable.
In this lesson, you created an ADLS Gen2 storage account, created a container, created an Access Connector with a managed identity, granted Azure RBAC access, created a Unity Catalog storage credential and external location, created an external volume, and verified file read/write operations from a notebook.
The older direct-credential approach is useful background knowledge because you will still see it in existing projects. For new Unity Catalog-enabled Azure Databricks implementations, the current direction is centralized governance through Unity Catalog and managed identities.
| Tags | Connecting Azure Databricks to Azure Data Lake Storage Gen2 Using Unity Catalog |
| Databricks Link | |
| Microsoft Link | |
|
Test Your Knowledge |
Quiz |
