Yes, Power BI can connect directly to Microsoft SQL Server. From Power BI Desktop, go to Home > Get data > More, pick Database > SQL Server database, enter the server name and database, choose a data connectivity mode, and connect. Power BI then generates a query against the server that you load into the report model.
This guide covers Power BI Desktop, which is where the connection is built. The Power BI service (the browser version at app.powerbi.com) cannot create a new SQL Server connection by hand—it only uses connections saved in a gateway or in a published dataset that was built in Desktop, so do the setup in Desktop first. Menu labels can differ slightly between versions of Power BI Desktop, so treat every path below as a close guide rather than a guarantee.
What You'll Need
- Power BI Desktop installed on a Windows machine. It is free from Microsoft's official site. There is no current version for Mac, so Mac users need a Windows PC or a virtual machine.
- SQL Server's server name. For a default instance this may look like
SERVERNAMEorSERVERNAME\SQLEXPRESSfor a named instance. For Azure SQL Database it isyourserver.database.windows.net. - A database name you have permission to read.
- Credentials in the form the server expects: a SQL login, a Windows domain account, or an Entra ID (formerly Azure AD) account.
- Network access from your PC to the server. On a company network that often means a VPN; for Azure SQL, it means the server firewall allows your client IP.
Step-by-Step
- Open Power BI Desktop and save a new blank file first, so you have somewhere to keep the model.
- Get data. On the Home ribbon, click Get data. In the search box at the top of the picker, type SQL Server. Select SQL Server database under the Database category and click Connect. (The picker may offer a Microsoft SQL Server connector too; either leads to the same dialog.)
- Enter the server. In the Server field, type the server name exactly as your DBA gives it—do not add
http://, a port unless instructed, or a database path. Put the database name in the Database field. If your SQL Server listens on a non-default TCP port, use the instance name your DBA supplies, or set the port in the advanced options rather than guessing. - Choose the data connectivity mode. Under advanced options you will see Import and DirectQuery.
• Import copies the data into the Power BI file. It is the default, works offline, and is faster for most reports.
• DirectQuery leaves data in SQL Server and queries it live. Choose it when the dataset is too large to import, data must be current to the minute, or the data must not leave the database. DirectQuery needs a reachable server every time the report refreshes or is viewed. - Click OK. After a moment you are asked for credentials. Pick the authentication method that matches your environment: Windows for domain accounts, Database for a SQL username and password, or Microsoft account for Azure/Entra-based setups. For Azure SQL, the database login type is usually simplest.
- Pick the privacy level if prompted. It controls whether Power BI may combine data from this source with other sources. Ask your administrator for the right level; the choice affects how blended queries behave.
- Select the tables. In the Navigator window, expand the database, tick the tables or views you need, and use Preview to confirm you are seeing real rows. Click Load to bring the data straight in, or Transform Data to open Power Query and clean it first.
- Use Transform Data when the tables are big or messy. In Power Query you can remove columns, filter rows, change data types and rename columns. Each action becomes a step in the applied steps list. Keep filtering there rather than in the report: a filter applied in Power Query reduces rows loaded, while a report-level filter still loads every row.
- Set relationships. After loading, open the Model view and check that relationships between tables were detected. If not, drag a key column from one table onto its matching column in the other. Verify the cardinality is what you expect (one-to-many usually).
- Refresh. On the Home ribbon click Refresh to pull the latest data (Import mode) or re-run the query (DirectQuery).
Common Mistakes
- Putting the database in the Server field. The server and the database are separate fields. Mixing them produces connection errors.
- Guessing the server name. A named instance such as
SQLSERVER\SQLEXPRESSmust include the backslash part or the connection will not resolve. - Choosing DirectQuery for everything. DirectQuery is slower and limited by what SQL Server can compute. If import works, import is usually the better default.
- Loading entire tables. Importing a million-row table you only need summaries from wastes refresh time. Filter in Power Query or write the aggregation in the database.
- Hard-coding credentials in shared files. Saved credentials live with the connection; be careful about who receives a copy of the .pbix.
- Ignoring data types. Dates arriving as text, or numbers as text, break calculations and relationships. Fix types in Power Query, not in DAX.
Tips
- Prefer database views over raw tables when a DBA can provide them. Views hide messy joins, stabilize column names, and let the database team change the schema without breaking your report.
- Rename queries and columns to friendly names in Power Query so report builders do not have to decipher
tbl_cust_dim. - Keep a separate query that pulls only the columns you actually use. Fewer columns means a smaller model and faster refreshes.
- For very large tables in Import mode, filter to the date range the report needs rather than importing all history.
- Test the connection with the credentials of whoever will refresh the file, not only your own admin account.
- Document the server, database and authentication method in the file or a note, so the next person can fix a broken refresh.
Troubleshooting
"We couldn't authenticate with the credentials provided." Re-enter credentials from File > Options and settings > Data source settings (labels vary slightly), pick the matching authentication type, and confirm the account has read access to the database. If your Windows password changed recently, the saved credential may be stale.
The server name cannot be found. Check spelling and the instance name. Confirm you are on the corporate network or VPN. Ask your DBA whether the TCP/IP protocol is enabled for that instance and which port it uses.
Timeout or "unable to connect" for a remote or Azure server. The Azure SQL firewall may need your client IP added. On-premises servers usually need a firewall rule for the SQL Server port. This is an administrator task.
Authentication prompt keeps reappearing. A different privacy level or an unsupported authentication mix can cause repeated prompts. Check data source settings and confirm every source uses compatible credentials.
Data looks wrong after loading. Wrong types or a missed relationship is the usual cause. Go back to Power Query, set types, and check the Model view. If you already loaded the wrong data, use Transform Data to correct the query and refresh.
Refresh is slow or the file is huge. Remove unused columns and rows in Power Query, or switch to DirectQuery if the database can handle the query load. If DirectQuery is slow, ask the DBA to add indexes on the filtered or joined columns.
Frequently Asked Questions
Do I need a gateway?
For Power BI Desktop, no—Desktop talks to the server directly from your PC. A gateway is needed for scheduled refresh of an on-premises SQL Server from the Power BI service, because the cloud service cannot reach your internal network on its own.
Can I connect with Windows authentication?
Yes, provided your machine and the server are in a compatible domain setup or the server accepts the credentials you supply. If the automatic Windows login fails, use the Database login type or check with your DBA.
What is the difference between Import and DirectQuery?
Import copies data into the report file and works offline; DirectQuery queries the database live on each view or refresh. Import is usually faster for reporting; DirectQuery suits large or frequently changing data and environments where data must stay in the database.
Can I query only part of a table?
Yes. In Power Query, expand the table and filter rows or remove columns before loading, or write a custom query using the Advanced option when connecting. You can also point at a database view that returns only what you need.
Does Power BI work with Azure SQL Database?
Yes, use the same SQL Server connector and enter the *.database.windows.net server name. The main extra step is allowing your client IP in the Azure SQL firewall.
Why does the Power BI service ask me to sign in again?
The service does not hold your desktop credentials. It uses the connection saved in a published dataset or gateway. Re-enter credentials in the dataset settings in the service, or update them in the gateway configuration.