Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

Power BI "Your data gateway is offline or couldn't be reached": find why the gateway is offline

Technical article
Troubleshooting

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

The Power BI service shows "Error: Your data gateway is offline or couldn't be reached" when it cannot get an answer from the on-premises data gateway, and Manage connections and gateways shows the gateway as offline for the same reason. Microsoft lists this as a connectivity error with several possible causes. On the gateway machine, check that the gateway Windows service is running, run the Network ports test, check HTTPS mode if the firewall allows only ports 80 and 443, and check the gateway version.

What the error means

Microsoft's troubleshooting page lists three connectivity symptoms: "Error: Gateway shows offline status in Manage Gateways page", "Error: Your data gateway is offline or couldn't be reached" (seen as a data refresh error), and "Error: Network request returned unexpected error" (seen when signing in to the gateway configurator). It says: "Connectivity issues can have several different causes."

The gateway only makes outbound connections. Microsoft's communication page says: "The gateway relies on Azure Relay for cloud connectivity" and "The gateway doesn't require inbound ports." If something on the path stops those outbound connections, the Power BI service sees the gateway as offline.

In a cluster, the service always uses the primary gateway "unless that gateway isn't available", and then uses another member. Microsoft recommends disabling or removing an offline member, because otherwise the service "might try to execute a query on that offline member" first, which can slow requests.

Likely causes

Cause What you see How to confirm
The gateway Windows service is not running Offline status; the service shows Stopped Services app on the gateway machine
A firewall blocks outbound ports Network ports test fails, with ports shown as Closed Network ports test results in the gateway app
The firewall allows only ports 80 and 443 while the gateway uses TCP Test shows the other Azure Relay ports closed HTTPS mode in the gateway app
The proxy is not configured, or differs between configuration files Offline status on a machine that sits behind a proxy The proxy configuration files and the proxy's own logs
The proxy needs a domain account Authentication errors at the proxy Proxy logs
The gateway version is out of support, or members of a cluster differ Failures after months without an update Gateway version against Microsoft's six supported releases
An offline member in a cluster Slow or failed requests in a cluster Cluster member status in the gateway pages

Prove the cause before changing anything

Every step here only reads.

  1. In the Power BI service, select the Settings icon, then Manage connections and gateways. Note whether the gateway shows as offline or online.
  2. On the gateway machine, open the Services app. Microsoft's FAQ says the service is called "On-premises data gateway service", with the service name PBIEgwService. A good result is Running.
  3. In the On-premises data gateway app, select Diagnostics. Under Network ports test, select Start new test. When "Start new test" reappears, the test has finished. The result is "Completed (Succeeded)" or "Completed (Failed, see last test results)". Select "Open last completed test results": any port shown as "Closed" needs checking, and Microsoft says to make sure the network environment did not block those connections.
  4. Microsoft adds that "Firewalls often intermittently allow traffic on blocked sites", so a passing test does not rule out a firewall rule.
  5. Open Event Viewer on the gateway machine, expand Applications and Services Logs, and select On-premises data gateway service.
  6. To keep the logs for a support ticket, select Diagnostics in the gateway app, then the Export logs link. The file is saved as a .zip in the ODGLogs folder on the Windows desktop.

On versions, Microsoft supports "only the last six releases" and releases an update every month.

Example (illustrative): on gw01, the Power BI refresh for Example Pty Ltd's sales model fails with "Your data gateway is offline or couldn't be reached", and Manage connections and gateways shows the gateway as offline. In the Services app on gw01, "On-premises data gateway service" shows Stopped. The Network ports test is not the problem: it returns "Completed (Succeeded)". Restarting the service from Service Settings brings the gateway back online, and the next refresh completes.

Fix

Match the fix to the cause you proved.

The service is stopped

Microsoft lists three ways to restart the service: the gateway app's Service Settings, the Services app, or an administrator Command Prompt.

First save the current state: write down the gateway's status in Manage connections and gateways, whether a refresh is running now, and the time.

Disruptive step: the next action restarts the gateway Windows service. A restart cannot be undone. Our own advice: restart it at a time when no refresh is running, which is why the save step records that.

In the gateway app, select Service Settings, then select Restart now.

Only if you need to back out: a restart has no earlier state to return to. If the gateway stays offline, go back to the checks above.

The firewall allows only ports 80 and 443

Microsoft says that if the firewall is "just allowing the communication on ports 80 and 443", "ensure the HTTPS mode in gateway is enabled". It says new installations since the June 2019 release default to HTTPS, and that this default "doesn't apply to updated installations". It also says "If the gateway can't communicate by using TCP, it automatically uses HTTPS", and that the selection in the app "always reflects the current protocol value", so look at the Network page before you change anything.

First save the current state: write down whether HTTPS mode in the gateway app is on or off, and the time.

Disruptive step: turning on HTTPS mode and selecting Apply restarts the gateway Windows service automatically, because Microsoft says "the gateway Windows service restarts automatically so that the change can take effect". Our own advice: apply it at a time when no refresh is running.

In the gateway app, select Network, turn on HTTPS mode, and select Apply.

Disruptive step, only if you back out: setting HTTPS mode back and selecting Apply restarts the gateway Windows service again, and the change you made is lost.

To undo it, set HTTPS mode back to the value you wrote down and select Apply.

The firewall, proxy or version needs a change by the person who owns it

Microsoft describes these fixes, which are changes to other systems:

  • Required outbound ports: "TCP 80, 443, 1433, 5671, 5672, and from 9350 through 9354", plus the host names in the communication page. If the firewall does not support wildcards, Microsoft says to use the Azure IP lists, which "need to be kept in sync each month".
  • Proxy: the first two configuration files, enterprisegatewayconfigurator.exe.config and Microsoft.PowerBI.EnterpriseGateway.exe.config, "must be edited so that proxy configurations are exactly the same in both files". A proxy that needs a domain account is handled by changing the gateway service account to a domain user.
  • Version: Microsoft's update page says to download the latest installer, or to use Update in the Manage Gateways section. For a cluster it says to disable one member, wait for work to finish ("30 minutes is sufficient for most workloads"), update it, enable it, and repeat for each member.

Confirm the fix

  1. Manage connections and gateways shows the gateway as online.
  2. The Network ports test returns "Completed (Succeeded)".
  3. After the next scheduled refresh, the refresh completes without the error. This check only reads.

What to watch afterwards

Risks and limits

  • These commands have not been run or lab-tested. The steps follow Microsoft's pages.
  • Our own advice: restart the gateway service outside refresh windows.
  • Microsoft's port and host lists change; check the current communication page before changing a firewall.

Sources