Sub topic 7
Adding data sources, setting credentials, and mapping the dataset
This chapter assumes you have a standard-mode gateway installed and registered, and a dataset published from Power BI Desktop that reads from an on-premises source such as SQL Server. You should also know what a workspace and a semantic model are. After the install, the gateway can reach your network, but the Power BI service does not yet know which datasets should use it. You close that gap with a gateway data source and a mapping.
What a gateway data source is
A gateway data source is a saved connection definition on the gateway. It holds a server, a database or file path, an authentication method, and credentials. The service stores the credentials encrypted and the gateway decrypts them when it runs a refresh.
Standard-mode gateways need these data sources defined explicitly. A dataset can only use a gateway if every on-premises source in its queries has a matching gateway data source.
The match rule
The service maps a dataset to a gateway data source by comparing the server name and database name in the query. They must match exactly. Consider this query:
let
Source = Sql.Database("sql01.contoso.local", "Sales"),
Orders = Source{[Schema = "dbo", Item = "Orders"]}[Data]
in
OrdersThe gateway data source needs the server sql01.contoso.local and the database Sales. A short name such as sql01, or an IP address, counts as a different server and the mapping fails.
Adding the data source
- In the Power BI service, open Settings, then Manage connections and gateways.
- Select New, then choose On-premises.
- Pick your gateway cluster from the list.
- Enter a connection name, choose the data source type (for example SQL Server), and enter the server and database exactly as they appear in the query.
- Choose an authentication method: Basic, Windows, or OAuth2, depending on the source.
- Enter the credentials and select Create.
The service tests the connection through the gateway. If the test fails, the usual causes are a wrong name, a blocked port between the gateway machine and the database, or an account without permission.
Credentials
The account you enter must be able to read every table the dataset queries. A read-only account is usually enough and limits the damage if the credentials leak. With Windows authentication, the account must be valid on the gateway machine's domain. Passwords that expire will break scheduled refresh later, so use a service account with a managed password policy where you can.
Mapping the dataset
Mapping connects the published dataset to the gateway.
- In the workspace, open the dataset's Settings.
- Expand Gateway and cloud connections.
- Turn on the gateway option. Each data source in the dataset appears with a drop-down list.
- For each one, select the matching gateway data source and apply.
Only datasets whose sources match appear as mappable. If a source shows "not configured", the match rule has failed for that entry. The dataset owner also needs permission to use the data source. An administrator of the data source can grant this under Manage users.
Exercise
A dataset query connects to SQL01 and database Sales. The gateway data source was created for sql01.contoso.local and Sales. The service shows the source as not configured. Why, and what are two ways to fix it?
Show answer
The server names differ, and the service requires an exact match. Either create a second gateway data source for SQL01 and Sales, or change the query in Power BI Desktop to use sql01.contoso.local and republish the dataset.