Microsoft Fabric (Part 4)

Neil Haddley • November 28, 2026

I followed Microsoft's tutorial for a Fabric data agent over AdventureWorks, then asked it all of Microsoft's own questions in two setups: the tutorial's and one with its example queries and corrected instructions. I checked the answers against my own SQL, published the agent and called it over MCP.

AzureAIfabric-data-agentlakehouseadventureworksnatural-language-querycapacity

In Part 1 I built a Lakehouse, in Part 2 I linked Dataverse to Fabric, and in Part 3 I streamed events into an Eventhouse. In this part I follow Microsoft's end-to-end tutorial for a Fabric data agent. A data agent lets someone ask a question in plain English and get an answer from tables in a Lakehouse.

A data agent needs a paid F2 capacity, and the free trial could not create one. This post covers the capacity, the build, Microsoft's eight questions asked in two setups, and publishing the agent and calling it over MCP.

The capacity

An F2 is the smallest paid Fabric capacity. Azure bills it by the second while it runs, and I can delete it afterwards. Microsoft's tutorial says a data agent needs an F2 or higher, or a Power BI Premium P1 or higher. Many regions showed a quota of 0 for my subscription, so I used Sweden Central, which had room for 16 capacity units.

Creating the F2 in the portal

I had no Fabric capacities, so the Microsoft Fabric page in the Azure portal was empty.

No Microsoft Fabric capacities to display

No Microsoft Fabric capacities to display

I clicked Create. The form defaults to East US.

The empty Create Fabric capacity form

The empty Create Fabric capacity form

The region list. I chose Sweden Central

The region list. I chose Sweden Central

The form then showed an F64, the default size, with Capacity Overage Protection switched on and a threshold of 384 capacity-unit hours.

The default: F64, 64 capacity units, with overage protection on

The default: F64, 64 capacity units, with overage protection on

The size list, with its estimated monthly cost for each size

The size list, with its estimated monthly cost for each size

F2, 2 capacity units. Overage protection was still on

F2, 2 capacity units. Overage protection was still on

Overage protection off. The administrator field already held my account

Overage protection off. The administrator field already held my account

A new resource group, rg-fabric-data-agent-2, and the capacity name fabdataagent2

A new resource group, rg-fabric-data-agent-2, and the capacity name fabdataagent2

Review and create: F2, Sweden Central, an estimate of $277.40 a month, overage off

Review and create: F2, Sweden Central, an estimate of $277.40 a month, overage off

The deployment started at 5:40:15 AM in the portal's local time, which is 18:40 UTC

The deployment started at 5:40:15 AM in the portal's local time, which is 18:40 UTC

What the F2 cost

Capacity created18:40:13 UTC
Capacity deletedabout 19:32 UTC
Time it ranabout 52 minutes
List price in Sweden Central$0.19 per capacity unit per hour
An F2 has2 capacity units, so about $0.38 an hour
Compute for the runabout $0.33

These figures are my calculations from Microsoft's public price list, not figures from my bill. Copilot and AI usage has its own meter in Azure's price list, and I have not read my Azure cost report yet, so the real figure may be higher.

Create a workspace on the capacity

I created a new workspace, Data Agent Tutorial, and chose the Fabric workspace type. The capacity box offered the new F2.

The Create a workspace pane

The Create a workspace pane

The F2 listed as the capacity

The F2 listed as the capacity

The empty workspace

The empty workspace

Load the AdventureWorks sample

The tutorial loads the AdventureWorks sample with a notebook. I created a notebook and added a new Lakehouse called AdventureWorksLH.

New item, then Notebook

New item, then Notebook

I named the notebook LoadAdventureWorks

I named the notebook LoadAdventureWorks

The empty notebook, with no data sources

The empty notebook, with no data sources

I chose Add data items, then New lakehouse

I chose Add data items, then New lakehouse

I named the lakehouse AdventureWorksLH

I named the lakehouse AdventureWorksLH

I pasted the tutorial's code into the cell. It downloads 28 tables from a Microsoft web address and saves each one as a Lakehouse table.

The tutorial's loading code in the first cell, with the lakehouse attached

The tutorial's loading code in the first cell, with the lakehouse attached

This is the code I pasted:

PYTHON
1import pandas as pd
2from tqdm.auto import tqdm
3base = "https://synapseaisolutionsa.z13.web.core.windows.net/data/AdventureWorks"
4
5# load list of tables
6df_tables = pd.read_csv(f"{base}/adventureworks.csv", names=["table"])
7
8for table in (pbar := tqdm(df_tables['table'].values)):
9    pbar.set_description(f"Uploading {table} to lakehouse")
10
11    # download
12    df = pd.read_parquet(f"{base}/{table}.parquet")
13
14    # save as lakehouse table
15    spark.createDataFrame(df).write.mode('overwrite').saveAsTable(table)

I clicked Run all.

The notebook running, uploading one table after another

The notebook running, uploading one table after another

28 of 28 uploaded. The command ran for 5 minutes 24 seconds

28 of 28 uploaded. The command ran for 5 minutes 24 seconds

I stopped the Spark session, as the tutorial's own warning says to, because a running session keeps using capacity

I stopped the Spark session, as the tutorial's own warning says to, because a running session keeps using capacity

Create the data agent

I created the agent after the load had finished.

I named the agent AdventureWorksAgent

I named the agent AdventureWorksAgent

The page offers an ontology, a data source or AI search

The page offers an ontology, a data source or AI search

I chose Add a data source and picked AdventureWorksLH from the OneLake catalog.

Two lakehouses called AdventureWorksLH

Two lakehouses called AdventureWorksLH

The source added to the agent

The source added to the agent

The schema tree loaded with all the tables

The schema tree loaded with all the tables

Select the tables and add instructions

The tutorial selects ten tables. I ticked them in the explorer: dimcustomer, dimdate, dimgeography, dimproduct, dimproductcategory, dimpromotion, dimreseller, dimsalesterritory, factinternetsales and factresellersales.

Ticking the dimension tables

Ticking the dimension tables

Ticking the fact tables

Ticking the fact tables

The ten tutorial tables ticked

The ten tutorial tables ticked

I then pasted the tutorial's instructions into the Agent instructions pane. They say the data source contains information from three tables and name dimcustomer, dimdate and dimgeography.

The tutorial's instructions

The tutorial's instructions

This is the text I pasted:

TEXT
1The AdventureWorksLH data source contains information from three tables:
2
3- dimcustomer, for detailed customer demographics and contact information
4- dimdate, for date-related data - for example, calendar and fiscal information
5- dimgeography, for geographical details including city names and country region codes.
6
7Use this data source for queries and analyses that involve customer details, time-based events, and geographical locations.

The questions: all of Microsoft's, in order

I wanted to test the agent on Microsoft's own questions, not my own. Microsoft's documentation gives seven. I added an eighth of my own that names a table and has a checkable answer.

#QuestionWhere it comes from
1Calculate the average percentage increase in sales amount for repeat purchases for every zipcode. Repeat purchase is a purchase subsequent to the first purchase (the average should always be computed relative to the first purchase)The tutorial
2Show the monthly total and year-to-date total sales. Order by year and month.The tutorial
3What were our total sales in California in 2023?Create a Fabric data agent
4What are the top 5 products with the highest list prices, and what are their categories?Create a Fabric data agent
5What are the most expensive items that have never been sold?Create a Fabric data agent
6Why is our factory productivity lower in Q2 2024?Create a Fabric data agent, as a question the agent cannot answer
7What is the root cause of our sales spike?Create a Fabric data agent, as a question the agent cannot answer
8What is the total sales amount in factinternetsales by sales territory country?Mine

I ran them in two rounds. In Round A the agent had the tutorial's setup exactly: the three-table instructions and no example queries. In Round B I added the tutorial's two example queries, ticked the missing table and corrected the instructions. I cleared the chat before every question, because Microsoft's concept page says earlier chat history can influence later answers.

For each answer I opened the response, then Steps completed, then the step's chevron, then Show input. That shows the SQL the agent generated.

Round A: the tutorial's setup

Question 8: my table-naming question
PROMPT
1What is the total sales amount in factinternetsales by sales territory country?
Six countries, answered in 14 seconds

Six countries, answered in 14 seconds

The SQL it generated, with the output beneath it

The SQL it generated, with the output beneath it

I checked the numbers with my own SQL over the SQL endpoint, using sqlcmd:

SQL
1SELECT t.SalesTerritoryCountry, SUM(f.SalesAmount) AS total
2FROM dbo.factinternetsales f
3JOIN dbo.dimsalesterritory t ON f.SalesTerritoryKey = t.SalesTerritoryKey
4GROUP BY t.SalesTerritoryCountry
5ORDER BY total DESC
CountryAgentMy SQL
United States9,389,789.949,389,789.94
Australia9,061,000.729,061,000.72
United Kingdom3,391,712.243,391,712.24
Germany2,894,312.362,894,312.36
France2,644,017.742,644,017.74
Canada1,977,844.891,977,844.89

All six matched to the cent. The agent's own SQL joined factinternetsales to dimsalesterritory, the same join as mine.

Question 2: monthly and year-to-date totals
PROMPT
1Show the monthly total and year-to-date total sales. Order by year and month.
It listed 38 months, from December 2010 to January 2014, in 16 seconds

It listed 38 months, from December 2010 to January 2014, in 16 seconds

Its SQL summed factinternetsales only

Its SQL summed factinternetsales only

The agent used only internet sales. My SQL for the tutorial's own example gave the same figures, for example 43,421.04 for December 2010 and 16,351,550.34 as the 2013 year-to-date total. The question says "sales" and the lakehouse also has reseller sales, so the agent made a choice. It did not tell me it had made one.

Question 4: top five products
PROMPT
1What are the top 5 products with the highest list prices, and what are their categories?
A refusal after 13 seconds

A refusal after 13 seconds

The step reported "Unable to generate code" because the question looked irrelevant to the data schema

The step reported "Unable to generate code" because the question looked irrelevant to the data schema

The agent had dimproduct ticked, but my instructions named only three tables, and it behaved as though those were all it had.

Question 3: sales in California in 2023
PROMPT
1What were our total sales in California in 2023?
It said there were no sales tables, after 17 seconds

It said there were no sales tables, after 17 seconds

That was wrong. Both sales fact tables were ticked. Only the instructions made the agent say there were none.

Question 5: the most expensive items never sold
PROMPT
1What are the most expensive items that have never been sold?
Twenty products in 16 seconds, from the HL Road Frame at 1,431.50 down to 540.75

Twenty products in 16 seconds, from the HL Road Frame at 1,431.50 down to 540.75

It used NOT EXISTS against both factinternetsales and factresellersales

It used NOT EXISTS against both factinternetsales and factresellersales

This answered correctly even though the instructions never mentioned dimproduct or either fact table. The agent found them in the ticked schema. I checked the first ten rows against my own SQL and they matched. I did not check rows 11 to 20.

Questions 6 and 7: the two it should not be able to answer
PROMPT
1Why is our factory productivity lower in Q2 2024?
A refusal that asked me for production data, after 10 seconds

A refusal that asked me for production data, after 10 seconds

That is the right behaviour. The data has no factory records and ends in 2014.

PROMPT
1What is the root cause of our sales spike?
It named a root cause after 46 seconds

It named a root cause after 46 seconds

This is the one I did not expect. The data has no information about causes and I never said which spike I meant. The agent still stated that "a structural increase in online demand driven by a surge in new and returning internet customers" was the root cause, starting in early 2013. It then said that finding the business root cause would need marketing and product information. It gave a confident answer first and a caveat second.

Question 1: the tutorial's repeat-purchase question
PROMPT
1Calculate the average percentage increase in sales amount for repeat purchases for every zipcode. Repeat purchase is a purchase subsequent to the first purchase (the average should always be computed relative to the first purchase)
After 27 seconds it gave a list of zip codes, then a limitation

After 27 seconds it gave a list of zip codes, then a limitation

The SQL ranks each customer's orders by OrderDate, then by SalesOrderNumber

The SQL ranks each customer's orders by OrderDate, then by SalesOrderNumber

The agent said the data it received "was truncated to the first 200 zipcodes". It told me, which I value, but it means the answer is incomplete. The agent's tool returns a limited number of rows. My own checks found 289 zip codes with at least one repeat purchase.

The agent also broke ties between orders on the same day by SalesOrderNumber. That matters, because 10,514 customers have their first purchase on a date shared by several order lines. The tutorial's own example SQL orders only by OrderDate, so on those ties the database may pick any line as the first purchase. The tutorial's example can give different numbers on different runs. The agent's choice is at least repeatable.

Round B: the tutorial's example queries and corrected instructions

I made four changes together.

  1. Added the two example queries. In the Setup tab I opened Example queries and added the tutorial's two question and SQL pairs, one for repeat purchases and one for monthly and year-to-date totals.
  2. Ticked dimproductsubcategory, the table that links products to categories.
  3. Rewrote the instructions to describe all ten tables and the join from product to subcategory to category.
  4. Cleared the chat before each question, as in Round A.
The two example queries in the Setup tab

The two example queries in the Setup tab

The corrected instructions

The corrected instructions

The corrected instructions:

TEXT
1The AdventureWorksLH data source contains information from these tables:
2
3- dimcustomer, for detailed customer demographics and contact information
4- dimdate, for date-related data - for example, calendar and fiscal information
5- dimgeography, for geographical details including city names and country region codes
6- dimproduct, dimproductsubcategory and dimproductcategory, for products, their list prices and their categories (join dimproduct to dimproductsubcategory on ProductSubcategoryKey, then to dimproductcategory on ProductCategoryKey)
7- dimpromotion, for promotions
8- dimreseller, for resellers
9- dimsalesterritory, for sales territories and countries
10- factinternetsales and factresellersales, for internet and reseller sales amounts
11
12Use this data source for queries and analyses that involve customers, products, prices, promotions, resellers, sales territories, time-based events, geographical locations and sales.
What changed
#Round ARound B
1Answered in 27 s, truncated to 200 zip codesAnswered in 18 s with 0% for every zip code
238 months in 16 s, internet onlyThe same figures in 16 s, with the SQL word for word the example's SQL
3Refused: "no sales tables"Queried and reported no sales in 2023, because the data ends in 2014
4RefusedFive Road-150 Red bikes at 3,578.27, category Bikes, in 10 s
5Twenty products in 16 sTwenty products in 13 s
6Refused, asked for production dataRefused, then gave a generic outline in 14 s
7Named a root cause in 46 sNamed a different root cause in 68 s
8Correct in 14 sCorrect in 9 s
Question 3 in Round B: it queried the data and found no 2023 sales

Question 3 in Round B: it queried the data and found no 2023 sales

Question 4 in Round B: the five products, after the table and the instructions were fixed

Question 4 in Round B: the five products, after the table and the instructions were fixed

Questions 3 and 4 are fixed by the corrected instructions. Question 4 is the product question that Round A refused.

The example made question 2 copy the SQL exactly
Question 2 in Round B

Question 2 in Round B

The step lists "Example queries", and the SQL is the example's SQL

The step lists "Example queries", and the SQL is the example's SQL

The generated SQL was the example's SQL, including its column names Year, Month, MonthlySales and CumulativeTotal. The step even said it would use "both internet and reseller sales if present", but the SQL still used only factinternetsales. The example decided the answer.

The example made question 1 worse
Question 1 in Round B: "the average percentage increase ... is 0%"

Question 1 in Round B: "the average percentage increase ... is 0%"

The agent rewrote my question as "for each customer and each product"

The agent rewrote my question as "for each customer and each product"

It changed the example's SQL to partition by customer and product

It changed the example's SQL to partition by customer and product

This is a real defect. The agent turned my question into one about each customer and each product, then changed the example's SQL to partition by CustomerKey and ProductKey and to join on ProductKey. In AdventureWorks, a customer buys each product at most once, so there are no repeat purchases of the same product. Every zip code came out at 0%. The answer then went on to explain how that might happen. It was fluent, confident and wrong.

The example did not cause the rewrite on its own. The agent also saw the product tables I had just added. In Round A it did not touch the product tables for this question. I did not test which change mattered, and I did not fix it in this post.

Questions 5 to 8 in Round B
Question 5, in 13 seconds

Question 5, in 13 seconds

Question 8: the same six figures, in 9 seconds

Question 8: the same six figures, in 9 seconds

Question 6 refused, and then outlined how someone might analyse factory productivity

Question 6 refused, and then outlined how someone might analyse factory productivity

Question 7 named a different root cause, in 68 seconds

Question 7 named a different root cause, in 68 seconds

For question 7, Round B said the spike was "primarily due to a large, mostly non-discounted surge in Bike sales in North American territories in May 2011", and then listed possible campaigns and channel changes that the data cannot show. Round A said a surge in online demand in early 2013. The data holds more than one candidate for a spike, and the agent picked a different one each time, and wrote a cause for it.

Publishing the agent and calling it over MCP

The tutorial ends by publishing the agent and calling it from a notebook. I did both.

The publish dialog asks for a description. I left Also publish to Microsoft Copilot off

The publish dialog asks for a description. I left Also publish to Microsoft Copilot off

Published

Published

Under Settings, the Model Context Protocol tab shows the endpoint and the tool name. The URL has this shape:

TEXT
1https://api.fabric.microsoft.com/v1/mcp/workspaces/{WorkspaceId}/dataagents/{DataAgentId}/agent
The Model Context Protocol tab, with the server URL and the tool name DataAgent_AdventureWorksAgent

The Model Context Protocol tab, with the server URL and the tool name DataAgent_AdventureWorksAgent

The tool takes one argument, userQuestion. I called it from a Fabric notebook with a bearer token from notebookutils:

PYTHON
1import requests, time
2url = "https://api.fabric.microsoft.com/v1/mcp/workspaces/<workspace id>/dataagents/<agent id>/agent"
3h = {"Authorization": "Bearer " + notebookutils.credentials.getToken("pbi"),
4     "Content-Type": "application/json",
5     "Accept": "application/json, text/event-stream"}
6t = time.time()
7r = requests.post(url, headers=h, json={"jsonrpc": "2.0", "id": 1, "method": "tools/call",
8    "params": {"name": "DataAgent_AdventureWorksAgent",
9               "arguments": {"userQuestion": "What is the total sales amount in factinternetsales by sales territory country?"}}})
10print(round(time.time() - t, 1), "seconds")
11print(r.json()["result"]["content"][0]["text"])
The notebook call returned the six countries in 11.2 seconds

The notebook call returned the six countries in 11.2 seconds

I then called the same endpoint twice per question from my Mac with the Azure CLI token, which is how the other tools in this series will call it. These are the published agent's times, with the corrected instructions and the two examples.

QuestionRun 1Run 2
1 repeat purchases20.9 s22.3 s
2 monthly and year-to-date16.1 s22.7 s
3 California 202314.4 s15.3 s
4 top five products11.7 s10.8 s
5 never sold16.9 s14.5 s
6 factory productivity15.2 s72.2 s
7 sales spike76.0 s34.4 s
8 countries10.4 s12.1 s

The answers changed between runs, not only the times.

  • Question 2: Run 1 used internet sales only and matched my key. Run 2 combined internet and reseller sales and gave different figures, for example 532,749.60 for December 2010.
  • Question 7: Run 1 named May 2011 and the reseller channel as the cause. Run 2 said it could not reliably identify one.
  • Question 1: Run 1 said it had returned only the first 200 zip codes. I did not check run 2's numbers.

Questions 3, 4, 5 and 8 gave the same answers both times.

Tear down

I deleted the workspace, which held the notebook, the Lakehouse and the agent, and then the Azure resource group that held the F2. I checked that no Fabric capacities were left. The agent is gone, which is why I could not go back and test one thing at a time.

What I did not do

  • Isolate the cause of the Round B changes. I changed four things at once. I do not know which of them broke question 1 or fixed questions 3 and 4.
  • Reconcile question 1. The tutorial's example SQL is ambiguous on ties, and I did not work out which tie-break each run used.
  • Test other models. The tutorial's agent has a fixed model. I could not choose one.
  • Compare with anything else. Part 5 calls this agent from Copilot Studio. Part 6 asks the same eight questions of DeepSeek Harness over the same tables.