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.
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.
I clicked Create. The form defaults to East US.
The form then showed an F64, the default size, with Capacity Overage Protection switched on and a threshold of 384 capacity-unit hours.
What the F2 cost
| Capacity created | 18:40:13 UTC |
| Capacity deleted | about 19:32 UTC |
| Time it ran | about 52 minutes |
| List price in Sweden Central | $0.19 per capacity unit per hour |
| An F2 has | 2 capacity units, so about $0.38 an hour |
| Compute for the run | about $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.
Load the AdventureWorks sample
The tutorial loads the AdventureWorks sample with a notebook. I created a notebook and added a new Lakehouse called 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.
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.
Create the data agent
I created the agent after the load had finished.
I chose Add a data source and picked AdventureWorksLH from the OneLake catalog.
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.
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.
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.
| # | Question | Where it comes from |
|---|---|---|
| 1 | Calculate 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 |
| 2 | Show the monthly total and year-to-date total sales. Order by year and month. | The tutorial |
| 3 | What were our total sales in California in 2023? | Create a Fabric data agent |
| 4 | What are the top 5 products with the highest list prices, and what are their categories? | Create a Fabric data agent |
| 5 | What are the most expensive items that have never been sold? | Create a Fabric data agent |
| 6 | Why is our factory productivity lower in Q2 2024? | Create a Fabric data agent, as a question the agent cannot answer |
| 7 | What is the root cause of our sales spike? | Create a Fabric data agent, as a question the agent cannot answer |
| 8 | What 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?
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
| Country | Agent | My SQL |
|---|---|---|
| United States | 9,389,789.94 | 9,389,789.94 |
| Australia | 9,061,000.72 | 9,061,000.72 |
| United Kingdom | 3,391,712.24 | 3,391,712.24 |
| Germany | 2,894,312.36 | 2,894,312.36 |
| France | 2,644,017.74 | 2,644,017.74 |
| Canada | 1,977,844.89 | 1,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.
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?
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?
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?
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?
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?
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)
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.
- 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.
- Ticked
dimproductsubcategory, the table that links products to categories. - Rewrote the instructions to describe all ten tables and the join from product to subcategory to category.
- Cleared the chat before each question, as in Round A.
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 A | Round B |
|---|---|---|
| 1 | Answered in 27 s, truncated to 200 zip codes | Answered in 18 s with 0% for every zip code |
| 2 | 38 months in 16 s, internet only | The same figures in 16 s, with the SQL word for word the example's SQL |
| 3 | Refused: "no sales tables" | Queried and reported no sales in 2023, because the data ends in 2014 |
| 4 | Refused | Five Road-150 Red bikes at 3,578.27, category Bikes, in 10 s |
| 5 | Twenty products in 16 s | Twenty products in 13 s |
| 6 | Refused, asked for production data | Refused, then gave a generic outline in 14 s |
| 7 | Named a root cause in 46 s | Named a different root cause in 68 s |
| 8 | Correct in 14 s | Correct in 9 s |
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
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
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
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.
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 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"])
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.
| Question | Run 1 | Run 2 |
|---|---|---|
| 1 repeat purchases | 20.9 s | 22.3 s |
| 2 monthly and year-to-date | 16.1 s | 22.7 s |
| 3 California 2023 | 14.4 s | 15.3 s |
| 4 top five products | 11.7 s | 10.8 s |
| 5 never sold | 16.9 s | 14.5 s |
| 6 factory productivity | 15.2 s | 72.2 s |
| 7 sales spike | 76.0 s | 34.4 s |
| 8 countries | 10.4 s | 12.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.




























































