Sub topic 12
Managing credentials and privacy levels
This chapter assumes you can build a query in Power Query Editor and know the Excel, CSV, and SharePoint connectors from the earlier chapters. Here you will see how Power BI stores access settings for each source, and how privacy levels control data sharing between sources.
Credentials belong to the data source
When a query first touches a source, Power BI Desktop asks how to sign in. It saves the answer per data source, not per query or per report. Two queries that read the same SharePoint site share one credential.
The sign-in type depends on the connector:
| Source | Typical credential type |
|---|---|
| Local Excel or CSV file | Windows (current user) |
| SharePoint Online files or list | Organizational account |
| SharePoint site opened by anonymous link | Anonymous |
The credential is scoped to a URL or path. For SharePoint, you can set it at the site root or at a deeper level. A credential set on https://contoso.sharepoint.com/sites/Sales covers the files and lists under that site.
Viewing and clearing credentials
Open File > Options and settings > Data source settings. Choose Global permissions to see every source saved on this computer, or Current file to see only the sources used by this report. Select a source and use Edit Permissions to change it, or Clear Permissions to remove it. Clearing makes Power BI prompt again on the next refresh.
Privacy levels
Privacy levels protect you when a single query combines two sources. Power Query can send values from one source to another, for example as a filter in a request. A privacy level tells the engine what it may share.
| Level | Meaning |
|---|---|
| Private | Never shared with other sources. Use it for sensitive data. |
| Organizational | Shared only with other Organizational sources. |
| Public | Can be shared with any source. |
Set the level in Data source settings by selecting a source and choosing Edit Permissions. Pick the most restrictive level that still lets your queries run.
How the Formula.Firewall error appears
Suppose one query reads a local CSV file, and another query merges it with a SharePoint table. If the two sources have levels that conflict, Power Query stops and reports that a query references other queries or steps, so it can't access the data source. This is the "Formula.Firewall" error. The engine blocks the combination because it can't prove that no data would leak.
Fixing firewall errors
Try these in order:
- Set each source to the correct level. Local files that hold business data are usually Organizational or Private. Two Organizational sources can be combined.
- Split the work. Load each source in its own query, with no merging. Then merge the finished queries in a third query. This keeps each source evaluated on its own.
- Ignore privacy levels only as a last resort, and only for your own report.
Credentials after publishing
Credentials saved in Desktop don't travel with the report. After you publish, open the semantic model settings in the Power BI service and set Data source credentials again. For SharePoint Online sources, sign in with an organizational account and set the privacy level there too. Local files need a gateway, which the next chapter covers.
Exercise
A query merges a local CSV file with a SharePoint Online list. It works in Power BI Desktop with privacy levels ignored, but the scheduled refresh in the service fails with a firewall error. What do you change?
Show answer
Stop relying on the ignore setting, because the service always enforces privacy levels. Set a compatible level on each source (for example, both Organizational) in Data source settings and in the semantic model's credentials in the service. If the error remains, load each source in its own query and merge the two finished queries in a third query.
Exercise
You change your sign-in account, and Power BI keeps using the old one for a SharePoint site. How do you make it ask again?
Show answer
Open File > Options and settings > Data source settings, select the site, choose Clear Permissions, and refresh the query. Power BI prompts for new credentials.