How to Fix Power BI Gateway Access Denied for a PDF File
Question details
The user needs to resolve an access denied error preventing a Power BI dataset from refreshing when connecting to a PDF file stored in a OneDrive folder.

- Product
- Power BI
- Device & OS
- not provided
- Scenario
- Refreshing a Power BI dataset via an On-premises data gateway that connects to a local or OneDrive-synced PDF file.
- Observed behavior
- The gateway reports that access to the PDF file is denied, causing the dataset refresh process to fail.
Ensure you have administrator privileges on the machine hosting the Power BI Gateway and that you know which Windows service account the gateway uses to run.
Grant Folder and File Permissions to the Gateway Service Account
Assign the correct read permissions to the Power BI Gateway account so it can access the OneDrive directory where the PDF is stored.
The most common reason for this error is that the Windows service account running the On-premises data gateway lacks NTFS read permissions for the specific OneDrive folder or the PDF file itself.
Open the Windows Services app (services.msc) on your gateway machine. Locate 'On-premises data gateway service' and check the 'Log On As' column to find the exact account name.
Navigate to the OneDrive folder containing your target PDF file, right-click the folder, and select 'Properties'.
Switch to the 'Security' tab and click 'Edit' to change permissions. Click 'Add' to enter the gateway service account name you found earlier.
Select the newly added account, check the boxes for 'Read' and 'List folder contents' under the Allow column, and click 'Apply' then 'OK' to save.

Verify OneDrive Sync Status and Remove File Locks
Ensure the PDF is fully downloaded to the local drive and is not locked by another application.
Manage and Edit PDF Files Seamlessly with WPS Office
While resolving backend data gateway issues, you can simplify your daily document management with WPS Office. It is a lightweight, all-in-one suite that perfectly handles PDFs, Word documents, Excel spreadsheets, and PowerPoint presentations without locking up your sync folders.
- 1. Download the Installer: Visit the official WPS Office website and download the free installer for your operating system.
- 2. Install and Launch: Run the setup file and follow the on-screen instructions to install the application in minutes.
- 3. Open Your Files: Double-click any PDF or Office document to open, view, and edit it instantly with a highly familiar user interface.

Frequently Asked Questions
Why does Power BI Gateway say access denied for a local PDF file?
This error occurs because the specific Windows service account used by the On-premises data gateway does not have NTFS read permissions for the file path, or the file is locked by another program.
Can I use OneDrive files with the On-premises data gateway?
Yes, but the files must be physically synced to the local drive of the gateway machine. Using the 'Always keep on this device' option in OneDrive ensures the file is accessible.
How do I find out which account is running the Power BI Gateway?
Open the Windows Services application (services.msc), locate the 'On-premises data gateway service', and check the 'Log On As' column. By default, it might be 'NT SERVICE\PBIEgwService'.
Does having a PDF file open prevent Power BI from refreshing?
Yes. If a PDF file is actively open in a viewer that places an exclusive lock on the file, the gateway cannot read it, which will result in an access denied or locked file error during refresh.




