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 tool for different purposes like monitoring in SQL Server Profiler or analysing the model in Excel. I’ve been asked several times here and there about different reasons people need to find the Power BI Desktop local port number, so I decided to dedicate a post to the 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 the port number and 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 the Microsoft website is that you will get a 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. However, some other differences are out of the scope of this article. There is just one difference that 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 work for both the 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:

%userprofile%\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 the 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 the 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 the number coming after the colon is the port number.

4 thoughts on “Four Different Ways to Find Your Power BI Desktop Local Port Number

  1. How does DAX Studio associate the name of the open PBIX file with the Port Number?
    What is the best way to get the Initial Catalog name?

    1. Hi Ejaz.

      Welcome to biinsight.com.
      Well, I don’t know your use case, but DAX Studio is an open source project.
      So you can have look at the source code on GitHub and find out how it does it.

      Hopefully that helps.
      Cheers

  2. And now there are 5! Power BI Desktop has it in the properties pane of Semantic Model in the Model Explorer of the Data pane in Model view.

    1. Thank you Zoe for the reminder. 👍🏼Sometimes it’s hard to remember updating our older blog posts.
      I will definitely update it.

Leave a Reply

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


The reCAPTCHA verification period has expired. Please reload the page.