Mount ADLS Gen2 Storage Using Linked Service in Azure Synapse Analytics | Azure Synapse Tutorial

Mount ADLS Gen2 Storage Using Linked Service in Azure Synapse Analytics

Mount ADLS Gen2 Storage Using Linked Service in Azure Synapse Analytics

📘 Overview

Azure Synapse Analytics allows you to securely connect to Azure Data Lake Storage Gen2 (ADLS Gen2) using a Linked Service. Once configured, you can easily access files using the abfss:// path format within Spark notebooks or pipelines.

🎯 Why Use Linked Service?

  • Centralized and secure credential management
  • Reuse connection across notebooks and pipelines
  • No need to hard-code credentials in code
  • Simplified access using friendly names and workspace integration

🛠️ Step-by-Step: Configure and Use Linked Service

✅ Step 1: Create Linked Service

  1. Go to your Synapse workspace
  2. Navigate to ManageLinked Services
  3. Click + New and choose Azure Data Lake Storage Gen2
  4. Enter a name (e.g., adls2-linked)
  5. Choose authentication method (Account Key, Service Principal, or Managed Identity)
  6. Test connection and click Create

✅ Step 2: Reference Storage in Notebooks

%%pyspark
df = spark.read.option("header", "true") \
    .csv("abfss://<container>@<storageaccount>.dfs.core.windows.net/path/to/data.csv")
df.show()

✅ Step 3: Access from Synapse Pipelines

Once the linked service is created, you can:

  • Use it in Copy Data and Data Flow activities
  • Browse ADLS files using the Synapse Studio UI

📦 Example abfss Path Format

abfss://raw@techbrothersadlsgen2.dfs.core.windows.net/sales/data.csv

📌 Tips

  • Use Managed Identity for enterprise security integration
  • Ensure Synapse workspace has Storage Blob Data Contributor access to ADLS
  • Use path autocompletion in notebooks for easy access

📺 Watch the Video Tutorial

📚 Credit: Content created with the help of ChatGPT.