Sub topic 13
Keeping a gateway healthy: updates, recovery key, and logs
An on-premises data gateway runs for months with little attention, which is why it tends to be neglected. Then a refresh fails, the server is replaced, or someone asks which version is installed, and nobody knows the answer. This chapter covers the three routine tasks that prevent those situations: updating the gateway, protecting the recovery key, and reading logs.
It assumes you have already installed a standard-mode gateway, mapped a dataset to it, and read refresh history. You should also be comfortable with Windows services and the Event Viewer.
Updating the gateway
Microsoft ships a new gateway release roughly every month. Releases fix bugs, patch security issues, and add support for newer connectors and authentication methods. Two rules matter in practice:
- The gateway does not update itself. The gateway app shows a notice when a newer version exists, but someone has to install it.
- Microsoft supports only the most recent six releases. A gateway older than that can still run, but support will ask you to update before they investigate.
To update, download the current installer from the Power BI service download menu and run it on the gateway machine. The installer detects the existing installation and upgrades it in place. The registration, the recovery key, the data sources, and the cluster membership are all kept, so you do not need to re-register.
Plan the update around your refresh schedule. The gateway service restarts during the upgrade, so a refresh that is running at that moment will fail. Check the schedules of the datasets that use the gateway and pick a quiet window.
Updating a cluster
Every member of a gateway cluster should run the same version. Mixed versions can cause errors that appear only when a request lands on one particular member. Update the members one at a time instead of all at once. While one member restarts, the other members keep serving requests, so refreshes continue.
The diagram shows the sequence for a two-member cluster.
The recovery key
During installation you choose a recovery key. The key is tied to the gateway cluster. You need it in three situations:
- Restoring a gateway on a new machine after the original fails.
- Migrating a gateway to different hardware.
- Adding another member to an existing cluster.
Microsoft does not store the key and cannot recover or reset it for you. If you lose the key and the machine, you cannot take over the old gateway. You would have to install a new gateway, then recreate every data source and remap every dataset by hand.
Restoring on a new machine
The restore path avoids rebuilding data sources, because the data source definitions and their stored credentials live in the Power BI service, not on the machine. The new installation just reattaches to them.
- Install the gateway on the new machine and sign in with a Power BI account.
- Choose Migrate, restore, or take over an existing gateway instead of registering a new one.
- Select the gateway cluster from the list.
- Enter the recovery key.
- Stop or uninstall the old gateway if it is still running, so that two machines do not serve the same registration unintentionally.
After the restore, check each data source with Test connection on the Manage connections and gateways page. A restored gateway can still fail if the new machine cannot reach the source, for example because the firewall or DNS differs from the old server. Windows-authenticated sources also depend on the gateway service account, so confirm that the account can reach them.
Checking the service
Everything the gateway does depends on one Windows service, named PBIEgwService. Most unexplained failures turn out to be that the service is stopped, or that it runs as a different account than expected. This script reports the state and the account, and the second part restarts it.
Get-CimInstance -ClassName Win32_Service -Filter "Name='PBIEgwService'" |
Select-Object Name, State, StartMode, StartName
# Restart the service (run in an elevated session)
Restart-Service -Name PBIEgwServiceThe default account is NT SERVICE\PBIEgwService. If your organization changed it to a domain account, a password expiry on that account will stop the service from starting. Watch for this if the gateway fails exactly on a password rotation date.
A restart is also the usual first step after changing proxy settings or the configuration files, because the service reads them at start-up.
Reading logs
The gateway gives you three places to look, in order of how often you will need them.
The Diagnostics tab
Open the gateway app on the machine and go to Diagnostics. It offers:
- Additional logging, which raises the log detail level.
- Export logs, which bundles the log files into a ZIP archive you can share with support or review yourself.
- Network ports test, which tries the outbound connections the gateway needs and reports which ones fail. It checks the same ports as the
Test-NetConnectioncommand from the network chapter, but across the whole set.
Additional logging
The default level records errors and key events. When a failure is intermittent or the error message is vague, turn on additional logging, reproduce the failure, export the logs, and turn logging off again. Detailed logging can record query-level information and grows quickly, which costs disk space and a little performance. Leaving it on permanently is a common mistake.
Event Viewer
The gateway also writes to the Windows event log. Open Event Viewer and look under Applications and Services Logs for the on-premises data gateway service entries. These are useful for start-up failures, such as the service being unable to authenticate or reach the cloud, because those happen before the gateway has much to put in its own files.
Matching logs to a failed refresh
Start from the refresh history, not the logs. The history gives you the dataset, the start time, and the error code. Then open the exported logs and search near that timestamp. Compare time zones first, because refresh history shows times in the service's time zone and the log timestamps follow the gateway machine's setup. A mismatch of a few hours sends many people to the wrong lines.
A maintenance routine
A small recurring routine is enough for most gateways:
| Frequency | Task | Why |
|---|---|---|
| Monthly | Check for a new release and update during a quiet window | Stay inside the support window and receive fixes |
| Each change | Record the recovery key and gateway name in a vault | Make restores possible |
| Quarterly | Test a restore plan on paper, or restore to a test machine | Find missing steps before an outage |
| After failures | Export logs, then turn off additional logging | Keep disk use and overhead low |
| After account changes | Confirm the service account can still start the service | Prevent silent stops |
Exercise
Your gateway server's disk failed and the machine is gone. You have the recovery key. Which installer option do you choose on the replacement server, and what do you not need to recreate?
Show answer
Choose "Migrate, restore, or take over an existing gateway", select the cluster, and enter the recovery key. You do not need to recreate the data sources or remap the datasets, because their definitions and stored credentials are held in the Power BI service. You should still test each data source connection afterward.
Exercise
A scheduled refresh fails intermittently at night with a vague error. Describe how you would collect evidence without leaving the gateway in a degraded state.
Show answer
Read the failed attempt's time and error code in refresh history. Turn on additional logging in the gateway app's Diagnostics tab, wait for or trigger the failure, then use Export logs and search near the failure timestamp, allowing for time zone differences. Turn additional logging off afterward so it does not consume disk space or slow the gateway.