Four Different Ways to Find Your Power BI Desktop Local Port Number

Power BI Desktop Local Port

About two years ago I wrote a blog post on how to connect to a Power BI Desktop model from different tools like SSMS, Excel and SQL Server Profiler. A big chunk of that blog post was about different ways of finding Power BI Desktop local port. Having the port number is crucial if you want to connect to a Power BI Desktop model from any sort of tools for different purposes like monitoring in SQL Server Profiler or analysing the model in Excel. I’m asked several times here and there about different scen people need to find Power BI Desktop local port number, so I decided to dedicate a post to Power BI Desktop local port number.

When you run Power BI Desktop, it runs a local instance of SSAS Tabular model in the background and it assigns a random port number to that local instance. Therefore, if you want to connect to the model to analyse it in Excel you need to know that port number. There are several ways to achieve that port number which this post will cover most of them.

As you may know, Power BI Desktop is now available as a Windows App that can be installed from Windows Store. In general, the main difference between the App and the downloaded edition from Micrsosoft website is that you will get notification whenever a newer version is available to download. Then you have to manually download and install the newer version on your machine, but, the App will be updated automatically. But there are some other differences that are out of scope of this article. There is just one difference which is relevant to this article which is that Power BI Desktop creates its temporary folders in a different location than the Power BI Desktop App does.

The methods described in this post works for both downloaded edition and the Store edition.

Different Methods to Find Power BI Desktop Local Port

· Using DAX Studio

· Tabular Editor

· Power BI Desktop Temporary Location

· Command Line (CMD)

The reason that I explain different methods is that not all methods are doable in all environments. You may work at a customer site that doesn’t allow you to install new software like DAX Studio on their machines. But you always have access on Power BI Desktop temporary files.

Retrieve Power BI Desktop Local Port Number Using DAX Studio

This method is the easiest way to find the Power BI Desktop local port.

· First of all you need download and install DAX Studio if you don’t already have it

· Open DAX Studio

· It immediately detects all opened Power BI Desktop files that you can select from the drop-down list

DAX Studio Connecting to Power BI Desktop

· Select a desired Power BI Desktop file then click “Connect”

· You can see the local port number in the button right of the DAX Studio window

Power BI Desktop Port in DAX Studio

Retrieve Power BI Desktop Local Port Number Using Tabular Editor

This method is even easier than DAX Studio.

· You need to download and either install or run the Tabular Editor (you can download a portable version)

· Open Tabular Editor

· Click “Open a Tabular Model from an existing database”

· You can see the port number associated with each of Power BI Desktop instances in the “Local instances” drop-down list

Power BI Desktop Port in Tabular Editor

Retrieve Power BI Desktop Local Port Number From Its Temporary Location

Whenever you open Power BI Desktop, it creates some temporary folders and files. The temporary location is different for Power BI Desktop download edition and the Store edition.

Power BI Desktop Local Port in Download Edition

· Use Run menu and navigate to the following path:

%LocalAppData%\Microsoft\Power BI Desktop\AnalysisServicesWorkspaces

· If you have an open instance of Power BI Desktop then you’ll find temporary a folder like below

Power BI Desktop Download Edition Temporary Folder

· Navigate to “Data” subfolder

· Open “msmdsrv.port.txt” file which contains the Power BI Desktop local port number

Power BI Desktop Download Edition msmdsvr.port.txt

Power BI Desktop Local Folder the Store Edition:

· Use Run menu and navigate to the following path:

%username%\Microsoft\Power BI Desktop Store App\AnalysisServicesWorkspaces

· The rest is the same as Power BI Desktop download edition so you can find the “msmdsrv.port.txt” file in the sub-folders

Finding Power BI Desktop local port using Windows Command Prompt (CMD)
  • Run Windows Command Prompt as Administrator
  • Copy, paste and run the following command:

TASKLIST /FI “imagename eq msmdsrv.exe” /FI “sessionname eq
console”

Finding Power BI Desktop local port using Windows Command Prompt (CMD)

  • You should see something like this
  • What we need is the PID

Finding Power BI Desktop local port using Windows Command Prompt (CMD)

  • Now run the following command and put the PID number you got from previous command between quotation marks

netstat /ano | findstr “13944”

Finding Power BI Desktop local port using Windows Command Prompt (CMD)

  • The results should be something like the screenshot below which shows active connections, their local address which is local IP address followed by the port number. And this is what we are looking for.

Finding Power BI Desktop local port using Windows Command Prompt (CMD)

Note: The column names for the result table respectively from left to right are:

Active Connection, Local Address, Foreign Address, State, PID

As I mentioned, Active Connection is the one we are interested in so that the number coming after colon is the port number.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.