Manage your data source - SQL Server


We've split the on-premises data gateway docs into content that's specific to Power BI and general content that applies to all services that the gateway supports. You're currently in the Power BI content. To provide feedback on this article, or the overall gateway docs experience, scroll to the bottom of the article.

After you install the on-premises data gateway, you can add data sources that can be used with the gateway. This article looks at how to work with gateways and SQL Server data sources that are used either for scheduled refresh or for DirectQuery.

Add a data source

For more information about how to add a data source, see Add a data source. Under Data Source Type, select SQL Server.

 Screenshot of selecting the SQL Server data source.


When you use DirectQuery, the gateway supports only SQL Server 2012 SP1 and subsequent versions.

Then fill in the information for the data source, which includes Server and Database.

Under Authentication Method, choose either Windows or Basic. Choose Basic if you plan to use SQL authentication instead of Windows authentication. Then enter the credentials to be used for this data source.


All queries to the data source will run using these credentials, unless Kerberos single sign-on (SSO) is configured and enabled for the data source. With SSO, import datasets use the stored credentials, but DirectQuery datasets use the current Power BI user to execute the queries using SSO. To learn more about how credentials are stored, see Store encrypted credentials in the cloud. Or, see the article that describes how to use Kerberos for single sign-on (SSO) from Power BI to on-premises data sources.

 Screenshot of filling in the data source settings.

After you fill in everything, select Create. You can now use this data source for scheduled refresh or DirectQuery against a SQL Server that's on-premises. You see Created New data source if it succeeded.

 Screenshot of successful creation of SQL data source.

Advanced settings

Optionally, you can configure the privacy level for your data source. This setting controls how data can be combined. It's only used for scheduled refresh. The privacy-level setting doesn't apply to DirectQuery. To learn more about privacy levels for your data source, see Privacy levels (Power Query).

 Screenshot of the setting the privacy level for SQL data source

Use the data source

After you create the data source, it's available to use with either DirectQuery connections or through scheduled refresh.


The server and database names must match between Power BI Desktop and the data source within the on-premises data gateway.

The link between your dataset and the data source within the gateway is based on your server name and database name. These names must match. For example, if you supply an IP address for the server name within Power BI Desktop, you must use the IP address for the data source within the gateway configuration. If you use SERVER\INSTANCE in Power BI Desktop, you must use it within the data source configured for the gateway.

This requirement is the case for both DirectQuery and scheduled refresh.

Use the data source with DirectQuery connections

Make sure that the server and database names match between Power BI Desktop and the configured data source for the gateway. You also need to make sure your user is listed in the Users tab of the data source to publish DirectQuery datasets. The selection for DirectQuery occurs within Power BI Desktop when you first import data. For more information about how to use DirectQuery, see Use DirectQuery in Power BI Desktop.

After you publish, either from Power BI Desktop or Get Data, your reports should start to work. It might take several minutes after you create the data source within the gateway for the connection to be usable.

Use the data source with scheduled refresh

If you're listed in the Users tab of the data source configured within the gateway and the server name and database name match, you see the gateway as an option to use with scheduled refresh.

Displaying the users

Next steps

More questions? Try asking the Power BI Community.