Sub topic 12
Network ports, the service account, and security considerations
This chapter assumes you have read how the gateway connects to the Power BI service and that you know basic Windows services and firewall concepts. It covers the network rules a gateway needs, the account it runs under, and the main security choices you make when you deploy one.
Outbound-only connectivity
The gateway never accepts inbound connections from the internet. It opens outbound connections to Azure Service Bus and to the Power BI service. Because of this, you do not create inbound firewall rules or port forwards for it.
The ports you must allow outbound from the gateway machine are:
| Port | Protocol | Purpose |
|---|---|---|
| 443 | TCP | HTTPS traffic to the Power BI service and Microsoft Entra ID sign-in |
| 5671, 5672 | TCP | Advanced Message Queuing Protocol (AMQP) to Azure Service Bus |
| 9350 to 9354 | TCP | Service Bus listeners |
If the gateway cannot use the Service Bus ports, it falls back to HTTPS over port 443. This fallback is slower, so open the Service Bus ports when you can.
Microsoft publishes the exact host names and IP ranges, and they change over time. Check the current list before you write firewall rules.
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 9350If TcpTestSucceeded is True, the firewall allows outbound traffic on that port. If it is False, a firewall or proxy is blocking it. The gateway's built-in network test (in the gateway app, under Diagnostics) checks the ports for you and reports whether it is using the direct or the HTTPS path.
The service account
The gateway runs as a Windows service. By default it uses the account NT SERVICE\PBIEgwService, a virtual service account that exists only on that machine and has no password to manage.
You can change the account in the gateway app, under Service Settings. Change it only when you need to, for example when a data source uses Windows authentication and the gateway must connect as a domain identity. In that case:
- Create a domain account with the minimum rights it needs.
- Grant it the "Log on as a service" right on the gateway machine.
- Give it read access to the data sources it will query.
- Enter the account in the gateway app and restart the service.
Do not use a domain administrator account. If someone compromises the gateway, they gain every right that account has.
Security considerations
- Credentials are encrypted. When you save data source credentials in the Power BI service, they are encrypted with keys held by the gateway. The service stores only the encrypted values, and the gateway decrypts them on your network.
- Protect the machine. Anyone with administrator rights on the gateway machine can reach the gateway's cached credentials and logs. Restrict who can sign in.
- Limit who can use a data source. In the gateway data source settings, add only the users who need to publish datasets that use it.
- Use a dedicated, least-privilege database login. Give the gateway data source a read-only account that can see only the tables the reports need.
- Keep the gateway updated. Updates include security fixes. Gateway maintenance is covered in a later chapter.
- Use a proxy carefully. If your network forces traffic through a proxy, configure it in the gateway's configuration files. Test again afterwards.
Exercise
A gateway refresh fails. Test-NetConnection to watchdog.servicebus.windows.net on port 9350 returns TcpTestSucceeded False, but port 443 works. Does the gateway stop working completely, and what should you do?
Show answer
No. The gateway can fall back to HTTPS over port 443, so it may still work, but more slowly. Ask the network team to allow outbound TCP on 5671, 5672 and 9350 to 9354 to Azure Service Bus. Do not open any inbound ports.
Exercise
Why should you avoid running the gateway service under a domain administrator account?
Show answer
If the gateway machine or service is compromised, the attacker inherits every right of that account. A least-privilege account limits the damage.