Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
You can use Copilot to translate your natural language questions into Kusto Query Language (KQL) queries. Simply describe what you want to analyze or find in plain language, and Copilot generates the corresponding KQL query for you. This feature makes it easier for anyone—regardless of their familiarity with KQL—to explore and analyze data efficiently.
For billing information about Copilot, see Announcing Copilot in Fabric pricing.
Prerequisites
- A workspace with a Microsoft Fabric-enabled capacity
- Write access to a KQL queryset
Note
- Your administrator needs to enable the tenant switch before you start using Copilot. See the article Copilot tenant settings for details.
- Your F2 or P1 capacity needs to be in one of the regions listed in this article, Fabric region availability.
- If your tenant or capacity is outside the US or France, Copilot is disabled by default unless your Fabric tenant admin enables the Data sent to Azure OpenAI can be processed outside your capacity's geographic region, compliance boundary, or national cloud instance tenant setting in the Fabric Admin portal.
- Copilot in Microsoft Fabric isn't supported on trial SKUs. Only paid SKUs (F2 or higher, or P1 or higher) are supported.
- See the article Overview of Copilot in Fabric and Power BI for more information.
Capabilities of Copilot for writing queries in KQL
Copilot lets you effortlessly translate natural language queries into Kusto Query Language (KQL). The copilot acts as a bridge between everyday language and KQL's technical intricacies, and in doing so removes adoption barriers for data analysts and citizen data scientists. By harnessing OpenAI's advanced language understanding, this feature allows you to submit business questions in a familiar, natural language format, which are then converted into KQL queries. Copilot accelerates productivity by simplifying the query creation process with a user-friendly and efficient approach to data analysis.
Copilot supports conversational interactions which allows you to clarify, adapt, and extend your queries dynamically, all while maintaining the context of your previous inputs. You can refine queries and ask follow-up questions without starting over:
Dynamic query refinement: You can refine the initial KQL generated by Copilot by refining your prompt to remove ambiguity, specify tables or columns, or provide more context.
Seamless follow-up questions: If the generated KQL is correct but you want to explore the data more deeply, you can ask follow-up questions related to the same task. You can expand the scope of your query, add filters, or explore related data points by building on previous dialogue.
Using Copilot for writing queries in KQL
You can access Copilot in two ways:
Through a KQL queryset: Go to a new or existing KQL queryset and use the Copilot feature to generate queries from natural language prompts.
Through the Edit tile in Real-Time Dashboards: When editing a tile in a Real-Time dashboard, use Copilot to help create or refine KQL queries directly within the dashboard editing experience.
Follow the steps below to use Copilot in either context:
In the Copilot pane, enter your business question in natural language.
Press Enter.
After a few seconds, Copilot generates a KQL query based on your input. You can copy the query to the clipboard, Insert it to the query editor, or Replace the query in context with it. To run the query in the query editor, you must have write access to the KQL queryset.
Select the Run button to execute the query.
Note
- Copilot doesn't generate control commands.
- Copilot doesn't automatically run the generated KQL query. Users are advised to run the queries at their own discretion.
You can continue to ask follow-up questions or further refine your query. To start a new chat, select the speech bubble on the top right of the Copilot pane (1).
Hover over a previous question (2) and select the pencil icon to copy it to the question box to edit it or copy it to your clipboard.
Improve the accuracy of Copilot for writing KQL queries
Here are some tips that can help improve the accuracy of the KQL queries generated by Copilot:
Start with simple natural language prompts to learn the current capabilities and limitations. Then, gradually proceed to more complex prompts.
State the task precisely, and avoid ambiguity. Imagine you shared the natural language prompt with a few KQL experts from your team without adding oral instructions - would they be able to generate the correct query?
To generate the most accurate query, supply any relevant information that can help the model. If you can, specify tables, operators, or functions that are critical to the query.
Prepare your database: Add docstring properties to describe common tables and columns. This step might be redundant for descriptive names (for example, timestamp) but is critical to describe tables or columns with meaningless names. You don't have to add docstring to tables or columns that are rarely used. For more information, visit alter table column-docstrings command.
To improve Copilot results, select either the like or dislike icon to submit your comments in the Submit feedback form.
Note
The Submit feedback form submits the name of the database, its URL, the KQL query generated by copilot, and any free text response you include in the feedback submission. Results of the executed KQL query aren't sent.
Adding Private Shots
The Copilot augments the user prompt with the most relevant examples (<NL, KQL> pairs, also known as shots) from a Public Shots database. This database is curated and managed by the RTI team. It's mainly based on KQL documentation and available for the Copilot's users out of the box. However, it's a generic database, and doesn't contain any domain specific knowledge of the current KQL DB. To further boost the Copilot's ability to correctly generate complex KQL queries for your scenarios, you can create a Private Shots database. This will enable you to add advanced KQL queries for your team's specific scenarios, using advanced KQL operators (e.g. graph semantics, time series analysis, anomaly detection, etc.) and Stored Function defined in your KQL DB. Currently Private Shots are automatically published from both querysets and real time dashboards. Saving these artifacts triggers publishing the contained KQL queries in the Private Shots database.
Note
- It takes few minutes from saving these artifacts until they are published and ready to be retrieved by the Copilot to augment the user's prompt.
- Only the KQL is mandatory. The respective NL description is automatically generated by the LLM. Still you are welcome to add a short description of the KQL by a preceding comment (that must be attached to the KQL).
- KQL queries are checked for valid syntax; only valid ones are added to the Private Shots db.
- For specific user, the Copilot uses only Private Shots that are visible to that user. I.e., if that user has no permission to view specific dashboard or queryset the Copilot won't use shots from those artifacts.
- KQL queries that were generated by the Copilot and copied to the queryset using the Copilot's "Copy to Editor" button starts by a comment line "// This KQL query was generated by AI:" and are not published into the Private Shots db. If you want to include them just delete that comment (but leave the following comment which is the user's prompt, as it's helpful for generating the NL description).
Limitations and considerations
- Copilot might suggest potentially inaccurate or misleading suggested KQL queries due to:
- Complex and long user input.
- User input that directs to database entities that aren't KQL Database tables or materialized views (for example KQL function.)