One of my previous blogs looked at using the free resources that Microsoft provides to link to an Azure Data Explorer Cluster and start using Kusto Query Language.
In this post, I want to look at doing a similar thing, but this time using Azure Data Studio (ADS). The cluster that we will link too will be the same one that we previously used when we link to an ADX cluster via the Azure Portal.
Open Azure Data Studio (ADS) and install KQL addin.
Now select “New Notebook” – then select the Python Kernel
If you don’t have a python installation then don’t worry, as soon as we execute our first command then ADS will prompt you to install one.
I’m going to summarize the instructions in this post and add my take to them, if you want to switch to that post (or use the two combined) feel free.
The first two code cells, just set up KQL for us
Here’s the actual code
!pip install Kqlmagic –no-cache-dir –upgrade
The next part require authentication – but all you require is a Microsoft account (outlook , hotmail ect)
here’s the code cell
When you run the cell, you’ll be given a code and a link to a Microsoft site.
Simply navigate to the link, authenticate using a Microsoft account and type in the code.
You’ll get a message stating everything is fine and then you’ll be able to head back to ADS and carry on with the final statements they will query the database.
Next, let’s run some code
And the results are
Here’s another KQL statement
The %%kql is a “Magic” command that signals to the kernel that what we are about to run is not Python – but Kusto Query Language!
Hence KQL Magic!
Hope this helps somebody