web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / Unable to Trace SQL Qu...
Copilot Studio
Suggested Answer

Unable to Trace SQL Queries Executed by Copilot Studio when Connected to Azure SQL Database

(1) ShareShare
ReportReport
Posted on by 13

Hi Team,

I’m using Azure SQL Server as a data source in Microsoft Copilot Studio. When I ask natural language questions in the Copilot, it provides correct answers based on my database — which indicates it is firing SQL queries in the background.

However, I’m unable to trace or view the actual SQL queries that Copilot Studio is generating and executing against the Azure SQL Database.

I would like to know:


  • Where can I find the query logs or traces of the SQL statements Copilot sends to the database?

  • Is there any built-in option or diagnostic setting in Copilot Studio, Power Automate, or Azure SQL that allows capturing or monitoring those generated queries?

  • If not, what is the recommended way to audit or debug** the queries executed by Copilot Studio for transparency and troubleshooting.

I’m also attaching an activity snapshot for reference.

Any guidance or documentation link would be greatly appreciated.

Thanks & Regards,

Srujan V

Copilot Studio Activity.png
Categories:
I have the same question (1)
  • Suggested answer
    sannavajjala87 Profile Picture
    748 Super User 2026 Season 1 on at
    At the moment, Copilot Studio doesn't expose the generated SQL query text when using Azure SQL as a knowledge source. The Activity pane shows the retrieved sources and citations, but not the SQL statements that were generated or executed.
     
    For troubleshooting or auditing, your best options are on the Azure SQL side:
     
    Enable Query Store to capture executed queries and their performance.
     
    Use Azure SQL Auditing to log database activity.
     
    Use Extended Events or SQL Profiler (where applicable) to capture SQL statements in real time.
     
    Monitor Azure Monitor and Log Analytics if your database diagnostics are configured.
     
     
    One thing to keep in mind is that Copilot Studio may not always generate a single SQL query. Depending on the scenario, it can translate the user's intent into one or more data retrieval operations before constructing the response.
     
    Unfortunately, there isn't currently a built-in Copilot Studio setting that lets you view the exact SQL generated by the agent. If you need complete transparency into the executed SQL, database-side monitoring (Query Store, Auditing, or Extended Events) is the recommended approach.
     
    Out of curiosity, are you using Azure SQL as structured knowledge (database knowledge source) or are you calling SQL through a Tool/Power Automate flow? The tracing options differ slightly between those two approaches.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Copilot Studio

#1
sannavajjala87 Profile Picture

sannavajjala87 160 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 145

#3
Haque Profile Picture

Haque 121

Last 30 days Overall leaderboard