marclelijveld / External-Tools-Model-Documentation

This repository includes everything that is needed in order to run the External Tools capability in Power BI Desktop and generate Model Documentation.
https://data-marc.com/model-documenter/
MIT License
110 stars 42 forks source link

Refresh Fails #2

Closed bneelon85 closed 4 years ago

bneelon85 commented 4 years ago

Hi @marclelijveld ,

I am able to get all the way through the ModelDocumentationTemplate step in the process you outlined at https://data-marc.com/2020/07/28/external-tools-document-your-power-bi-model/

After that I get the Refresh Failed with a handful of errors resembling: Tables - Query 'Tables' (step 'Renamed Columns1') references other queries or steps, so it may not directly access a data source. Please rebuild this data combination. and Loading blocked by failures with other queries.

I have tried all the different authentication methods, but the one piece that looks different is instead of connecting to localhost it's trying to connect to MSOLAP.8 (see screenshot)

Does this tool need admin privileges to a SQL Server Database? Or should it be trying to connect to the Tabular Model running locally in the Power BI Desktop File?

Thanks for any help you can provide!

image

marclelijveld commented 4 years ago

Hi,

I'm glad to hear that you came this far. I've seen this error a few times already over the last day, so luckily I know what is causing it and how to fix it!

The error is caused by the Power BI Privacy Levels settings and has nothing to do with the authentication. In order to fix this, we have to change some settings in Power BI Desktop.

Please follow these steps:

  1. Open Power BI Desktop
  2. Go to File
  3. Options & Settings
  4. Options
  5. In the Global Settings go to Privacy
  6. Change the Privacy Levels to "Always Ignore Privacy Level Settings" image
  7. Close all Power BI Desktop Instances and retry :)
  8. For authentication, please choose Windows + Use my current credentials (as in your screenshot and described in the blog).

One other thing you might want to avoid and check, before Power BI starts asking if you want to execute every query. Again in the settings, go to security and uncheck the top setting, stating "Require user approval for new native database queries" image

Hope this works for you :)

Cheers, Marc

bneelon85 commented 4 years ago

@marclelijveld Thanks for the quick reply!

I applied those changes, but to no avail. One note, that you may have seen from my reply in another thread is that I'm running the PowerShell script via VS Code, external of the tool because of IT restrictions.

Does the script need to be initiated within the Power BI report to grab the proper $Server and $DatabaseName variables in the ps1 file? or will the script identify running instances of Power Bi Desktop?

If the former, is there a way to find and hard code those variable names for testing purposes? I know there are ways to unzip a .pbit file and check the DocumentModelSchema...

Thanks again!

bneelon85 commented 4 years ago

Ok I am good. I found the server:port using Tabular Editor and this article: https://www.biinsight.com/four-different-ways-to-find-your-power-bi-desktop-local-port-number/

I substituted the $args[0] with localhost:<portNumber> that I got from Tabular Editor and ran the PowerShell manually, and it worked! image

marclelijveld commented 4 years ago

Hi,

I was not aware that you run it outside of Power BI. That is indeed why the refresh fails, as there will be no Server and DatabaseName pushed from Power BI into the JSON file. As you said, you can get it via different routes as well and manually add it to the json or directly in the PBIT file.

You can use it in the way you prefer :) At least, my intent was to use it from the External Tools ribbon.

Thanks, Marc

bneelon85 commented 4 years ago

Trust me that was my intent too, but wasn't able to run it from External Tools(at least yet) due to IT PowerShell restrictions. For some reason, VS Code let me run the PowerShell script from there without issues...¯_(ツ)_/¯