Sub topic 5
How the gateway connects to the Power BI service
This chapter assumes you know what a gateway is for (covered in the previous chapters) and that you can read a basic firewall rule. It explains how the gateway talks to the Power BI service, so you can predict what network access it needs.
The gateway only makes outbound connections
The gateway runs on a machine inside your network. It does not listen for incoming requests from the internet. Instead, it opens outbound connections to Azure Service Bus, a cloud messaging service. The Power BI service never connects to your data source directly. It leaves a request in Service Bus, and the gateway picks it up.
This is why you normally don't open any inbound firewall port for a gateway. You only have to allow outbound traffic.
What happens during a refresh
When a scheduled refresh starts, these steps occur:
- The Power BI service reads the dataset's gateway data source settings. It encrypts the stored credentials and creates a query request.
- The service places the request in an Azure Service Bus queue.
- The gateway, which keeps an outbound connection open to Service Bus, receives the request.
- The gateway decrypts the credentials and connects to the data source on your network.
- The gateway runs the query, then sends the results back to the Power BI service over the same outbound channel.
Ports the gateway uses
The gateway needs these outbound TCP ports:
| Port | Used for |
|---|---|
| 443 | HTTPS traffic to Microsoft services |
| 5671, 5672 | Advanced Message Queuing Protocol (AMQP) to Service Bus |
| 9350 to 9354 | Service Bus relay listeners |
If your firewall allows only port 443, the gateway can fall back to HTTPS mode. This is usually slower, and the other ports are recommended.
Testing connectivity
Run this on the gateway machine to check that one of the Service Bus ports is reachable:
Test-NetConnection -ComputerName watchdog.servicebus.windows.net -Port 9350Look for TcpTestSucceeded : True in the output. If it says False, a firewall or proxy is blocking the traffic.
Common errors
- Gateway shows offline in the service. The gateway service may be stopped, or outbound traffic to Service Bus is blocked. Check the Windows service first, then the firewall.
- Proxy in the way. If your network requires a proxy, the gateway needs proxy settings in its configuration files. Without them, outbound connections fail even when the ports are open.
- Allowing by IP address only. Service Bus addresses change. Prefer allowing by fully qualified domain name where your firewall supports it.
- Inbound rules added by mistake. They are unnecessary and widen your attack surface.
Exercise
Your security team asks whether they must open an inbound firewall port so the Power BI service can reach the gateway. What do you answer, and which direction of traffic do you need to allow?
Show answer
No inbound port is needed. The gateway opens outbound connections to Azure Service Bus and receives requests through them. Allow outbound TCP on 443, 5671, 5672, and 9350 to 9354 from the gateway machine.