Excel Power Query Credentials Expire Every Day: Fix
🔍 WiseChecker

Excel Power Query Credentials Expire Every Day: Fix

If you connect Excel Power Query to a data source such as SQL Server, SharePoint, or an OData feed, you may see a credential prompt every time you refresh a query. Your password or token works fine, but Power Query forgets the saved credentials after a few hours or by the next day. This problem occurs because Power Query stores credentials in Windows Credential Manager with an expiration policy that is too short for your environment. This article explains the root cause, shows you how to extend the credential lifetime, and covers related failures such as persistent authentication pop-ups in Excel for Microsoft 365.

Key Takeaways: Stop Power Query Credential Expiration

  • Windows Credential Manager > Windows Credentials > Edit Generic Credential: Extend the lifetime of a stored Power Query credential by changing its expiration date from a few hours to a year.
  • Data Source Settings > Edit Permissions > Edit: Switch the authentication method from Anonymous to Windows or Basic and save the password to store it permanently.
  • Power Query Options > Security > Enable Fast Data Load: Disable this setting to force credential re-verification on every refresh, which prevents silent credential loss.

ADVERTISEMENT

Why Power Query Credentials Expire So Quickly

Power Query uses Windows Credential Manager to store authentication tokens for data sources. By default, these tokens are given an expiration date of a few hours or one day, depending on the source type and the authentication protocol used. Windows, Azure Active Directory, and many cloud services issue short-lived tokens as a security measure. When the token expires, Power Query prompts for credentials again on the next refresh.

The problem is not that your password is wrong. The stored credential in Credential Manager has a built-in expiration timestamp. When Power Query reads the credential, it checks this timestamp. If the time has passed, Power Query treats the credential as invalid and asks for a new one. This behavior is by design for security, but it becomes a daily annoyance for users who refresh queries on a schedule.

Another factor is the authentication method. Anonymous connections do not store any credential, so they never expire. Windows authentication stores a cached ticket that expires based on domain policy. Basic authentication with a saved password is stored as a plain credential that can be set to never expire. The fix depends on which method your data source supports.

Steps to Extend or Permanently Store Power Query Credentials

You can solve the daily credential prompt by editing the stored credential in Windows Credential Manager or by changing the authentication method in Power Query to one that supports persistent storage. Follow the method that matches your data source type.

Method 1: Edit the Credential Expiration in Windows Credential Manager

This method works for credentials already saved by Power Query. You manually extend the expiration date to a far-future value.

  1. Open Windows Credential Manager
    Press Windows key + R, type control /name Microsoft.CredentialManager, and press Enter. The Credential Manager control panel opens.
  2. Switch to Windows Credentials
    Click Windows Credentials at the top of the window. This tab shows all stored credentials for Windows services, including Power Query.
  3. Locate the Power Query credential
    Scroll through the list under Generic Credentials. Look for an entry that starts with Microsoft.PowerQuery followed by your data source URL or server name. For example: Microsoft.PowerQuery:https://contoso.sharepoint.com.
  4. Open the credential and edit the expiration
    Click the arrow to expand the credential entry, then click Edit. In the Expiration date field, change the date to one year from today or a date far in the future. Leave the username and password unchanged. Click Save.
  5. Refresh your Power Query
    Return to Excel, go to the Data tab, and click Refresh All. The query should now refresh without prompting for credentials. The credential will remain valid until the edited expiration date.

Method 2: Change Authentication Method to Basic with Saved Password

If your data source supports Basic authentication, this method stores the password permanently without an expiration date.

  1. Open Power Query Editor
    In Excel, go to the Data tab and click Queries & Connections. Right-click the query that prompts for credentials and select Edit.
  2. Open Data Source Settings
    In Power Query Editor, click File > Options and settings > Data source settings.
  3. Select the data source and edit permissions
    In the Data Source Settings dialog, select your data source from the list. Click Edit Permissions.
  4. Change authentication to Basic
    In the Edit Permissions dialog, under Credentials, click Edit. Change the Authentication Kind to Basic. Enter your username and password. Check the box Save this password if available. Click Save and then OK.
  5. Close and refresh
    Close the Data Source Settings dialog and click Close & Load in Power Query Editor. The credential is now stored permanently in Credential Manager with no expiration date.

Method 3: Use Windows Authentication with Persistent Ticket

For on-premises SQL Server or SharePoint, Windows authentication is preferred. The ticket lifetime is controlled by your domain policy, but you can request a longer ticket from your IT administrator.

  1. Open Data Source Settings
    Follow steps 1 through 3 from Method 2.
  2. Set authentication to Windows
    Click Edit Permissions, then Edit. Set Authentication Kind to Windows. Ensure Use Current Windows User is selected. Click Save.
  3. Ask your IT admin to extend Kerberos ticket lifetime
    If credentials still expire daily, your domain Kerberos ticket is set to a short lifetime. Your IT administrator can increase the Maximum lifetime for user ticket setting in Group Policy to 10 hours or more. The path is: Computer Configuration > Windows Settings > Security Settings > Account Policies > Kerberos Policy.

ADVERTISEMENT

If Power Query Still Prompts for Credentials After the Fix

Power Query Credentials Not Saved After Editing Credential Manager

If you edited the expiration date but Power Query still prompts for credentials, the credential you edited might be the wrong one. Power Query can store multiple credentials for the same server under different names. Delete all entries that start with Microsoft.PowerQuery and then refresh the query once to let Power Query create a fresh credential. Then edit the new entry immediately.

Excel for Microsoft 365 Keeps Asking for Credentials on Every Refresh

A known issue in Excel for Microsoft 365 version 2402 and later causes credentials to expire every time the workbook is closed. This happens because the Enable Fast Data Load option resets credential cache on close. To fix this, go to Power Query Editor > File > Options and settings > Query Options. Under Security, uncheck Enable Fast Data Load. Click OK and restart Excel. This forces Power Query to re-verify credentials on each refresh but prevents the cache from being cleared.

Power Query Credentials Work in One Workbook but Not Another

Each workbook stores its own connection string and credential reference. If you connect to the same data source from two different workbooks, each workbook may use a different credential entry. Open the workbook that fails, go to Data Source Settings, and delete the existing permission. Then refresh the query and save the credentials again.

Editing Credential Expiration vs Changing Authentication Method: Key Differences

Item Edit Credential Expiration Change Authentication to Basic
Data source requirement Any source that already saved a credential Must support Basic authentication
Persistence Manual edit required again after new expiration Password stored permanently with no expiration
Security Credential remains in plain text in Credential Manager Password saved in plain text; less secure than Windows auth
Steps Open Credential Manager, edit expiration date Change authentication kind in Data Source Settings
Best for Quick fix for a single credential Recurring use with cloud or SQL sources that support Basic

You can now stop Power Query from asking for credentials every day by editing the expiration date in Windows Credential Manager or by switching to Basic authentication with a saved password. If the prompt returns after closing the workbook, disable the Fast Data Load option in Power Query security settings. For a permanent solution with Windows authentication, ask your IT administrator to extend the Kerberos ticket lifetime in Group Policy.

ADVERTISEMENT