How to Create Your First Azure Synapse Notebook | Step-by-Step Tutorial for Synapse Analytics

How to Create Your First Azure Synapse Notebook

How to Create Your First Azure Synapse Notebook

📘 What is a Synapse Notebook?

An Azure Synapse Notebook is an interactive development environment inside Synapse Studio where you can run data exploration, transformation, and analytics workloads using Spark. You can write code in PySpark, SQL, Scala, or .NET.

🧰 Use Cases for Synapse Notebooks

  • Data exploration on Data Lake or SQL Pools
  • Machine learning experiments
  • ETL and data processing using Spark
  • Running parameterized reports and scripts

🛠️ Steps to Create Your First Notebook

✅ Step 1: Launch Synapse Studio

Go to your Synapse workspace in the Azure portal and click Open Synapse Studio.

✅ Step 2: Create a New Notebook

  • Navigate to the Develop tab.
  • Click on the + icon → Notebook.

✅ Step 3: Add and Configure Code Cells

  • Select the language for each cell (e.g., %%pyspark, %%sql).
  • Write your logic in the cell and run it using the play ▶️ button.

✅ Step 4: Attach Spark Pool

Choose a configured Apache Spark Pool at the top to run the notebook.

✅ Step 5: Save and Organize

Click Save As to name and store your notebook inside a Synapse folder.

💡 Tips

  • You can switch languages in each cell using %%sql, %%pyspark, etc.
  • Use markdown cells for annotations: click “+ Text” to add headings, notes, etc.
  • Notebooks can be integrated into Synapse Pipelines for orchestration.

🔍 Example PySpark Cell

%%pyspark
df = spark.read.csv('abfss://data@storageaccount.dfs.core.windows.net/sample.csv', header=True)
df.show()

📈 Example SQL Cell

%%sql
SELECT TOP 10 * FROM mytable

📦 Save & Share

You can export notebooks as .ipynb or .json files and share them across teams. Use Git integration in Synapse Studio for version control.

📺 Watch the Video Tutorial

📚 Credit: Content created with the help of ChatGPT and Gemini.