{"id":101585,"date":"2024-02-28T23:56:42","date_gmt":"2024-02-28T23:56:42","guid":{"rendered":"https:\/\/www.red-gate.com\/simple-talk\/?p=101585"},"modified":"2024-09-03T20:15:16","modified_gmt":"2024-09-03T20:15:16","slug":"customizing-kusto-data-explorer-connections-in-deployment-pipeline","status":"publish","type":"post","link":"https:\/\/www.red-gate.com\/simple-talk\/blogs\/customizing-kusto-data-explorer-connections-in-deployment-pipeline\/","title":{"rendered":"Customizing Kusto (Data Explorer) Connections in Deployment pipeline"},"content":{"rendered":"<p>When organizing our <strong>SDLC<\/strong> (Software Development Lifecycle) in <strong>Power BI\/Fabric<\/strong>, we use <strong>Deployment Pipeline<\/strong>s and create rules to change connection configurations every time we promote an object from one environment (dev for example) to another (test, for example). Kusto connections, on the other hand, are not so simple.<\/p>\n<p>You can check more about <a href=\"https:\/\/www.youtube.com\/watch?v=Ja1Om9RN_-U\" target=\"_self\" rel=\"noopener\"><strong>Deployment Pipelines<\/strong><\/a> on my video about them or on a <a href=\"https:\/\/www.red-gate.com\/simple-talk\/blogs\/fabric-notebooks-and-deployment-pipelines\/\" target=\"_self\" rel=\"noopener\">blog post explaining how to use them with notebooks<\/a>.<\/p>\n<p><strong>Kusto<\/strong> connections don&#8217;t appear when configuring rules for deployment pipelines. We can&#8217;t make a direct configuration of the rule to change the connection according to the environment.<\/p>\n<p>The image below shows how the Kusto connection doesn\u2019t appear by default among the Deployment Pipeline rules.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"648\" height=\"610\" class=\"wp-image-101586\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2024\/02\/a-screenshot-of-a-computer-description-automatica-9.png\" alt=\"A screenshot of a computer\n\nDescription automatically generated\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>There is a 2nd option: <em>Parameterize the connection in <\/em><strong><em>Power BI<\/em><\/strong><em> and use the rules to change the parameter value.<\/em><\/p>\n<p>&nbsp;<\/p>\n<h2>Parameterizing the Kusto Connection<\/h2>\n<p>The <strong>Kusto<\/strong> connector in <strong>Power BI<\/strong> doesn&#8217;t allow parameters out of the box. I mean, even when you configure data source connections to always allow parameters (this is a power bi configuration), the kusto connection window doesn&#8217;t give you the option to create parameters.<\/p>\n<p>We need to go directly to the kusto query. A kusto query in <strong>power query<\/strong> has the first line like this:<\/p>\n<p><em>= AzureDataExplorer.Contents(&#8220;myKustoServerAddress&#8221;, &#8220;myKustoDatabase&#8221;)<\/em><\/p>\n<p>The two pieces of information we would like to turn into parameters are in string format. In this way, it&#8217;s easy to create <strong>Power Query<\/strong> parameters and &#8220;manually&#8221; use the parameters on this statement.<\/p>\n<p>In <strong>Power Query<\/strong>, you click the button <strong>Manage Parameters<\/strong> and on the parameters window you create two: <strong>KustoServer<\/strong> and <strong>KustoDB<\/strong>, both as Text<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"649\" class=\"wp-image-101587\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2024\/02\/a-screenshot-of-a-computer-description-automatica-10.png\" alt=\"A screenshot of a computer\n\nDescription automatically generated\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Once they are created, the parameters appear as an additional query in <strong>Power Query<\/strong>. You select them to fill their default value. Usually you would like the default value to be the value for the development environment.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"349\" height=\"111\" class=\"wp-image-101588\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2024\/02\/a-screenshot-of-a-computer-description-automatica-11.png\" alt=\"A screenshot of a computer\n\nDescription automatically generated\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>After publishing the semantic model, you can use parameter rules on the deployment pipeline, instead of connection rules. The parameters will be visible for you to create the rules and in this way allow an easy transition from the development environment to the test environment.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"577\" height=\"444\" class=\"wp-image-101589\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2024\/02\/a-screenshot-of-a-computer-description-automatica-12.png\" alt=\"A screenshot of a computer\n\nDescription automatically generated\" \/><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When organizing our SDLC (Software Development Lifecycle) in Power BI\/Fabric, we use Deployment Pipelines and create rules to change connection configurations every time we promote an object from one environment (dev for example) to another (test, for example). Kusto connections, on the other hand, are not so simple. You can check more about Deployment Pipelines&#8230;&hellip;<\/p>\n","protected":false},"author":50808,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[2,159164,159166],"tags":[159053,126249,158997,101611],"coauthors":[6810],"class_list":["post-101585","post","type-post","status-publish","format-standard","hentry","category-blogs","category-microsoft-fabric","category-powerbi","tag-deployment-pipelines","tag-kusto","tag-microsoft-fabric","tag-power-bi"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/101585","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/users\/50808"}],"replies":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/comments?post=101585"}],"version-history":[{"count":1,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/101585\/revisions"}],"predecessor-version":[{"id":101590,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/101585\/revisions\/101590"}],"wp:attachment":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media?parent=101585"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/categories?post=101585"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/tags?post=101585"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/coauthors?post=101585"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}