If you are stressing over data analysis and manually carrying out query statements or manual imports, why not consider using the Power BI Data Gateway? With Power BI Data Gateway, you can simplify and virtualize data analysis.
In this tutorial, you will learn how to set up data sources seamlessly and efficiently using Azure SQL Server and On-premises data gateway.
Improve your day-to-day data visualization by connecting sources to your Power BI Data Gateway!
Prerequisites
This tutorial will be a hands-on demonstration. To follow along, be sure you have the following:
- Power BI installed on your local machine, the version in this tutorial is 2.97.
- An account on the Azure Portal.
Connecting On-premises to Power Bi Data Gateway
On-premises data gateway bridges the gap between Power-Bi and cloud-related apps or software, creating a path where you can securely move your data from one end to another. Although the gateway is not responsible for transferring data, the gateway creates a server or a medium to transfer your data.
Before connecting the on-premises data gateway to Power BI, you must install the standard gateway on your local machine.
Check the requirements for On-Premises Gateway installation.
1. Download the standard gateway file, and open the installer once downloaded.
![Installing On-premises data gateway](https://adamtheautomator.com/wp-content/uploads/2022/09/image-395.png)
2. Next, provide the email address you want to connect to the gateway and click Sign In. Ensure the email address is the same as the one connected to your Power Bi account.
![Providing an email address to use with the on-premises data gateway](https://adamtheautomator.com/wp-content/uploads/2022/09/image-396.png)
3. Once signed in, choose the Register a new gateway on this computer option, and click Next. This option creates a new gateway on the On-premises data gateway.
![Choosing to register a new gateway](https://adamtheautomator.com/wp-content/uploads/2022/09/image-397.png)
4. Now, configure the on-premises data gateway with the following:
- Provide an on-premises data gateway name.
Optionally, tick the Add to an existing gateway cluster box to add the data gateway to an existing cluster.
- Provide, and confirm a Recovery key that consists of a minimum of eight characters. This key is stored and used to verify your ownership when you lose access to the on-premises gateway.
- Click Configure to save your settings and set up your created on-premises data gateway.
![Configuring the new on-premises data gateway](https://adamtheautomator.com/wp-content/uploads/2022/09/s_4D0AC2581413F5E2F4FAF8B7493F1778175F726762528B77E00BAACAFD0A4E24_1660070893795_image-2.png)
Below, you can see a page that confirms your gateway has been configured and is ready for use.
![Confirming the gateway configuration is successful](https://adamtheautomator.com/wp-content/uploads/2022/09/s_4D0AC2581413F5E2F4FAF8B7493F1778175F726762528B77E00BAACAFD0A4E24_1660071071912_image.png)
5. Open your Power BI app or workspace, click on the ellipsis (three dots) on the top-right → Settings → Manage gateways to access all your connected gateways or data sources.
![Connecting to Power BI](https://adamtheautomator.com/wp-content/uploads/2022/09/image-398.png)
6. Click the ellipsis next to your data gateway’s name and ensure the gateway is enabled from the blade that opens to the right.
The Enabled status, as shown below, indicates the gateway is active and online.
![Verifying successful connection of on-premises gateway on Power BI](https://adamtheautomator.com/wp-content/uploads/2022/09/image-399.png)
7. Next, click on the ellipsis again beside the data gateway and choose Settings to configure your gateway cluster settings.
![Configuring the gateway cluster](https://adamtheautomator.com/wp-content/uploads/2022/09/image-400.png)
8. Configure the settings below, but leave the Description and Department fields empty.
![Configuring the settings for the On-premises data gateway](https://adamtheautomator.com/wp-content/uploads/2022/09/image-401.png)
9. Lastly, tick all the boxes, and click Save to save the settings, and you have successfully connected the on-premises data gateway source to your Power BI account.
Now, you can easily send data through this source using SQL Server, Azure, or AWS data sources.
![Settings Page for Configured On-premises data gateways on Power Bi](https://adamtheautomator.com/wp-content/uploads/2022/09/image-402.png)
Connecting Azure SQL Database to Power BI
By connecting Azure and Power BI, you can perform data processing into analytics and report that provides real-time insight into any business or company. They both can develop complex business and intellectual solutions using built-in connectivity.
Don’t worry. You don’t need to write code to connect Azure tools and software to Power BI.
1. On the Azure Portal, search for Azure SQL and select the Azure SQL service that comes up to access Azure SQL.
![Searching for Azure SQL](https://adamtheautomator.com/wp-content/uploads/2022/09/image-403.png)
2. On the Azure SQL page, click Create Azure SQL resource, which opens a configuration setting for the Azure SQL resource page.
![Creating a resource for Azure SQL](https://adamtheautomator.com/wp-content/uploads/2022/09/image-404.png)
3. Click Create under SQL databases to create a single database.
![Choosing a database type](https://adamtheautomator.com/wp-content/uploads/2022/09/image-405.png)
4. Provide a descriptive Database name, and click on the Create new link to create a new server first.
![Creating an SQL database](https://adamtheautomator.com/wp-content/uploads/2022/09/image-406.png)
5. Input a unique server name, and select a location nearest to you.
![Creating server for SQL database](https://adamtheautomator.com/wp-content/uploads/2022/09/image-407.png)
6. Scroll down to the Authentication section, and configure the authentication with the following:
- Authentication method – Choose the Use SQL authentication.
- Server admin login, Password, Confirm password – Provide an admin name (server-admin) and password.
- Click OK to create SQL admin details for our SQL database.
![Creating a SQL database admin details](https://adamtheautomator.com/wp-content/uploads/2022/09/image-408.png)
7. Back to the database settings, select the created server as the server, leave other options on default, and click Review + Create.
Your browser redirects to a page where you can review the configured settings for the database (step eight).
![Confirming configured database settings](https://adamtheautomator.com/wp-content/uploads/2022/09/image-409.png)
8. Review the configured settings for your database and click Create to create the SQL database, which takes some time to complete.
Once created, your browser redirects to a page where you can see the deployment status (step nine).
![Confirming SQL database details](https://adamtheautomator.com/wp-content/uploads/2022/09/image-410.png)
9. After successful deployment, click Go to resource to access the newly-created resource.
![Accessing the newly-created resource](https://adamtheautomator.com/wp-content/uploads/2022/09/image-411.png)
10. Once the resource’s dashboard, click Compute + Storage under the Settings section (left panel) to initiate configuring your SQL server storage settings.
![Accessing the SQL database settings](https://adamtheautomator.com/wp-content/uploads/2022/09/image-412.png)
11. Now, select the Serverless option to make your database auto-scale and cost less.
![Settings the tiers for SQL database](https://adamtheautomator.com/wp-content/uploads/2022/09/image-413.png)
12. Drag the slider to minimize the data size, as shown below, and click Apply to save the settings. This tutorial uses 15GB for demonstration.
![Changing data size](https://adamtheautomator.com/wp-content/uploads/2022/09/image-414.png)
13. Back to the resource’s dashboard, click on Set server firewall to initiate setting up a firewall to access your data from the Power BI desktop and visualize your data.
![Accessing firewall on SQL database](https://adamtheautomator.com/wp-content/uploads/2022/09/image-415.png)
14. Under the Public access tab, click Selected networks to add an IP address.
![Adding a network to access the SQL database](https://adamtheautomator.com/wp-content/uploads/2022/09/image-416.png)
15. Next, scroll down to the Firewall rules section, click on Add your client IPv4 address or set the start IP address and end IP address to 0.0.0.0.
Once you’ve added your client IP address, click Save to save the configuration.
![Adding a client IPv4 to access the SQL database](https://adamtheautomator.com/wp-content/uploads/2022/09/image-417.png)
Once done, you will see the confirmation message shown below.
![Verifying firewall configuration success](https://adamtheautomator.com/wp-content/uploads/2022/09/s_4D0AC2581413F5E2F4FAF8B7493F1778175F726762528B77E00BAACAFD0A4E24_1660321800980_image.png)
Creating Data in Azure SQL Database to Visualize
You now have an Azure SQL database and a server, and you’re ready to dig into creating data or querying the database to visualize on Power BI. The Azure SQL server offers a query editor that lets you write queries, create tables, and add data to created tables.
To start creating data in Azure SQL database:
1. On your resource’s dashboard, click Query editor to add a query.
![Adding data to the SQL database](https://adamtheautomator.com/wp-content/uploads/2022/09/s_4D0AC2581413F5E2F4FAF8B7493F1778175F726762528B77E00BAACAFD0A4E24_1660322079149_image.png)
2. When prompted, provide the SQL admin details you set in step six of the “Connecting Azure SQL Database to Power BI” section, and click OK to sign in.
![Signing into SQL query editor](https://adamtheautomator.com/wp-content/uploads/2022/09/s_4D0AC2581413F5E2F4FAF8B7493F1778175F726762528B77E00BAACAFD0A4E24_1660322179139_image.png)
Once signed in, you will see a query editor like the one below.
![](https://adamtheautomator.com/wp-content/uploads/2022/09/image-418-1024x399.png)
3. Copy and paste the following query to the SQL query editor, which creates four tables named Person, Student, Course, and Credit.
-- Create a User Table
CREATE TABLE Person
(
PersonId INT IDENTITY PRIMARY KEY,
FirstName NVARCHAR (128) NOT NULL,
MiddleInitial NVARCHAR(10),
LastName NVARCHAR(128) NOT NULL,
DateOfBirth Date NOT NULL,
)
-- Create Student Table
CREATE TABLE Student
(
StudentId INT IDENTITY PRIMARY KEY,
PersonId INT REFERENCES Person (PersonId),
Email NVARCHAR(256),
)
-- Create a Course Table
CREATE TABLE Course
(
CourseId INT IDENTITY PRIMARY KEY,
Name NVARCHAR(50) NOT NULL,
Teacher NVARCHAR (256) NOT NULL,
)
-- Create Credit Table
CREATE TABLE Credit
(
StudentId INT REFERENCES Student (StudentId),
CourseId INT REFERENCES Course (CourseId),
Grade DECIMAL(5,2) CHECK (Grade <= 100),
Attempt TINYINT,
CONSTRAINT [UQ_studentgrades] UNIQUE CLUSTERED
(
StudentId, CourseId, Grade, Attempt
)
)
4. Now, click on Run to execute the query.
![Executing the query](https://adamtheautomator.com/wp-content/uploads/2022/09/image-419.png)
5. Click OK to close and continue querying when prompted with the certificate associated with your Azure account, as shown below.
![Confirming certificate](https://adamtheautomator.com/wp-content/uploads/2022/09/image-420.png)
6. Next, click Run again to execute the query in the editor. Once successful, you will see the Query succeeded message at the bottom of the query editor section.
You can see the tables created after running the query on the left panel.
![Confirming SQL query](https://adamtheautomator.com/wp-content/uploads/2022/09/image-421.png)
7. Select the dbo.Course table, and run the following query, which returns 100 records.
SELECT TOP (100) * FROM [dbo].[Course];
![Accessing the Tables folder on the SQL database](https://adamtheautomator.com/wp-content/uploads/2022/09/s_4D0AC2581413F5E2F4FAF8B7493F1778175F726762528B77E00BAACAFD0A4E24_1660832125064_image.png)
8. Now, select the dbo.Course under Tables (left panel), click the ellipsis (three dots) → Edit Data (Preview) to access the table’s data.
![Creating a new row](https://adamtheautomator.com/wp-content/uploads/2022/09/image-422.png)
9. Finally, click Create New Row to add data to the table, and click on the Save button to save the new data.
![Adding data to the dbo.Course table](https://adamtheautomator.com/wp-content/uploads/2022/09/image-423.png)
Visualizing Data from Azure SQL Database to Power BI
What better ways to achieve data analysis? Visualizing data from Azure SQL database to Power BI will surely pique your interest.
To visualize your data on Power BI:
1. Click Power BI on your Azure Portal’s overview page → Get started, and a .pbids file will be downloaded.
Double-click on the downloaded .pbids file to open it on your Power BI desktop.
![Connecting to Power BI](https://adamtheautomator.com/wp-content/uploads/2022/09/image-424.png)
2. Next, select Database (left panel), provide your SQL admin and password and click Connect to connect to your SQL Azure database.
Once connected, a new page pops up to see the data on your Azure SQL database (step three).
![Connecting to SQL database](https://adamtheautomator.com/wp-content/uploads/2022/09/image-425.png)
3. Tick the box of the Course table, and click Load to load the table’s data on Power BI.
![Loading data of the Course table](https://adamtheautomator.com/wp-content/uploads/2022/09/image-426.png)
You can find your loaded data under the Fields section on the right side of your Power Bi desktop.
4. Finally, select all columns on the Course table under the Fields section, and a visual pop-up showing the selected table’s data, as shown below.
![Visualizing selected data](https://adamtheautomator.com/wp-content/uploads/2022/09/s_4D0AC2581413F5E2F4FAF8B7493F1778175F726762528B77E00BAACAFD0A4E24_1660836842927_image.png)
Perhaps you like to change how to visualize your data. If so, select a visual type (like a Pie chart) under the Visualizations panel, as shown below.
![Changing data visualization](https://adamtheautomator.com/wp-content/uploads/2022/09/s_4D0AC2581413F5E2F4FAF8B7493F1778175F726762528B77E00BAACAFD0A4E24_1660837430297_image.png)
Conclusion
Power BI has more than twenty data sources. But with this tutorial, connecting your Azure data has never been easier. At this point, you can now quickly send your data from SQL Server using the on-premises data gateway to Power BI.
At this point, you never have to worry about visualizing data from Azure or SQL servers. Besides using Power BI Data Gateway for businesses, will you consider this tool beautifully visualizing data for your IT monitoring tools?