Quick Tip: How to find the address of the PowerBI local tabular instance

Table of Contents

Super quick tip, I’ve seen this done via CMD or DaxStudio, but not via PowerShell (probably because I haven’t searched so much since I’ve done it myself), but here we are:

I’m sure you know that PowerBI tabular models are 100% the same as SSAS tabular models, hence you can use SSMS to connect to a PowerBI Tabular model as if it was SSAS (because it is), to do whatever you want, for example scripting out the objects that you’ve created in the PowerBi Desktop GUI or extract the model to deploy it in SSAS.

The only issue to do so is that PowerBI Desktop each time you open a report creates the local SSAS Tabular instance on a random port, so it’s not like you can save a connection string and that’s it 🤷‍♂️

But you can do the following:

$data = Get-Process -ProcessName msmdsrv

if ($null -eq $data) {
    Write-Host "A PowerBi model instance is not running"
}
else {
   $a = Get-NetTCPConnection -OwningProcess $data.Id
   $port = $a[0].LocalPort
   Write-Host "The PowerBi local SSAS instance is @ 127.0.0.1:$port"
}

PowerBi creates a different instance for each PowerBI Desktop client open, this code doesn’t consider that, because why you would connect to multiple local SSAS instance in SSMS? What are you doing there?

comments powered by Disqus

Related Posts

How to use Grafana (on docker) to monitor your SQL Server (eventually on docker too) - feat. InfluxDB and Telegraf

In this container-centric era to complement my SQL Server instance on docker (previous articles here ) I’ve looked over containerized monitoring solutions, and chose Grafana as my first candidate; spoiler: everything is simple once you’ve figured out how this stuff works, which can be not trivial for a Windows Guy (like me)

Read More

How to populate a PowerBI Dataset from a REST API, using PowerBI's REST API, without any code (via Microsoft Flow)

I was wondering if PowerBI could be used for reporting on Live data, not coming from my Database using DirectQuery (or the new super neat composite mode ) with with a Streaming Dataset, which I never used before, so, I got to work.

Read More
How to build an Application with modern Technology

How to build an Application with modern Technology

Nemo vel ad consectetur namut rutrum ex, venenatis sollicitudin urna. Aliquam erat volutpat.

Read More