Sub topic 6
Installing and registering a gateway
This chapter covers installing a standard-mode on-premises data gateway on a Windows machine and registering it with the Power BI service. It assumes you can already tell when a dataset needs a gateway, and that you know the difference between standard and personal mode. You should also be comfortable with Windows services, local administrator rights, and outbound firewall rules. Adding data sources and mapping datasets comes in the next chapter. Here the goal is a gateway that shows as online in the service.
What installation actually does
The installer puts a Windows service on the machine. The service is named "On-premises data gateway service" (service name PBIEgwService) and runs as NT SERVICE\PBIEgwService by default. The service does not listen for inbound connections. It makes outbound connections to Azure Service Bus and waits for the Power BI service to send it queries.
Registration is the step that links this local service to your tenant. During registration you sign in, name the gateway, and set a recovery key. The service then creates a gateway object in the Power BI service, and that object appears under Manage connections and gateways.
Choose the host machine
The host machine matters more than the installer does. Most gateway problems later come from a poor choice here.
- Operating system: a 64-bit supported Windows version, such as Windows Server 2019 or later. Check Microsoft's current requirements before you install, because the supported list changes.
- .NET: a current .NET Framework 4.8 or later is required. The installer tells you if it is missing.
- Sizing: Microsoft recommends at least 8 CPU cores and 8 GB of RAM for production use. Gateways that run heavy refreshes in parallel use a lot of memory.
- Always on: the machine must not sleep, hibernate, or shut down. A gateway on a laptop that closes at 6 p.m. will fail the 7 a.m. refresh.
- Wired network: a wireless connection adds latency and drops that show up as intermittent refresh failures.
- Not a domain controller: do not install a gateway on a domain controller.
- Close to the data: place the host in the same network and region as the data sources. Data moves from the source through the gateway, so distance adds refresh time.
Install the gateway on a server, not on the machine where you author reports in Power BI Desktop.
A standard-mode gateway and a personal-mode gateway can coexist on one machine. You cannot install two standard-mode gateways on the same machine. To get more capacity or redundancy, install on additional machines and join them to a cluster, which a later chapter covers.
Download and install
- Sign in to the Power BI service, open the Download menu (the down-arrow icon), and choose Data Gateway. You can also download the installer from Microsoft's download center.
- Run the installer as a user with local administrator rights.
- Choose On-premises data gateway (recommended). The other option is personal mode. Personal mode is tied to one user, cannot be shared, and does not support DirectQuery, so do not pick it for production datasets.
- Accept the default install path (
C:\Program Files\On-premises data gateway) unless your standards require otherwise. Accept the terms and install. - When the gateway app opens, enter the email address of the work account to sign in.
If the machine uses a proxy, the gateway needs its proxy settings configured in the gateway's configuration files. Test with a direct connection first, and add proxy settings only if that fails.
Register the gateway
After you sign in, the app asks what you want to do.
- Register a new gateway on this computer is the choice for a first install.
- Migrate, restore, or take over an existing gateway reconnects a new machine to an existing gateway object. You need the recovery key to do this. Use it when a server is rebuilt and you want datasets to keep working without being remapped.
For a new gateway, set these values:
| Setting | Notes |
|---|---|
| Gateway name | Use a name that identifies the environment and machine, such as `prod-gw-01`. Names show up in dropdowns across the tenant. |
| Recovery key | At least 8 characters. Store it in a password manager or vault. |
| Region | Defaults to your tenant's home region. Change it only for a reason, because it determines which Azure Service Bus region the gateway uses. |
The account that registers the gateway becomes its first administrator. If that person leaves the company, the gateway is still there, but nobody who remains can manage it. Add at least one more admin after registration under Manage connections and gateways, and prefer a shared or role-based group over an individual.
Verify connectivity
When registration finishes, the app shows "The gateway is online and ready to be used." That message only says the service started and registered. It does not prove that every required port is open.
Open the gateway app and go to the Network tab, then select Start new test to run the built-in port test. You can also check from PowerShell on the gateway machine. This script checks the service state and tests the outbound ports the gateway uses against one Service Bus endpoint:
Get-Service -Name PBIEgwService | Select-Object Name, Status, StartType
$ports = 443, 5671, 5672, 9350, 9351, 9352, 9353, 9354
foreach ($port in $ports) {
Test-NetConnection -ComputerName watchdog.servicebus.windows.net -Port $port -WarningAction SilentlyContinue |
Select-Object @{Name = 'Port'; Expression = { $port }}, ComputerName, TcpTestSucceeded
}The service should show Running. TcpTestSucceeded should be True for 443 at minimum. The gateway falls back to HTTPS over port 443 when the other ports are blocked. That fallback works, but it is slower, so open the others if you can. Check Microsoft's current list of required endpoints, because they change over time.
Finally, in the Power BI service, open Settings (gear icon), then Manage connections and gateways, and select the On-premises data gateways tab. Your gateway should be listed with the status Online. If it does not appear, see the checks below.
Common errors
| Symptom | Likely cause | What to check |
|---|---|---|
| Installer fails on a prerequisite | Missing .NET Framework or unsupported OS | Install the required .NET version, then rerun. |
| Sign-in loops or fails | Proxy or TLS inspection blocks the sign-in endpoints | Test from a machine without the proxy. Allow the sign-in endpoints. |
| "Gateway name already in use" | Another gateway has the name | Pick a unique name. |
| Gateway not listed in the service | Registered in a different tenant, or different account | Check which account you signed in with. |
| Gateway shows Offline | Service stopped, machine asleep, or outbound ports blocked | Check the service, power settings, and run the network test. |
| Cannot restore on a new machine | Wrong recovery key | Recovery keys are exact. No reset is possible. |
After installation
A registered gateway holds no data sources yet, and no dataset can use it. The next step is to add a data source on the gateway, set its credentials, and map a published dataset to it. Treat the install as complete only when the gateway is online, a second admin exists, the recovery key is stored, and the network test passes.
Exercise
A colleague installs a gateway on a laptop, registers it, and sees "The gateway is online and ready to be used." Name two reasons this setup is likely to fail in production, and say what you would check on a server before relying on it.
Show answer
The laptop will sleep, hibernate, or go offline, so scheduled refreshes that run then will fail. It also likely sits on a wireless connection, which causes intermittent drops. On a replacement server, confirm that it is always on, wired, and not a domain controller. Also confirm that the PBIEgwService service is running, that the network test or Test-NetConnection shows outbound access on port 443 and ideally 5671, 5672, and 9350 to 9354, and that the recovery key is stored. The "online" message only shows that registration succeeded, not that the network paths work.
Exercise
Why should you add a second gateway administrator and record the recovery key right after registration?
Show answer
The person who registers the gateway is its first admin. If they leave, no one else can manage it. The recovery key cannot be retrieved later. Without it you cannot restore or migrate the gateway to a new machine, and you would have to recreate every data source and remap every dataset.