Forum Discussion
getting token error while connecting fabric warehouse from POWER BI DEKSTOP
eedback Type:
Frown (Error)
Timestamp:
2025-06-13T16:32:25.4181474Z
Local Time:
2025-06-13T17:32:25.4181474+01:00
Session ID:
dd27f918-f6bd-4065-9dbb-90a209e72755
Release:
May 2025
Product Version:
2.143.1378.0 (25.05)+4e1de9c957866bc5336e0d250838314aa54ff3a8 (x64)
Error Message:
The service returned an invalid token. Please contact your IT administrator if this issue persists.
Stack Trace:
System.InvalidOperationException
at Microsoft.PowerBI.Client.Windows.LiveConnectHelpers.PowerBIService.PowerBIServiceConnector.<GetDatamartTokenCredential>d__28.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PowerBI.Client.Windows.PowerBIDataImporter.<ResolveDatamartQuery>d__57.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PowerBI.Client.Windows.PowerBIDataImporter.<GetDatamartInformationAndResolveDatmartQuery>d__42.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PowerBI.Client.Windows.PowerBIDataImporter.<ExecuteAddPowerBIDatahubSource>d__41.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.PowerBI.Client.Windows.PowerBIDataImporter.<>c__DisplayClass40_0.<<AddPowerBIDatahubSource>b__1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PowerBI.Client.Windows.IExceptionHandlerExtensions.<HandleAwaitableAsyncExceptions>d__1.MoveNext()
Stack Trace Message:
The service returned an invalid token. Please contact your IT administrator if this issue persists.
Invocation Stack Trace:
at Microsoft.Mashup.Host.Document.ExceptionExtensions.GetCurrentInvocationStackTrace()
at Microsoft.Mashup.Client.UI.Shared.StackTraceInfo..ctor(String exceptionStackTrace, String invocationStackTrace, String exceptionMessage)
at Microsoft.PowerBI.Client.Windows.Telemetry.PowerBIUserFeedbackServices.GetStackTraceInfo(Exception e)
at Microsoft.PowerBI.Client.Windows.Telemetry.PowerBIUserFeedbackServices.ReportException(IWindowHandle activeWindow, IUIHost uiHost, FeedbackPackageInfo feedbackPackageInfo, Exception e, Boolean useGDICapture)
at Microsoft.Mashup.Client.UI.Shared.UnexpectedExceptionHandler.<>c__DisplayClass14_0.<HandleException>b__0()
at Microsoft.Mashup.Client.UI.Shared.UnexpectedExceptionHandler.HandleException(Exception e)
at Microsoft.PowerBI.Client.PowerBIUnexpectedExceptionHandler.HandleException(Exception e)
at Microsoft.PowerBI.Client.Windows.IExceptionHandlerExtensions.<HandleAwaitableAsyncExceptions>d__1.MoveNext()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()
at System.Threading.Tasks.AwaitTaskContinuation.RunCallback(ContextCallback callback, Object state, Task& currentTask)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task.Finish(Boolean bUserDelegateExecuted)
at System.Threading.Tasks.Task`1.TrySetException(Object exceptionObject)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception)
at Microsoft.PowerBI.Client.Windows.PowerBIDataImporter.<>c__DisplayClass40_0.<<AddPowerBIDatahubSource>b__1>d.MoveNext()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()
at System.Threading.Tasks.AwaitTaskContinuation.RunCallback(ContextCallback callback, Object state, Task& currentTask)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task.Finish(Boolean bUserDelegateExecuted)
at System.Threading.Tasks.Task`1.TrySetException(Object exceptionObject)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception)
at Microsoft.PowerBI.Client.Windows.PowerBIDataImporter.<ExecuteAddPowerBIDatahubSource>d__41.MoveNext()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()
at System.Threading.Tasks.AwaitTaskContinuation.RunCallback(ContextCallback callback, Object state, Task& currentTask)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task.Finish(Boolean bUserDelegateExecuted)
at System.Threading.Tasks.Task`1.TrySetException(Object exceptionObject)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception)
at Microsoft.PowerBI.Client.Windows.PowerBIDataImporter.<GetDatamartInformationAndResolveDatmartQuery>d__42.MoveNext()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()
at System.Threading.Tasks.AwaitTaskContinuation.RunCallback(ContextCallback callback, Object state, Task& currentTask)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetResult(TResult result)
at Microsoft.PowerBI.Client.Windows.LiveConnectHelpers.PowerBIService.PowerBIServiceConnector.<GetDatamartInformationForDatahubArtifact>d__25.MoveNext()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()
at System.Threading.Tasks.AwaitTaskContinuation.RunCallback(ContextCallback callback, Object state, Task& currentTask)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetResult(TResult result)
at Microsoft.PowerBI.Client.Windows.PowerBIService.Flows.AuthenticatedWebRequestor.<Execute>d__5`1.MoveNext()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at Microsoft.Mashup.Client.UI.Shared.WindowManager.ShowModal[T](T dialog, Func`1 showModalFunction)
at Microsoft.PowerBI.Client.Program.<>c__DisplayClass7_1.<RunApplicationLegacy>b__1()
at Microsoft.PowerBI.Client.Windows.IExceptionHandlerExtensions.<>c__DisplayClass3_0.<HandleExceptionsWithNestedTasks>b__0()
at Microsoft.Mashup.Host.Document.ExceptionHandlerExtensions.HandleExceptions(IExceptionHandler exceptionHandler, Action action)
at Microsoft.PowerBI.Client.Program.RunApplicationLegacy(String[] args, IPowerBIRootTrace trace)
at Microsoft.PowerBI.Client.Program.Main(String[] args)
PowerBINonFatalError:
{"AppName":"PBIDesktop","AppVersion":"2.143.1378.0","ModuleName":"Microsoft.PowerBI.Client.Windows.dll","Component":"Microsoft.PowerBI.Client.Windows.LiveConnectHelpers.PowerBIService.PowerBIServiceConnector+<GetDatamartTokenCredential>d__28","Error":"System.InvalidOperationException","MethodDef":"MoveNext","ErrorOffset":"154","ErrorCode":""}
OS Version:
Microsoft Windows NT 10.0.26100.0 (x64 en-US)
CLR Version:
4.8 or later [Release Number = 533320]
Peak Virtual Memory:
70.8 GB
Private Memory:
621 MB
Peak Working Set:
921 MB
IE Version:
11.1882.26100.0
User ID:
766b30b9-b28a-403b-a849-48d53053faa3
Workbook Package Info:
1* - en-IE, Query Groups: 0, fastCombine: Disabled, runBackgroundAnalysis: False.
Telemetry Enabled:
True
Snapshot Trace Logs:
C:\Users\DimpyKumari\AppData\Local\Microsoft\Power BI Desktop\FrownSnapShot25d82891-c0bb-40fa-b062-4474ef0e89bd.zip
Model Default Mode:
Empty
Model Version:
PowerBI_V1
Performance Trace Logs:
C:\Users\DimpyKumari\AppData\Local\Microsoft\Power BI Desktop\PerformanceTraces.zip
Enabled Preview Features:
PBI_snowflakeAdbcVersionEnabled
PBI_sparklines
PBI_scorecardVisual
PBI_fieldParametersSuperSwitch
PBI_setLabelOnExportPdf
PBI_oneDriveSave
PBI_oneDriveShare
PBI_odspSaveBackgroundUpload
PBI_modernOfficeFilePicker
PBI_useModernPublishDialogs
PBI_gitIntegration
PBI_tmdlInDataset
PBI_directLakeRemoteModeling
PBI_newCard
PBI_buttonSlicerAuthoring
PBI_EimLessElevatedUser
PBI_daxInlineCopilot
PBI_aiNarrativesVisual
PBI_generateMeasureDescriptionsButton
PBI_visualCalculationsAuthoring
PBI_copilotUnifiedTooling
PBI_UserInstalledVerticaODBCDriver
PBI_sqlDbNativeArtifactsOnDesktop
Disabled Preview Features:
PBI_googleBigQueryAdbcVersionEnabled
PBI_shapeMapVisualEnabled
PBI_SpanishLinguisticsEnabled
PBI_qnaLiveConnect
PBI_metricsArtifactsOnDesktop
PBI_b2bExternalDatasetSharing
PBI_enhancedTooltips
PBI_onObject
PBI_publishDialogsSupportSubfolders
PBI_enhancedReportFormat
PBI_directLakeOnOneLake
PBI_advancedSlicerTypeList
PBI_textSlicer
PBI_qnaImproveLsdlCopilot
PBI_tmdlViewToggle
MashupFlight_EnableOracleBundledOdacProvider
PBI_dataFunctionActions
Disabled DirectQuery Options:
TreatHanaAsRelationalSource
Cloud:
GlobalCloud
PowerBIUserFeedbackServices_IsReported:
True
DPI Scale:
150%
Supported Services:
Power BI
Formulas:
section Section1;
WebView2 Runtime Version:
137.0.3296.68
WebView2 SDK Version:
1.0.2365.46
Hi DiKi-I ,
Thanks for confirming that you've tried the suggested steps. Since the token error keeps happening, here are a few additional actions you can try that often resolve persistent token issues in Power BI Desktop:
1.Clear token cache folders under:
%LOCALAPPDATA%\Microsoft\Power BI Desktop\ and
%USERPROFILE%\AppData\Local\Microsoft\Power BI Desktop\AnalysisServicesWorkspaces
Then relaunch Desktop and sign in again.2.Ask your IT Admin to check for:
Conditional access policies
Token lifetime settings
Any restrictions on Fabric access from desktop clients
3.Avoid preview Warehouse shortcut and instead try connecting via Get Data > Power BI Datasets or even OData Feed, depending on your Fabric setup.
4.Have your access to the workspace removed and re-added - this can often trigger the right token refresh behind the scenes.
5.If the issue persists, I recommend submitting your detailed feedback through Microsoft's official Support Ticket channels, such as the How to create a Fabric and Power BI Support ticket - Power BI | Microsoft Learn
If this post helps, then please consider Accepting as solution to help the other members find it more quickly.
Thank you.
6 Replies
- v-venuppu
Community Support
Hi DiKi-I ,
Thank you for reaching out to Microsoft Fabric Community.
Thank you Nasif_Azam for the prompt response.
I want to check if you had the opportunity to review the information provided and resolve the issue.If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.
- Nasif_Azam
Super User
Hey DiKi-I ,
You're encountering the error: "The service returned an invalid token" while trying to connect to Microsoft Fabric Warehouse from Power BI Desktop. This usually indicates an authentication or token expiration issue related to your Microsoft account or organizational tenant setup.
1. Sign Out and Sign Back In to Power BI Desktop
Go to File > Options and settings > Options > Global > Security.
Click Sign Out.
Then go to the top-right corner of Power BI Desktop and sign in again using your Microsoft 365 account (preferably with the same account that has access to the Fabric workspace).
2. Clear Power BI Desktop Credentials
Go to File > Options and settings > Data source settings.
Find the Fabric (OneLake) or Warehouse connection, select it, and click Clear Permissions.
Try to reconnect.
3. Ensure Power BI Desktop Is Up to Date
4. Check Microsoft Fabric and Tenant Access
Confirm that your Power BI account has the correct role and permission to access the Fabric Warehouse.
5. Try Opening from the Power BI Service (Web) First
Go to Power BI Service.
Locate and open the Fabric Warehouse directly from the web.
Then try connecting again from Power BI Desktop.
6. If You Are Using DirectLake or Enhanced Dataset Connectivity
If you found this solution helpful, please consider accepting it and giving it a kudos (Like) it’s greatly appreciated and helps others find the solution more easily.
Best Regards,
Nasif Azam - DiKi-I
Post Partisan
I have done all the steps but it keeps happening everytime which is really frustrating.
- v-venuppu
Community Support
Hi DiKi-I ,
Thanks for confirming that you've tried the suggested steps. Since the token error keeps happening, here are a few additional actions you can try that often resolve persistent token issues in Power BI Desktop:
1.Clear token cache folders under:
%LOCALAPPDATA%\Microsoft\Power BI Desktop\ and
%USERPROFILE%\AppData\Local\Microsoft\Power BI Desktop\AnalysisServicesWorkspaces
Then relaunch Desktop and sign in again.2.Ask your IT Admin to check for:
Conditional access policies
Token lifetime settings
Any restrictions on Fabric access from desktop clients
3.Avoid preview Warehouse shortcut and instead try connecting via Get Data > Power BI Datasets or even OData Feed, depending on your Fabric setup.
4.Have your access to the workspace removed and re-added - this can often trigger the right token refresh behind the scenes.
5.If the issue persists, I recommend submitting your detailed feedback through Microsoft's official Support Ticket channels, such as the How to create a Fabric and Power BI Support ticket - Power BI | Microsoft Learn
If this post helps, then please consider Accepting as solution to help the other members find it more quickly.
Thank you.
- v-venuppu
Community Support
Hi DiKi-I ,
We are following up once again regarding your query. Could you please confirm whether the issue has been resolved through your support ticket with Microsoft?
If so, we would appreciate it if you could share the resolution or any key insights here to benefit others in the community. If we don’t receive a response, we will proceed with closing this thread.
If you need further assistance in the future, feel free to start a new thread in the Microsoft Fabric Community Forum. We will be happy to support you there.
Thank you.