pbi-tools / pbi-tools

Power BI DevOps & Source Control Tool
https://pbi.tools/cli
MIT License
299 stars 52 forks source link

Find SSRS Installers #50

Open pfeigl opened 2 years ago

pfeigl commented 2 years ago

Hi, we are using the Power BI Report Server (on-premise). This brings it's own flavour of the PowerBI Desktop Tools with it. Most of it is seemlingly just the same, there is just a few options to deploy from the desktop tools to the report server.

However: The installation is a little different in terms of folder names and thus the installation cannot be found currently by the pbi-tools.

This is the registry path Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Power BI Desktop SSRS\Installer

This is the settings path: C:\Users\{UserName}\AppData\Local\Microsoft\Power BI Desktop SSRS

The actual installation path seems to be this C:\Program Files\Microsoft Power BI Desktop RS\, however this value can be identified via the regvalue anyways.

Is there any chance you would add this lookup to the tool?

mthierba commented 2 years ago

Okay, that seems straightforward.

You should be able to "hack" this for your environment already by setting the PBITOOLS_PbiInstallDir environment variable (a directory containing "PBIDesktop.exe" or a parent folder). Would be a good way to find out about any possible incompatibilities with that setup (which I'd be keen to learn about).

pfeigl commented 2 years ago

Extraction seems to work. compile-pbi also passed and the created pbix could also be opened.

However after opening it and applying the changes (to reload the data) an exception came up. The pbix is pretty simple, it contains a Paramater and Json.Document(Web.Contents...)) call.

This is the log, if it helps anything

Feedback Type:
Frown (Error)

Error Message:
Failed to get path to last or only formula part

Stack Trace:
System.InvalidOperationException
   at Microsoft.Mashup.Host.Document.PackageEditor.GetPathToLastOrOnlyFormulaPart(String sectionName, String formulaName)
   at Microsoft.PowerBI.Client.OleDbProvider.PowerBIMashupDataSource.GetFormulaPath(Byte[] packagePartsBytes, String queryName)
   at Microsoft.PowerBI.Client.Windows.AnalysisServices.MashupContextProvider..ctor(IFeatureSettings featureSettings, IUISettings uiSettings, IExceptionHandler exceptionHandler, PackageReference packageReference, CreateMashupContextRequestMessage message, IMashupEditor mashupEditor, ICacheSession cacheSession)
   at Microsoft.PowerBI.Client.Windows.AnalysisServices.MashupQueryLoadContext.CreateMashupContextProvider(CreateMashupContextRequestMessage message)
   at Microsoft.PowerBI.Client.Windows.AnalysisServices.MashupLoadContextFactoryBase.CreateMashupContextProvider(CreateMashupContextRequestMessage message)
   at Microsoft.PowerBI.Client.Windows.AnalysisServices.MashupLoadContextFactoryBase.OnCreateMashupContextRequest(IMessageChannel channel, CreateMashupContextRequestMessage message)
   at Microsoft.Mashup.Host.Document.ExceptionHandlerExtensions.HandleExceptions(IExceptionHandler exceptionHandler, Action action)

Stack Trace Message:
Failed to get path to last or only formula part

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__DisplayClass15_0.<HandleException>b__0()
   at Microsoft.Mashup.Host.Document.SynchronizationContextExtensions.<>c__DisplayClass2_1.<SendAndMarshalExceptions>b__0(Object null)
   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.Windows.DialogWindowBase.ShowModal(IWindowHandle windowHandle)
   at Microsoft.Mashup.Client.UI.Shared.WindowManager.ShowModal[T](T dialog, Func`1 showModalFunction)
   at Microsoft.PowerBI.Client.Windows.FloatingDialog.KoLoadToReportDialog.TryShowDialog(Report report, IExceptionHandler exceptionHandler, IPowerBIWindowService windowService, IQueryServices queryServices, IDesktopModelingHost modelingHost, LocalizedString title, LoadToModelContext loadToModelContext)
   at Microsoft.PowerBI.Client.Windows.FloatingDialog.KoLoadToReportDialog.<>c__DisplayClass16_0.<TryShowDialogForQueries>b__0()
   at Microsoft.PowerBI.Client.Windows.Report.<>c__DisplayClass64_0`1.<SynchronizeLooselyWithQueries>b__0()
   at Microsoft.PowerBI.Client.Windows.Report.<SynchronizeLooselyWithQueriesAsync>d__65`1.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.PowerBI.Client.Windows.Report.SynchronizeLooselyWithQueriesAsync[T](Func`1 getTask)
   at Microsoft.PowerBI.Client.Windows.Report.SynchronizeLooselyWithQueries[T](Func`1 action)
   at Microsoft.PowerBI.Client.Windows.Services.WarningDetectionService.<DetectReportLoadWarning>b__38_1()
   at Microsoft.Mashup.Host.Document.ExceptionHandlerExtensions.HandleExceptions(IExceptionHandler exceptionHandler, Action action)
   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.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
   at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
   at System.Windows.Forms.WindowsFormsSynchronizationContext.Send(SendOrPostCallback d, Object state)
   at Microsoft.PowerBI.Client.Windows.Services.WarningNotificationService.ExecuteOnUiThread(Action action)
   at Microsoft.PowerBI.Client.Windows.Services.WarningAction.<>c__DisplayClass17_0.<ToFunction>b__0()
   at Microsoft.PowerBI.Client.Windows.Services.WarningAction.ExecuteAndCompleteTask(Func`1 func)
   at Microsoft.PowerBI.Client.Windows.HostServiceDispatcher.<>c__DisplayClass7_0.<ExecuteOnUIThreadAsync>b__0(Object t)
   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__DisplayClass4_0.<Main>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.Main(String[] args)

PowerBINonFatalError:
{"AppName":"PBIDesktop","AppVersion":"2.97.863.0","ModuleName":"Microsoft.Mashup.Document.dll","Component":"Microsoft.Mashup.Host.Document.PackageEditor","Error":"System.InvalidOperationException","MethodDef":"GetPathToLastOrOnlyFormulaPart","ErrorOffset":"22"}

Snapshot Trace Logs:
C:\Users\philipp.feigl\AppData\Local\Microsoft\Power BI Desktop SSRS\FrownSnapShotbf832fe8-17b6-4eeb-8599-242ca0d81b38.zip

Model Default Mode:
Import

Model Version:
PowerBI_V3

Performance Trace Logs:
C:\Users\philipp.feigl\AppData\Local\Microsoft\Power BI Desktop SSRS\PerformanceTraces.zip

Enabled Preview Features:
PBI_ImportTextByExample

Disabled Preview Features:
PBI_shapeMapVisualEnabled
PBI_SpanishLinguisticsEnabled
PBI_JsonTableInference
PBI_ExcelTableInference
PBI_qnaLiveConnect
PBI_azureMapVisual
PBI_dataPointLassoSelect
PBI_compositeModelsOverAS
PBI_dynamicParameters
PBI_enhancedTooltips
PBI_rdlNativeVisual

Disabled DirectQuery Options:
TreatHanaAsRelationalSource

Cloud:
GlobalCloud

PowerBIUserFeedbackServices_IsReported:
True

Formulas:

section Section1;

shared PageNumber = 2 meta [IsParameterQuery=true, Type="Number", IsParameterQueryRequired=true];

shared Users = let
    Source = Json.Document(Web.Contents("https://reqres.in/api/users?page=" & Number.ToText(PageNumber))),
    data = Source[data],
    #"Converted to Table" = Table.FromList(data, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"id", "email", "first_name", "last_name", "avatar"}, {"Column1.id", "Column1.email", "Column1.first_name", "Column1.last_name", "Column1.avatar"})
in
    #"Expanded Column1";
mthierba commented 2 years ago

I recognize the error. Did you compile the sources into a PBIX instead of PBIT? Can't currently support the former. See #46. Please specify -format PBIT and retry. Creation of PBIX only works for report-only projects, i.e. reports with live connection.

pfeigl commented 2 years ago

Ah oki. Generating the PBIT works, it can be opened and than filled with data.

However it unfortunately kills our usecase a little ;-) Due to how PowerBI works with Web-Calls (no DirectQuery Support), we thougt about an implementation, where a small tool which we have under control kind of loads the Source PBIX, extracts it, changes the value of a certain parameter in the extracted code and than recompiles it and uploads it to the report server.

With this we could have crafted a one-click solution where users could get reports with different input parameters.

Anyways, we might still consider using pbi-tools because of the benefits it brings to report change tracking with GIT

LSTANCZYK commented 5 months ago

I set my environment variable and tried to run extract, but it still does not work for me:

[Environment]::SetEnvironmentVariable("PBITOOLS_PbiInstallDir", "C:\Program Files\Microsoft Power BI Desktop RS\bin", "User")

Here is the error I am getting:

Extracting DataModel from PBIX
An unhandled exception occurred.
System.Exception: No 64-bit Power BI Desktop installation found
   at PbiTools.Utils.DependenciesResolver.GetPBIInstall() in X:\pbi-tools\BRANCHES\rc.6\src\PBI-Tools\Utils\DependenciesResolver.cs:line 87
   at PbiTools.Utils.DependenciesResolver.GetEffectivePowerBiInstallDir() in X:\pbi-tools\BRANCHES\rc.6\src\PBI-Tools\Utils\DependenciesResolver.cs:line 195
   at PbiTools.Utils.DependenciesResolver.TryFindMsmdsrv(String& path) in X:\pbi-tools\BRANCHES\rc.6\src\PBI-Tools\Utils\DependenciesResolver.cs:line 127
   at PbiTools.PowerBI.AnalysisServicesServer..ctor(ASInstanceConfig config, IDependenciesResolver dependenciesResolver) in X:\pbi-tools\BRANCHES\rc.6\src\PBI-Tools\PowerBI\AnalysisServicesServer.cs:line 50
   at PbiTools.PowerBI.DataModelConverter.LaunchTabularServerAndExecuteCallback[T](Func`2 callback) in X:\pbi-tools\BRANCHES\rc.6\src\PBI-Tools\PowerBI\DataModelConverter.cs:line 72
   at PbiTools.Model.PbixModel.FromReader(PbixReader reader, String targetFolder, Nullable`1 portNumber) in X:\pbi-tools\BRANCHES\rc.6\src\PBI-Tools\Model\PbixModel.cs:line 173
   at PbiTools.Cli.CmdLineActions.Extract(String pbixPath, Nullable`1 pid, Nullable`1 pbiPort, String extractFolder, ExtractActionCompatibilityMode mode, ModelSerializationMode modelSerialization, MashupSerializationMode mashupSerialization, Boolean watch) in X:\pbi-tools\BRANCHES\rc.6\src\PBI-Tools\Cli\Extract.cs:line 97
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at PowerArgs.ArgAction.Invoke()
   at PbiTools.Program.Main(String[] args) in X:\pbi-tools\BRANCHES\rc.6\src\PBI-Tools\Program.cs:line 110