New: free Power BI model health check. Find what's making your numbers wrong and your model slow. Check your model →
← Back to Blog

Power BI Refresh Error: The Credentials Provided for the Data Source Are Invalid

The report refreshes fine in Desktop, then scheduled refresh in the Service fails with invalid credentials. The Service keeps its own copy of the sign-in, separate from yours. Here are the five usual causes, from an expired OAuth token to a gateway connection nobody updated.

Power BI ServiceTroubleshooting

The error shows up in two places. On the semantic model in the Service, as a banner:

Your data source can't be refreshed because the credentials are invalid.
Please update your credentials and try again.

And in the refresh history, with the source named:

Data source error: The credentials provided for the SharePoint source are invalid.
(Source at https://contoso.sharepoint.com/sites/Finance.)

The confusing part is that refresh still works in Power BI Desktop. That's because Desktop and the Service don't share a sign-in. Desktop connects as you, with credentials cached on your own machine. Publishing sends the report and the model, but not those credentials. The Service keeps its own stored credentials for every data source, and it's that separate copy that's wrong.

Where that copy lives depends on the source:

Cloud source (SharePoint, Azure SQL, a web API)
    -> stored on the semantic model: Settings > Data source credentials

On-premises source (SQL Server, a file share) through a gateway
    -> stored on the gateway connection: Manage connections and gateways

Start with the refresh history. It names the source that failed, which tells you which copy to fix. Then work through the causes below.

Cause 1: An Expired or Revoked OAuth Token

Cloud sources signed in with an organizational account (SharePoint, OneDrive, Excel Online, Dataverse, Azure SQL with Microsoft Entra sign-in) store an OAuth token, not a password. Tokens stop working on their own: after a password change, a new MFA or conditional access policy, a revoked session, or a long stretch without use. That's why this error often appears months after a report was published, with nothing changed in the report.

Fix: in the semantic model's Settings → Data source credentials, choose Edit credentials for the failing source, keep OAuth2 as the method, and Sign in again. That issues a fresh token.

For a report that has to keep refreshing, don't sign in with your personal account. Use a dedicated service account whose password doesn't rotate on a personal schedule, or a service principal where the source supports one, so the refresh doesn't break the next time you change your password.

Cause 2: The Credentials Belong to Someone Else

Stored credentials belong to the semantic model's owner, usually whoever published it first. If that person changed their password, lost access to the source, or left the organization, refresh fails for everyone, and only the owner can enter new credentials.

Fix: in the semantic model's settings, choose Take over to become the owner, then enter credentials under Data source credentials. Taking over also moves scheduled refresh to your name, so do it with the account that should own the refresh long term, not just whoever noticed the failure.

Cause 3: The Wrong Authentication Method

The Service asks for an authentication method as well as credentials, and the one that worked in Desktop isn't always the default. Common mismatches:

SourceDesktop usedService set toResult
SharePoint or OneDriveOrganizational accountAnonymous or BasicInvalid credentials
Web API with a keyAnonymous (key in the URL or header)OAuth2Invalid credentials
Azure SQLMicrosoft accountBasic with a SQL login that doesn't existInvalid credentials

Fix: check what Desktop actually used. In Desktop, File → Options and settings → Data source settings lists every source with its permissions; Edit Permissions shows the method. Choose the same method in the Service's Edit credentials dialog.

Cause 4: The Gateway Connection's Credentials

For on-premises sources, the semantic model's own credentials don't matter: refresh goes through the gateway, and the gateway connection stores its own username and password. Updating the model's settings won't help, and the error looks identical.

Two details catch people out:

  • Windows authentication on a gateway connection uses the account typed into the connection, not the account of whoever views the report or owns the model. If that account's password changed, every model using the connection fails at once.
  • The connection has to match the source exactly. A model that connects to sql01 doesn't map to a gateway connection for sql01.contoso.local, even though both reach the same server. The model then ends up on a different connection, or none.

Fix: go to Settings (gear) → Manage connections and gateways, find the connection, and update its credentials. (If the error says the gateway is offline or could not be reached instead, the gateway itself is down: see that error explained.) Check that the server and database names match the ones in the Desktop file character for character. See gateways and refresh for how connections and clusters are set up.

Cause 5: "Skip Test Connection" Saved Bad Credentials

The credentials dialog has a Skip test connection checkbox. With it ticked, the Service saves whatever you type without checking it, and the first sign of a typo or wrong method is a failed refresh hours later.

Fix: enter the credentials again with the box unticked, so the Service tests them on save. Some sources genuinely can't be tested from the dialog, such as a web API called with a dynamic URL. For those, see Web.Contents with a dynamic URL, which explains the RelativePath pattern and when to skip the test.

After the Fix: Turn the Schedule Back On

After four failed refreshes in a row, Power BI disables scheduled refresh on the semantic model, and fixing the credentials doesn't turn it back on (more on why schedules get turned off). Once the credentials are updated:

  1. Run Refresh now and watch the refresh history to confirm it succeeds.
  2. Open the semantic model's Settings → Refresh and switch scheduled refresh back On.
  3. Check the failure notification setting while you're there, so the next failure emails someone. See refresh notifications.

The same credentials dialog also sets each source's privacy level. If the next error after fixing credentials mentions combining data or a firewall, that's a privacy level mismatch rather than a sign-in problem. See the Formula.Firewall error explained.

Common Mistakes

Updating the wrong copy. Every semantic model stores its own credentials, and so does every dataflow. Fixing one model leaves the others failing. For gateway sources, the copy to fix is the connection, not the model.

Signing in as yourself to make the error go away. It works today and breaks the next time your password changes, or when you leave. Use an account meant for refresh.

Fixing the credentials and walking away. The schedule stays off after four failures, so the report goes stale silently until someone notices old numbers. Always run a refresh and re-enable the schedule.

Taking Desktop's success as proof the Service will work. Desktop only proves your account can reach the source from your machine. The Service uses different credentials, from a different place, sometimes through a gateway. Set credentials and run one manual refresh right after the first publish.

Next Steps

Works in Desktop but row-level security doesn't filter in the Service? That's an identity problem of a different kind. See RLS works in Desktop but not in the Service.

FAQ

+Why does refresh work in Power BI Desktop but fail in the Service with invalid credentials?

Desktop signs in to the source as you, with credentials cached on your machine. Publishing doesn't copy those to the Service. The Service keeps its own stored credentials for each data source, either on the semantic model (cloud sources) or on the gateway connection (on-premises sources), and those are the ones that expired or were never set correctly.

+Where do I update data source credentials in the Power BI Service?

For a cloud source, open the semantic model's Settings, expand Data source credentials, and choose Edit credentials. For an on-premises source that goes through a gateway, the credentials are stored on the gateway connection instead: Settings (the gear icon), Manage connections and gateways, then the connection's settings.

+Why did my refresh work for months and then suddenly fail?

Usually an OAuth token expired or was revoked. Tokens for organizational accounts stop working after a password change, an MFA or conditional access policy change, or a period without use, and any of those can happen months after the report was published. Signing in again under Edit credentials issues a new token.

+Does scheduled refresh turn itself back on after I fix the credentials?

No. After four failed refreshes in a row, Power BI disables the schedule. Fixing the credentials doesn't re-enable it: run a manual refresh to confirm the fix, then switch scheduled refresh back on in the semantic model's settings.