Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An unhandled exception occurred. System.Exception: Process has terminated #78

Closed
janmechtel opened this issue Jan 31, 2022 · 70 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@janmechtel
Copy link

First of, we are ecstatic to see this released! Unfortunately I can't get it to run. I hope it's fine to post here.

I'm trying to start out by extracting from a .pbix fiel

.\pbi-tools.exe extract ".\test.pbix"

An unhandled exception occurred. System.Exception: Process has terminated

An unhandled exception occurred.
System.Exception: Process has terminated
   at PbiTools.PowerBI.AnalysisServicesServer.Start() in X:\pbi-tools\pbi-tools-cli\src\PBI-Tools\PowerBI\AnalysisServicesServer.cs:line 145
   at PbiTools.PowerBI.DataModelConverter.LaunchTabularServerAndExecuteCallback[T](Func`2 callback) in X:\pbi-tools\pbi-tools-cli\src\PBI-Tools\PowerBI\DataModelConverter.cs:line 82
   at PbiTools.Model.PbixModel.FromReader(PbixReader reader, String targetFolder, Nullable`1 portNumber) in X:\pbi-tools\pbi-tools-cli\src\PBI-Tools\Model\PbixModel.cs:line 168
   at PbiTools.Cli.CmdLineActions.Extract(String pbixPath, Int32 pbiPort, String extractFolder, ExtractActionCompatibilityMode mode, ModelSerializationMode modelSerialization, MashupSerializationMode mashupSerialization) in X:\pbi-tools\pbi-tools-cli\src\PBI-Tools\Cli\Extract.cs:line 63
--- 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\pbi-tools-cli\src\PBI-Tools\Program.cs:line 82
PS C:\Users\JanMechtel\Downloads\pbi-tools.1.0.0-beta.8> .\pbi-tools.exe extract ".\test.pbix"

I've set the loglevel to verbose, but didn't spot anything more useful.

image

@janmechtel
Copy link
Author

janmechtel commented Jan 31, 2022

Here is the complete vebose log.

PS C:\Users\JanMechtel\Downloads\pbi-tools.1.0.0-beta.8> .\pbi-tools.exe extract ".\test.pbix"
Log level: Verbose
Invoking 'BeforeValidateDefinition'
Action: Void Cache(PbiTools.Cli.CacheAction)
 Default Alias: Cache
 Alias: Cache
 Alias: cache
 Metadata: PowerArgs.ArgActionMethod
 Shortcut: cache
 Metadata: PowerArgs.ArgDescription
 Metadata: PowerArgs.ArgExample
Action: Void CompilePbix(System.String, System.String, PbiTools.PowerBI.PbiFileFormat, Boolean)
 Default Alias: CompilePbix
 Alias: CompilePbix
 Alias: compile
 Alias: compile-pbix
 Metadata: PowerArgs.ArgActionMethod
 Shortcut: compile
 Shortcut: compile-pbix
 Metadata: PowerArgs.ArgDescription
Action: Void Convert(System.String, System.String, PbiTools.ProjectSystem.ModelSerializationMode, PbiTools.ProjectSystem.MashupSerializationMode, System.String, Boolean, Boolean, Boolean)
 Default Alias: Convert
 Alias: Convert
 Alias: convert
 Metadata: PowerArgs.ArgActionMethod
 Shortcut: convert
 Metadata: PowerArgs.ArgDescription
Action: Void Deploy(System.String, System.String, System.String, System.String, Boolean)
 Default Alias: Deploy
 Alias: Deploy
 Alias: deploy
 Metadata: PowerArgs.ArgActionMethod
 Shortcut: deploy
 Metadata: PowerArgs.ArgDescription
Action: Void ExportData(Int32, System.String, System.String, System.String)
 Default Alias: ExportData
 Alias: ExportData
 Alias: export-data
 Metadata: PowerArgs.ArgActionMethod
 Shortcut: export-data
 Metadata: PbiTools.Cli.ArgAltShortcut
 Metadata: PowerArgs.ArgDescription
 Metadata: PowerArgs.ArgExample
 Metadata: PowerArgs.ArgExample
Action: Void ExportUsage(System.String)
 Default Alias: ExportUsage
 Alias: ExportUsage
 Alias: export-usage
 Metadata: PowerArgs.ArgActionMethod
 Shortcut: export-usage
 Metadata: PowerArgs.OmitFromUsageDocs
Action: Void Extract(System.String, Int32, System.String, PbiTools.Cli.ExtractActionCompatibilityMode, PbiTools.ProjectSystem.ModelSerializationMode, PbiTools.ProjectSystem.MashupSerializationMode)
 Default Alias: Extract
 Alias: Extract
 Alias: extract
 Metadata: PowerArgs.ArgActionMethod
 Shortcut: extract
 Metadata: PowerArgs.ArgDescription
 Metadata: PowerArgs.ArgExample
 Metadata: PowerArgs.ArgExample
Action: Void GenerateBim(System.String, Boolean, PbiTools.Cli.ExportTransforms)
 Default Alias: GenerateBim
 Alias: GenerateBim
 Alias: generate-bim
 Metadata: PowerArgs.ArgActionMethod
 Shortcut: generate-bim
 Metadata: PbiTools.Cli.ArgAltShortcut
 Metadata: PowerArgs.ArgDescription
Action: Void Git(PbiTools.Cli.GitAction)
 Default Alias: Git
 Alias: Git
 Alias: git
 Metadata: PowerArgs.ArgActionMethod
 Shortcut: git
 Metadata: PowerArgs.ArgDescription
 Metadata: PowerArgs.ArgExample
Action: Void Info(Boolean)
 Default Alias: Info
 Alias: Info
 Alias: info
 Metadata: PowerArgs.ArgActionMethod
 Shortcut: info
 Metadata: PowerArgs.ArgDescription
 Metadata: PowerArgs.ArgExample
Action: Void Init(PbiTools.Cli.InitAction, System.String)
 Default Alias: Init
 Alias: Init
 Alias: init
 Metadata: PowerArgs.ArgActionMethod
 Shortcut: init
 Metadata: PowerArgs.ArgDescription
Action: Void LaunchPbiDesktop(System.String)
 Default Alias: LaunchPbiDesktop
 Alias: LaunchPbiDesktop
 Alias: launch-pbi
 Metadata: PowerArgs.ArgActionMethod
 Shortcut: launch-pbi
 Metadata: PowerArgs.ArgDescription
'RemoveAutoAliases' invoked. Caller: BeforeValidateDefinition
Invoking Action: extract(Aliases=1)(Arguments=6)
Attempting to resolve assembly: Microsoft.PowerBI.Packaging, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Using Power BI Desktop install: 2.100.1401.0 (21.12) at C:\Program Files\WindowsApps\Microsoft.MicrosoftPowerBIDesktop_2.100.1401.0_x64__8wekyb3d8bbwe\bin
Assembly 'Microsoft.PowerBI.Packaging, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' found at C:\Program Files\WindowsApps\Microsoft.MicrosoftPowerBIDesktop_2.100.1401.0_x64__8wekyb3d8bbwe\bin\Microsoft.PowerBI.Packaging.dll
Reading PbixModel from file at C:\Users\JanMechtel\Downloads\pbi-tools.1.0.0-beta.8\test.pbix (Version: 1.25)
Reading Connections...
Reading Report...
Reading DiagramLayout...
Reading DiagramViewState...
Reading LinguisticSchemaXml...
Reading LinguisticSchema...
Reading ReportMetadata...
Reading ReportSettings...
Reading CustomVisuals...
Reading StaticResources...
Reading DataModel...
MSMDSRV.EXE found at C:\Users\JanMechtel\AppData\Local\pbi-tools\Microsoft.MicrosoftPowerBIDesktop_2.100.1401.0_x64__8wekyb3d8bbwe\msmdsrv.exe
Working directory: C:\Users\JanMechtel\AppData\Local\Temp\tmpF1FD.tmp
<ConfigurationSettings>
  <TMCompatibilitySKU>0</TMCompatibilitySKU>
  <RecoveryModel>1</RecoveryModel>
  <DisklessModeRequested>1</DisklessModeRequested>
  <InstanceVisible>0</InstanceVisible>
  <AllowedBrowsingFolders>C:\Users\JanMechtel\AppData\Local\Temp\tmpF1FD.tmp</AllowedBrowsingFolders>
  <Language>8192</Language>
  <Port>0</Port>
  <PrivateProcess>31556</PrivateProcess>
  <BackupDir>C:\Users\JanMechtel\AppData\Local\Temp\tmpF1FD.tmp</BackupDir>
  <LogDir>C:\Users\JanMechtel\AppData\Local\Temp\tmpF1FD.tmp</LogDir>
  <TempDir>C:\Users\JanMechtel\AppData\Local\Temp\tmpF1FD.tmp</TempDir>
  <DataDir>C:\Users\JanMechtel\AppData\Local\Temp\tmpF1FD.tmp</DataDir>
  <DeploymentMode>1</DeploymentMode>
  <CleanDataFolderOnStartup>1</CleanDataFolderOnStartup>
  <AutoSetDefaultInitialCatalog>1</AutoSetDefaultInitialCatalog>
  <Network>
    <ListenOnlyOnLocalConnections>1</ListenOnlyOnLocalConnections>
    <Requests>
      <EnableBinaryXML>1</EnableBinaryXML>
      <EnableCompression>1</EnableCompression>
    </Requests>
    <Responses>
      <EnableBinaryXML>1</EnableBinaryXML>
      <EnableCompression>1</EnableCompression>
      <CompressionLevel>9</CompressionLevel>
    </Responses>
  </Network>
  <Debug>
    <CallStackInError>0</CallStackInError>
  </Debug>
  <Log>
    <Exception>
      <CrashReportsFolder>C:\Users\JanMechtel\AppData\Local\Temp\tmpF1FD.tmp</CrashReportsFolder>
    </Exception>
    <Trace>
      <TraceFileBufferSize>128</TraceFileBufferSize>
    </Trace>
    <FlightRecorder>
      <Enabled>1</Enabled>
      <FileSizeMB>50</FileSizeMB>
      <LogDurationSec>36000</LogDurationSec>
    </FlightRecorder>
  </Log>
  <Memory>
    <MemoryHeapType>5</MemoryHeapType>
  </Memory>
  <ResourceGovernance>
    <GovernIMBIScheduler>0</GovernIMBIScheduler>
  </ResourceGovernance>
  <Feature>
    <ManagedCodeEnabled>1</ManagedCodeEnabled>
    <MEngineTracingEnabled>0</MEngineTracingEnabled>
    <UseXPress9Compression>1</UseXPress9Compression>
    <SkipXPress9CompressionSizeMB>0</SkipXPress9CompressionSizeMB>
    <CompositeModel>1</CompositeModel>
    <ManyToManyRelationship>1</ManyToManyRelationship>
    <EnableIncrementalRefresh>1</EnableIncrementalRefresh>
    <ASQLAggEnabled>0</ASQLAggEnabled>
    <ASQLAggRLSEnabled>0</ASQLAggRLSEnabled>
    <WholesaleDax>0</WholesaleDax>
    <DataSourceReferenceEnabled>2</DataSourceReferenceEnabled>
    <EnableMDQV3>1</EnableMDQV3>
  </Feature>
  <VertiPaq>
    <EnableDisklessTMImageSave>1</EnableDisklessTMImageSave>
    <EnableProcessingSimplifiedLocks>1</EnableProcessingSimplifiedLocks>
    <ImageLoadStreamBufferMB>2147483647</ImageLoadStreamBufferMB>
  </VertiPaq>
  <DAX>
    <EnableVariationNotation>1</EnableVariationNotation>
    <DQ>
      <EnableAllFunctions>1</EnableAllFunctions>
      <SelectCartridgeUsingConnectionString>0</SelectCartridgeUsingConnectionString>
    </DQ>
  </DAX>
</ConfigurationSettings>
Started MSMDSRV, PID: 29412
MSMDSRV ERR: null
MSMDSRV INF: null
Deleting file C:\Users\JanMechtel\AppData\Local\Temp\tmpF1FD.tmp\msmdsrv.bak
Deleting file C:\Users\JanMechtel\AppData\Local\Temp\tmpF1FD.tmp\msmdsrv.ini
Deleting file C:\Users\JanMechtel\AppData\Local\Temp\tmpF1FD.tmp\msmdsrv_Failed_ini.bak
An unhandled exception occurred.
System.Exception: Process has terminated
   at PbiTools.PowerBI.AnalysisServicesServer.Start() in X:\pbi-tools\pbi-tools-cli\src\PBI-Tools\PowerBI\AnalysisServicesServer.cs:line 145
   at PbiTools.PowerBI.DataModelConverter.LaunchTabularServerAndExecuteCallback[T](Func`2 callback) in X:\pbi-tools\pbi-tools-cli\src\PBI-Tools\PowerBI\DataModelConverter.cs:line 82
   at PbiTools.Model.PbixModel.FromReader(PbixReader reader, String targetFolder, Nullable`1 portNumber) in X:\pbi-tools\pbi-tools-cli\src\PBI-Tools\Model\PbixModel.cs:line 168
   at PbiTools.Cli.CmdLineActions.Extract(String pbixPath, Int32 pbiPort, String extractFolder, ExtractActionCompatibilityMode mode, ModelSerializationMode modelSerialization, MashupSerializationMode mashupSerialization) in X:\pbi-tools\pbi-tools-cli\src\PBI-Tools\Cli\Extract.cs:line 63
--- 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\pbi-tools-cli\src\PBI-Tools\Program.cs:line 82

@mthierba mthierba added the bug Something isn't working label Jan 31, 2022
@mthierba
Copy link
Contributor

Hi @janmechtel I wonder whether this might be related to #60.

The extract command, if you are using Power BI Desktop from the MS Store (instead of the MSI version), relies on copying some of the PBI binaries into a temp location within your user profile and running those from there. Some organizations will have restrictions in place prohibiting those files to be executed inside the user profile. The Beta.8 release provided a solution for that: A custom environment variable PBITOOLS_AppDataDir can be set to enable an alternative TEMP dir - one without such restrictions. #60 was resolved that way.

@janmechtel
Copy link
Author

Thanks for the super-fast reply.

I do indeed run the store version. I guess I can switch to trying to install the .msi

Setting PBITOOLS_AppDataDir did seem to have an effect as the log shows way more files being copied.

PS C:\Users\JanMechtel\Downloads\pbi-tools.1.0.0-beta.8> $Env:PBITOOLS_AppDataDir="C:\Users\JanMechtel\Downloads\pbi-tools.1.0.0-beta.8\AppDataDir"
PS C:\Users\JanMechtel\Downloads\pbi-tools.1.0.0-beta.8> .\pbi-tools.exe extract ".\test.pbix"

Unfortunately the end result is still the same

...
File copied: C:\Users\JanMechtel\Downloads\pbi-tools.1.0.0-beta.8\AppDataDir\Microsoft.MicrosoftPowerBIDesktop_2.100.1401.0_x64__8wekyb3d8bbwe\zh-HANT\Microsoft.Mashup.OAuth.Resources.dll
File copied: C:\Users\JanMechtel\Downloads\pbi-tools.1.0.0-beta.8\AppDataDir\Microsoft.MicrosoftPowerBIDesktop_2.100.1401.0_x64__8wekyb3d8bbwe\zh-HANT\Microsoft.Mashup.OleDbProvider.Resources.dll
File copied: C:\Users\JanMechtel\Downloads\pbi-tools.1.0.0-beta.8\AppDataDir\Microsoft.MicrosoftPowerBIDesktop_2.100.1401.0_x64__8wekyb3d8bbwe\zh-HANT\Microsoft.MashupEngine.Library45.Resources.dll
File copied: C:\Users\JanMechtel\Downloads\pbi-tools.1.0.0-beta.8\AppDataDir\Microsoft.MicrosoftPowerBIDesktop_2.100.1401.0_x64__8wekyb3d8bbwe\zh-HANT\Microsoft.MashupEngine.Resources.dll
File copied: C:\Users\JanMechtel\Downloads\pbi-tools.1.0.0-beta.8\AppDataDir\Microsoft.MicrosoftPowerBIDesktop_2.100.1401.0_x64__8wekyb3d8bbwe\Microsoft.Spatial.NetFX35.dll
File copied: C:\Users\JanMechtel\Downloads\pbi-tools.1.0.0-beta.8\AppDataDir\Microsoft.MicrosoftPowerBIDesktop_2.100.1401.0_x64__8wekyb3d8bbwe\Microsoft.Spatial.NetFX35.V7.dll
File copied: C:\Users\JanMechtel\Downloads\pbi-tools.1.0.0-beta.8\AppDataDir\Microsoft.MicrosoftPowerBIDesktop_2.100.1401.0_x64__8wekyb3d8bbwe\PowerBIExtensions.dll
Using msmdsrv from shadow-copied location: C:\Users\JanMechtel\Downloads\pbi-tools.1.0.0-beta.8\AppDataDir\Microsoft.MicrosoftPowerBIDesktop_2.100.1401.0_x64__8wekyb3d8bbwe\msmdsrv.exe
Started MSMDSRV, PID: 31468
MSMDSRV INF: null
MSMDSRV ERR: null
Deleting file C:\Users\JanMechtel\AppData\Local\Temp\tmp26.tmp\msmdsrv.bak
Deleting file C:\Users\JanMechtel\AppData\Local\Temp\tmp26.tmp\msmdsrv.ini
Deleting file C:\Users\JanMechtel\AppData\Local\Temp\tmp26.tmp\msmdsrv_Failed_ini.bak
An unhandled exception occurred.
System.Exception: Process has terminated
   at PbiTools.PowerBI.AnalysisServicesServer.Start() in X:\pbi-tools\pbi-tools-cli\src\PBI-Tools\PowerBI\AnalysisServicesServer.cs:line 145
   at PbiTools.PowerBI.DataModelConverter.LaunchTabularServerAndExecuteCallback[T](Func`2 callback) in X:\pbi-tools\pbi-tools-cli\src\PBI-Tools\PowerBI\DataModelConverter.cs:line 82
   at PbiTools.Model.PbixModel.FromReader(PbixReader reader, String targetFolder, Nullable`1 portNumber) in X:\pbi-tools\pbi-tools-cli\src\PBI-Tools\Model\PbixModel.cs:line 168
   at PbiTools.Cli.CmdLineActions.Extract(String pbixPath, Int32 pbiPort, String extractFolder, ExtractActionCompatibilityMode mode, ModelSerializationMode modelSerialization, MashupSerializationMode mashupSerialization) in X:\pbi-tools\pbi-tools-cli\src\PBI-Tools\Cli\Extract.cs:line 63
--- 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\pbi-tools-cli\src\PBI-Tools\Program.cs:line 82
PS C:\Users\JanMechtel\Downloads\pbi-tools.1.0.0-beta.8> 

@janmechtel
Copy link
Author

I'll try the non-store version of Power BI Desktop

@mthierba
Copy link
Contributor

Okay, thanks for checking that anyway! It's a first - I've extracted thousands of files using this method so far. I wonder whether something is unique to your test PBIX? Have you tried this with others? Would you possibly be able to share a failing file for further diagnostics?

@mthierba
Copy link
Contributor

Actually strike that, I've had another look at your log. Two things here:

  • Your custom AppDataDir is still inside the User Profile: C:\Users\JanMechtel\Downloads\pbi-tools.1.0.0-beta.8\AppDataDir. Please use a folder outside of C:\Users\
  • The error occurs when starting the msmdsrv process, hence can't have anything to do with that specific PBIX.

Given what I can see, it's very likely this is the same as #60. Please retry with another temp dir.

@janmechtel
Copy link
Author

Ok I've installed Power BI Desktop (non-store) and also tried in an Administrator elevated shell. Same problem.

For the test.pbix please see test.zip. It's actually I've created
specifically to rule out that it's related to my models.

Maybe it's related to the Working directory: C:\Users\JanMechtel\AppData\Local\Temp\tmp4E5E.tmp I tried to find how to change that?

@janmechtel
Copy link
Author

Moved it to C:\Projects still same problem. I'll have a look at the code and see if I can run the MSMDSRV myself?

Maybe there is a way to get a log from it.

PS C:\Users\JanMechtel\Downloads\pbi-tools.1.0.0-beta.8> $Env:PBITOOLS_LogLevel="Verbose"
PS C:\Users\JanMechtel\Downloads\pbi-tools.1.0.0-beta.8> $Env:PBITOOLS_AppDataDir="C:\Projects\pbitools\AppData\"
PS C:\Users\JanMechtel\Downloads\pbi-tools.1.0.0-beta.8> pro
PS C:\Projects> cd .\pbitools\
PS C:\Projects\pbitools> .\pbi-tools.exe extract ".\test.pbix"
Log level: Verbose
Invoking 'BeforeValidateDefinition'
Action: Void Cache(PbiTools.Cli.CacheAction)
 Default Alias: Cache
 Alias: Cache
 Alias: cache
 Metadata: PowerArgs.ArgActionMethod
 Shortcut: cache
 Metadata: PowerArgs.ArgDescription
 Metadata: PowerArgs.ArgExample
Action: Void CompilePbix(System.String, System.String, PbiTools.PowerBI.PbiFileFormat, Boolean)
 Default Alias: CompilePbix
 Alias: CompilePbix
 Alias: compile
 Alias: compile-pbix
 Metadata: PowerArgs.ArgActionMethod
 Shortcut: compile
 Shortcut: compile-pbix
 Metadata: PowerArgs.ArgDescription
Action: Void Convert(System.String, System.String, PbiTools.ProjectSystem.ModelSerializationMode, PbiTools.ProjectSystem.MashupSerializationMode, System.String, Boolean, Boolean, Boolean)
 Default Alias: Convert
 Alias: Convert
 Alias: convert
 Metadata: PowerArgs.ArgActionMethod
 Shortcut: convert
 Metadata: PowerArgs.ArgDescription
Action: Void Deploy(System.String, System.String, System.String, System.String, Boolean)
 Default Alias: Deploy
 Alias: Deploy
 Alias: deploy
 Metadata: PowerArgs.ArgActionMethod
 Shortcut: deploy
 Metadata: PowerArgs.ArgDescription
Action: Void ExportData(Int32, System.String, System.String, System.String)
 Default Alias: ExportData
 Alias: ExportData
 Alias: export-data
 Metadata: PowerArgs.ArgActionMethod
 Shortcut: export-data
 Metadata: PbiTools.Cli.ArgAltShortcut
 Metadata: PowerArgs.ArgDescription
 Metadata: PowerArgs.ArgExample
 Metadata: PowerArgs.ArgExample
Action: Void ExportUsage(System.String)
 Default Alias: ExportUsage
 Alias: ExportUsage
 Alias: export-usage
 Metadata: PowerArgs.ArgActionMethod
 Shortcut: export-usage
 Metadata: PowerArgs.OmitFromUsageDocs
Action: Void Extract(System.String, Int32, System.String, PbiTools.Cli.ExtractActionCompatibilityMode, PbiTools.ProjectSystem.ModelSerializationMode, PbiTools.ProjectSystem.MashupSerializationMode)
 Default Alias: Extract
 Alias: Extract
 Alias: extract
 Metadata: PowerArgs.ArgActionMethod
 Shortcut: extract
 Metadata: PowerArgs.ArgDescription
 Metadata: PowerArgs.ArgExample
 Metadata: PowerArgs.ArgExample
Action: Void GenerateBim(System.String, Boolean, PbiTools.Cli.ExportTransforms)
 Default Alias: GenerateBim
 Alias: GenerateBim
 Alias: generate-bim
 Metadata: PowerArgs.ArgActionMethod
 Shortcut: generate-bim
 Metadata: PbiTools.Cli.ArgAltShortcut
 Metadata: PowerArgs.ArgDescription
Action: Void Git(PbiTools.Cli.GitAction)
 Default Alias: Git
 Alias: Git
 Alias: git
 Metadata: PowerArgs.ArgActionMethod
 Shortcut: git
 Metadata: PowerArgs.ArgDescription
 Metadata: PowerArgs.ArgExample
Action: Void Info(Boolean)
 Default Alias: Info
 Alias: Info
 Alias: info
 Metadata: PowerArgs.ArgActionMethod
 Shortcut: info
 Metadata: PowerArgs.ArgDescription
 Metadata: PowerArgs.ArgExample
Action: Void Init(PbiTools.Cli.InitAction, System.String)
 Default Alias: Init
 Alias: Init
 Alias: init
 Metadata: PowerArgs.ArgActionMethod
 Shortcut: init
 Metadata: PowerArgs.ArgDescription
Action: Void LaunchPbiDesktop(System.String)
 Default Alias: LaunchPbiDesktop
 Alias: LaunchPbiDesktop
 Alias: launch-pbi
 Metadata: PowerArgs.ArgActionMethod
 Shortcut: launch-pbi
 Metadata: PowerArgs.ArgDescription
'RemoveAutoAliases' invoked. Caller: BeforeValidateDefinition
Invoking Action: extract(Aliases=1)(Arguments=6)
Attempting to resolve assembly: Microsoft.PowerBI.Packaging, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Using Power BI Desktop install: 2.100.1401.0 (21.12) at C:\Program Files\Microsoft Power BI Desktop\bin
Assembly 'Microsoft.PowerBI.Packaging, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' found at C:\Program Files\Microsoft Power BI Desktop\bin\Microsoft.PowerBI.Packaging.dll
Reading PbixModel from file at C:\Projects\pbitools\test.pbix (Version: 1.25)
Reading Connections...
Reading Report...
Reading DiagramLayout...
Reading DiagramViewState...
Reading LinguisticSchemaXml...
Reading LinguisticSchema...
Reading ReportMetadata...
Reading ReportSettings...
Reading CustomVisuals...
Reading StaticResources...
Reading DataModel...
MSMDSRV.EXE found at C:\Program Files\Microsoft Power BI Desktop\bin\msmdsrv.exe
Working directory: C:\Users\JanMechtel\AppData\Local\Temp\tmp21E7.tmp
<ConfigurationSettings>
  <TMCompatibilitySKU>0</TMCompatibilitySKU>
  <RecoveryModel>1</RecoveryModel>
  <DisklessModeRequested>1</DisklessModeRequested>
  <InstanceVisible>0</InstanceVisible>
  <AllowedBrowsingFolders>C:\Users\JanMechtel\AppData\Local\Temp\tmp21E7.tmp</AllowedBrowsingFolders>
  <Language>8192</Language>
  <Port>0</Port>
  <PrivateProcess>27876</PrivateProcess>
  <BackupDir>C:\Users\JanMechtel\AppData\Local\Temp\tmp21E7.tmp</BackupDir>
  <LogDir>C:\Users\JanMechtel\AppData\Local\Temp\tmp21E7.tmp</LogDir>
  <TempDir>C:\Users\JanMechtel\AppData\Local\Temp\tmp21E7.tmp</TempDir>
  <DataDir>C:\Users\JanMechtel\AppData\Local\Temp\tmp21E7.tmp</DataDir>
  <DeploymentMode>1</DeploymentMode>
  <CleanDataFolderOnStartup>1</CleanDataFolderOnStartup>
  <AutoSetDefaultInitialCatalog>1</AutoSetDefaultInitialCatalog>
  <Network>
    <ListenOnlyOnLocalConnections>1</ListenOnlyOnLocalConnections>
    <Requests>
      <EnableBinaryXML>1</EnableBinaryXML>
      <EnableCompression>1</EnableCompression>
    </Requests>
    <Responses>
      <EnableBinaryXML>1</EnableBinaryXML>
      <EnableCompression>1</EnableCompression>
      <CompressionLevel>9</CompressionLevel>
    </Responses>
  </Network>
  <Debug>
    <CallStackInError>0</CallStackInError>
  </Debug>
  <Log>
    <Exception>
      <CrashReportsFolder>C:\Users\JanMechtel\AppData\Local\Temp\tmp21E7.tmp</CrashReportsFolder>
    </Exception>
    <Trace>
      <TraceFileBufferSize>128</TraceFileBufferSize>
    </Trace>
    <FlightRecorder>
      <Enabled>1</Enabled>
      <FileSizeMB>50</FileSizeMB>
      <LogDurationSec>36000</LogDurationSec>
    </FlightRecorder>
  </Log>
  <Memory>
    <MemoryHeapType>5</MemoryHeapType>
  </Memory>
  <ResourceGovernance>
    <GovernIMBIScheduler>0</GovernIMBIScheduler>
  </ResourceGovernance>
  <Feature>
    <ManagedCodeEnabled>1</ManagedCodeEnabled>
    <MEngineTracingEnabled>0</MEngineTracingEnabled>
    <UseXPress9Compression>1</UseXPress9Compression>
    <SkipXPress9CompressionSizeMB>0</SkipXPress9CompressionSizeMB>
    <CompositeModel>1</CompositeModel>
    <ManyToManyRelationship>1</ManyToManyRelationship>
    <EnableIncrementalRefresh>1</EnableIncrementalRefresh>
    <ASQLAggEnabled>0</ASQLAggEnabled>
    <ASQLAggRLSEnabled>0</ASQLAggRLSEnabled>
    <WholesaleDax>0</WholesaleDax>
    <DataSourceReferenceEnabled>2</DataSourceReferenceEnabled>
    <EnableMDQV3>1</EnableMDQV3>
  </Feature>
  <VertiPaq>
    <EnableDisklessTMImageSave>1</EnableDisklessTMImageSave>
    <EnableProcessingSimplifiedLocks>1</EnableProcessingSimplifiedLocks>
    <ImageLoadStreamBufferMB>2147483647</ImageLoadStreamBufferMB>
  </VertiPaq>
  <DAX>
    <EnableVariationNotation>1</EnableVariationNotation>
    <DQ>
      <EnableAllFunctions>1</EnableAllFunctions>
      <SelectCartridgeUsingConnectionString>0</SelectCartridgeUsingConnectionString>
    </DQ>
  </DAX>
</ConfigurationSettings>
Started MSMDSRV, PID: 1216
MSMDSRV ERR: null
MSMDSRV INF: null
Deleting file C:\Users\JanMechtel\AppData\Local\Temp\tmp21E7.tmp\msmdsrv.bak
Deleting file C:\Users\JanMechtel\AppData\Local\Temp\tmp21E7.tmp\msmdsrv.ini
Deleting file C:\Users\JanMechtel\AppData\Local\Temp\tmp21E7.tmp\msmdsrv_Failed_ini.bak
An unhandled exception occurred.
System.Exception: Process has terminated
   at PbiTools.PowerBI.AnalysisServicesServer.Start() in X:\pbi-tools\pbi-tools-cli\src\PBI-Tools\PowerBI\AnalysisServicesServer.cs:line 145
   at PbiTools.PowerBI.DataModelConverter.LaunchTabularServerAndExecuteCallback[T](Func`2 callback) in X:\pbi-tools\pbi-tools-cli\src\PBI-Tools\PowerBI\DataModelConverter.cs:line 82
   at PbiTools.Model.PbixModel.FromReader(PbixReader reader, String targetFolder, Nullable`1 portNumber) in X:\pbi-tools\pbi-tools-cli\src\PBI-Tools\Model\PbixModel.cs:line 168
   at PbiTools.Cli.CmdLineActions.Extract(String pbixPath, Int32 pbiPort, String extractFolder, ExtractActionCompatibilityMode mode, ModelSerializationMode modelSerialization, MashupSerializationMode mashupSerialization) in X:\pbi-tools\pbi-tools-cli\src\PBI-Tools\Cli\Extract.cs:line 63
--- 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\pbi-tools-cli\src\PBI-Tools\Program.cs:line 82

@mthierba
Copy link
Contributor

mthierba commented Jan 31, 2022

Uhm....

Your msmdsrv is actually coming from the MSI installer location: C:\Program Files\Microsoft Power BI Desktop\bin. Which means the temp copy directory is not relevant.

That same file opens fine in PBI Desktop?

Could you try to run the extract on any of the files here: https://github.com/microsoft/powerbi-desktop-samples/tree/main/Monthly%20Desktop%20Blog%20Samples

@janmechtel
Copy link
Author

janmechtel commented Jan 31, 2022

I'm new to msmdsrv.exe and a bit puzzled.

  • When I start Power BI Desktop. I can see msmdsrv.exe run with roughly this cmd line .\msmdsrv.exe -c -n test -s "C:\Projects\pbitools\test
    image

  • When I manually try to invoke the command, then there is no error message, the config files are written into the folder. but the process is not started / I can't find it in the task manager.

image

@mthierba
Copy link
Contributor

The directory given on the -s arg needs to have a msmdsrv ini file in it. Open PBI Desktop and run pbi-tools info - that'll list the current pbiSession including the msmdsrv working directory. Open that one up in explorer - it'll have the ini file (generated by PBI Desktop).

@janmechtel
Copy link
Author

janmechtel commented Jan 31, 2022

Ok, I'll give it a try and seed them.

It looked like when the directory is empty msmdsrv actually creates some msmdsrv.ini + msmdsrv.bak in there.
image

Also I'll try on a different machine, maybe that works.

@mthierba
Copy link
Contributor

mthierba commented Jan 31, 2022

The auto-generated ini won't be sufficient to open PBI models. It needs to be the one provided by PBI Desktop or pbi-tools (template: https://github.com/pbi-tools/pbi-tools/blob/main/src/PBI-Tools/PowerBI/msmdsrv.ini.xml). Ultimately, this is replicating exactly what PBI Desktop does when opening a pbix with an embedded model.

@janmechtel
Copy link
Author

I can try with a different ini file. I'm just surprised that there is no meaningful output / msmdsrv.exe doesn't show up in my process list yet at all.

@janmechtel
Copy link
Author

So loading msmdsrv.exe with an existing ini directory (as being use bei PowerBI Desktop works fine).

.\msmdsrv.exe -c -n test -s "C:\\Users\\JanMechtel\\AppData\\Local\\Microsoft\\Power BI Desktop\\AnalysisServicesWorkspaces\\AnalysisServicesWorkspace_3639451b-b082-4c09-99b3-633bc2c85f00\\Data"`

Will show meaningful output and the process is visible in Task manager

@janmechtel
Copy link
Author

I'll try to see if I can observe the ini that pbi-tools are supposed to put into the _tempDirectory

Is there a way to change the working directory?

@janmechtel
Copy link
Author

janmechtel commented Jan 31, 2022

Your msmdsrv is actually coming from the MSI installer location: C:\Program Files\Microsoft Power BI Desktop\bin. Which means the temp copy directory is not relevant.

How should I understand this here:

// Start new instance
// '-n' arg is REQUIRED for dynamic port assignment! -- will only use default port 2383 otherwise (and fail if that port is in use)
var procStartInfo = new ProcessStartInfo(_asToolPath, $"-c -n {Guid.NewGuid()} -s \"{_tempPath}\"")
{
    WorkingDirectory = _tempPath,
};

On first glance it looks like it's setting the folder to the temp working directory.

@mthierba
Copy link
Contributor

Those files get auto deleted as soon as the msmdsrv process exits (even when it fails). But I could provide a private build which doesn't do that.

@janmechtel
Copy link
Author

janmechtel commented Jan 31, 2022

If you like I can also try to build myself, in case you want some battle testing for the build instructions?

It's been a while since i did anything with VS Studio though. Might be more work than help.

@janmechtel
Copy link
Author

So quick update, my other machine works fine. Even with the Power BI Desktop version from the store :-/

Maybe I should restart and try again on this machine.

mthierba added a commit that referenced this issue Jan 31, 2022
@mthierba
Copy link
Contributor

mthierba commented Jan 31, 2022

Just pushed a new branch with some debug enhancements to https://github.com/pbi-tools/pbi-tools/tree/Issues/78-MT (accidentally also pushed it to main... SILLY!)

This one allows you to set a new environment variable PBITOOLS_Debug:

$env:PBITOOLS_Debug = "1"

The effect of that is twofold:

  • The current working dir becomes the msmdsrv workspace (be aware - this creates a bunch of new files!)
  • That directory does not get cleaned up, i.e. you can inspect the ini and log files afterwards.

Checkout the branch and build with:

.\build.cmd Publish

That'll create the exe in ./.build/dist/desktop for you to try.

(I've just seen your previous note!)

@janmechtel
Copy link
Author

So building worked and I debug now.

First observation is that there is msmdsrv_Failed_ini.bak visible (before all of the files get deleted).

I believe it's written after pbi-tools attempts to run the process msmdsrv.

I've also tried to make the process window visible but it only flashes.

Now I'll try to get the exact command of the process that pbi-tools would run and then try to run that manually.

@janmechtel
Copy link
Author

Running it manually doesn't do much

PS C:\Program Files\Microsoft Power BI Desktop\bin> .\msmdsrv.exe -c -n b4169ac5-21ea-4ac8-863b-c32ed4864eb0 -s "C:\\Users\\JanMechtel\\AppData\\Local\\Temp\\tmpFA8A.tmp"
-c -n b4169ac5-21ea-4ac8-863b-c32ed4864eb0 -s C:\\Users\\JanMechtel\\AppData\\Local\\Temp\\tmpFA8A.tmp
Server instance name MSOLAP$b4169ac5-21ea-4ac8-863b-c32ed4864eb0

Neither the _Failed.bak is written, nor does the process show up in task manager.

@janmechtel
Copy link
Author

Ok, I'll check it out now.

@mthierba
Copy link
Contributor

mthierba commented Jan 31, 2022

msmdsrv aims to attach itself to a parent process. A valid process ID needs to be specified in msmdsrv.ini before launching it:

image

Would grab the ID from your cmd window, for instance.

pbi-tools inserts its own proc id in there when it writes the ini.

@janmechtel
Copy link
Author

janmechtel commented Jan 31, 2022

No dice yet, but indeed the temp directory is the local directory now.

PS C:\Users\JanMechtel> cd C:\Projects\pbitools\pbitools\.build\dist\desktop
PS C:\Projects\pbitools\pbitools\.build\dist\desktop> $env:PBITOOLS_Debug = "1"
PS C:\Projects\pbitools\pbitools\.build\dist\desktop> .\pbi-tools.exe extract ".\test.pbix"
Using Power BI Desktop install: 2.100.1401.0 (21.12) at C:\Program Files\Microsoft Power BI Desktop\bin
MSMDSRV.EXE found at C:\Program Files\Microsoft Power BI Desktop\bin\msmdsrv.exe
Working directory: C:\Projects\pbitools\pbitools\.build\dist\desktop
An unhandled exception occurred.
System.Exception: Process has terminated
   at PbiTools.PowerBI.AnalysisServicesServer.Start() in C:\Projects\pbitools\pbitools\src\PBI-Tools\PowerBI\AnalysisServicesServer.cs:line 150
   at PbiTools.PowerBI.DataModelConverter.LaunchTabularServerAndExecuteCallback[T](Func`2 callback) in C:\Projects\pbitools\pbitools\src\PBI-Tools\PowerBI\DataModelConverter.cs:line 82
   at PbiTools.Model.PbixModel.FromReader(PbixReader reader, String targetFolder, Nullable`1 portNumber) in C:\Projects\pbitools\pbitools\src\PBI-Tools\Model\PbixModel.cs:line 168
   at PbiTools.Cli.CmdLineActions.Extract(String pbixPath, Int32 pbiPort, String extractFolder, ExtractActionCompatibilityMode mode, ModelSerializationMode modelSerialization, MashupSerializationMode mashupSerialization) in C:\Projects\pbitools\pbitools\src\PBI-Tools\Cli\Extract.cs:line 63
--- 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 C:\Projects\pbitools\pbitools\src\PBI-Tools\Program.cs:line 82
PS C:\Projects\pbitools\pbitools\.build\dist\desktop

@janmechtel
Copy link
Author

I go for the restart before we waste the whole night.

@janmechtel
Copy link
Author

After restart and same problem. I've attempted to put the process id from my current powershell into the msmdsrv.ini but it results in the same behavior:

  • Output is minimal
  • msmdsrv.ini gets renamed to msmdsrv_Failed_ini.bak
  • two 33KB msmdsrv.ini and .bak get written instead

I'll check if there is a "verbose" mode for msmdsrv.exe

@mthierba
Copy link
Contributor

mthierba commented Feb 3, 2022

Fix for this is now available in interim release: https://github.com/pbi-tools/pbi-tools/releases/tag/1.0.0-beta.9%2B220202

Thanks again @janmechtel for extensive help here!

@Khushi186
Copy link

Hello @mthierba ,
I am following this video PBI-Tools Part 1 - Introduction and Setup (https://www.youtube.com/watch?v=6zyvtxJSoyA&list=PLzN99cpDw6oA6nQuteFG0ycDI7MfVxy9s&index=1) and tried to follow the same.
But I am getting this error. Can you please help me out why this is happening?
PS C:\PBI_Automation\RDA-PowerBI-Reports> pbi-tools deploy . Files PROD -whatif
Reading PBIXPROJ settings from: C:\PBI_Automation\RDA-PowerBI-Reports.pbixproj.json
=== Deployment WhatIf mode enabled ===
An unhandled exception occurred.
System.AggregateException: One or more errors occurred. ---> PbiTools.Deployments.DeploymentException: The current project does not contain the specified deploymment 'Files'
at PbiTools.Deployments.DeploymentManager.d__30.MoveNext()
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at PbiTools.Cli.CmdLineActions.Deploy(String folder, String label, String environment, String basePath, Boolean whatIf)
--- 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)

@mthierba
Copy link
Contributor

Hi,

your command (pbi-tools deploy . Files PROD) assumes that your .pbixproj.json manifest file contains a deployment manifest called "Files" and an environment called "PROD". Looking at the error message, it appears that in your case the manifest label is something other than "Files".

This example uses "Files" for the manifest and "Development" for the environment:

image

@Khushi186
Copy link

Thanks @mthierba for your quick reply.
Sorry I did not get it properly. I am a beginner of using Git.
Can you help me out to solve this?
Is it possible to share the previous step? Like What is "Files" here and what do I really need to do with this?
Step from the beginning that can help me out to resolve this issue.
Thanks

@Khushi186
Copy link

Hello @mthierba,
I have resolved that issue by providing pbix filename. Now it is saying that deployment completed successfully but when I checked my workspace, pbix file is not deployed. Any suggestion, how to resolve this?
image

@mthierba
Copy link
Contributor

@Khushi186 Running pbi-tools deploy with the -whatif toggle will explicitly only perform a test/validation run without actually modifying any of your workspaces. Drop the -whatif from the command-line and it should go through.

@Khushi186
Copy link

Thanks, Tested it locally, its working now.

@Khushi186
Copy link

Hello @mthierba
Workflow was running properly but now I am getting this error while deploying the Reports.
It seems related to authentication of APIs, but not sure.
Can you please help me what's going wrong here?
image
Thanks

@mthierba
Copy link
Contributor

Your service principal is not sufficiently set up.

There are a few prerequisites you should check:

  1. Your Azure AD service principals should NOT have any Power BI Application Permissions selected

image

  1. In your Power BI Admin portal, service principal access needs to be enabled for the tenant. Ideally, scoped to specific security groups (one of which your service principal needs to belong to).

image

The screenshot shows some broken labels - this currently applies to many PBI tenants while some backend updates are being rolled out.

  1. The service principal you're using for the deployment needs to have access to your target workspace(s), with Contributor or Member permissions.

image

With those three settings in place things should work well!

@Khushi186
Copy link

Khushi186 commented May 16, 2023

I have added these permissions in service principal as an Delegated Permissions, not Application Permissions.
image
I don't think delegated one will be an issue. Correct ?
and Step 2 and Step 3 are already in Place.

@mthierba
Copy link
Contributor

No permissions should be added in AAD, neither Application nor Delegated. All you need is a blank AAD application with a secret set.

@Khushi186
Copy link

Yesterday I added those permissions and after that pipeline was working fine. Today it started failing.
As you suggested, I have removed the permissions, still having same error.
May be some backend updates will take time.
Thanks

@mthierba
Copy link
Contributor

I'd suggest to create an entirely new, clean, app with no permissions applied from the start. There may well be some sync issues now after you made various changes.

@Khushi186
Copy link

Ok, Thanks. I will create new one and will also update you once my pipeline will start working again.
Thank you !

@Khushi186
Copy link

Thanks @mthierba. Its working with New SPN.
I am also wondering if you have created any blogs on topic - How to automating the Backup of Datasets in Azure Storage account using Service Principal.
Could you please suggest if any?
Thanks

@Khushi186
Copy link

Khushi186 commented Nov 17, 2023

Hello @mthierba ,
My workflow for report deployment was working properly till yesterday but now I am getting error which seems related to import operations or docker version? but not sure how to resolve this.
Can you please help me how can I resolve this ? Below is the error :

Run /app/pbi-tools/pbi-tools.core deploy . "$PROFILE" "$ENVIRONMENT"
Reading PBIXPROJ settings from: /__w/RDA-Orbis-PowerBI-Reports/RDA-Orbis-PowerBI-Reports/.pbixproj.json
Starting deployment 'Files' into environment: Test .
Found 5 source files to deploy.
Access token received. Expires On: 11/17/2023 16:37:5
An unhandled exception occurred.
System.AggregateException: One or more errors occurred. (HTTP Error: BadRequest
{
"error": {
"code": "PowerBIModelNotFoundException",
"pbi.error": {
"code": "PowerBIModelNotFoundException",
"parameters": {},
"details": [],
"exceptionCulprit": 1
}
}
})
---> PbiTools.Deployments.DeploymentException: HTTP Error: BadRequest
{
"error": {
"code": "PowerBIModelNotFoundException",
"pbi.error": {
"code": "PowerBIModelNotFoundException",
"parameters": {},
"details": [],
"exceptionCulprit": 1
}
}
}
---> Microsoft.Rest.HttpOperationException: Operation returned an invalid status code 'BadRequest'
at Microsoft.PowerBI.Api.ImportsOperations.UploadFile(Nullable1 groupId, Stream file, String datasetDisplayName, Nullable1 nameConflict, Nullable1 skipReport, Nullable1 overrideReportLabel, Nullable1 overrideModelLabel, Dictionary2 customHeaders, CancellationToken cancellationToken)
at Microsoft.PowerBI.Api.ImportsOperations.PostImportFileWithHttpMessage(Nullable1 groupId, Stream file, String datasetDisplayName, Nullable1 nameConflict, Nullable1 skipReport, Nullable1 overrideReportLabel, Nullable1 overrideModelLabel, Dictionary2 customHeaders, CancellationToken cancellationToken)
at Microsoft.PowerBI.Api.ImportsOperationsExtensions.PostImportWithFileAsyncInGroup(IImportsOperations operations, Guid groupId, Stream fileStream, String datasetDisplayName, Nullable1 nameConflict, Nullable1 skipReport, Nullable1 overrideReportLabel, Nullable1 overrideModelLabel, CancellationToken cancellationToken)
at PbiTools.Deployments.DeploymentManager.ImportReportAsync(ReportDeploymentInfo args, IPowerBIClient powerbi, String workspace, IDictionary`2 workspaceIdCache) in X:\pbi-tools\BRANCHES\fody\src\PBI-Tools\Deployments\DeploymentManager.Report.cs:line 302
at PbiTools.Deployments.DeploymentManager.DeployReportAsync(PbiDeploymentManifest manifest, String label, String environment) in X:\pbi-tools\BRANCHES\fody\src\PBI-Tools\Deployments\DeploymentManager.Report.cs:line 99
--- End of inner exception stack trace ---
at PbiTools.Deployments.DeploymentManager.DeployReportAsync(PbiDeploymentManifest manifest, String label, String environment) in X:\pbi-tools\BRANCHES\fody\src\PBI-Tools\Deployments\DeploymentManager.Report.cs:line 103
at PbiTools.Deployments.DeploymentManager.DeployAsync(String profileName, String environment) in X:\pbi-tools\BRANCHES\fody\src\PBI-Tools\Deployments\DeploymentManager.cs:line 88
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at PbiTools.Cli.CmdLineActions.Deploy(String folder, String label, String environment, String basePath, Boolean whatIf) in X:\pbi-tools\BRANCHES\fody\src\PBI-Tools\Cli\Deploy.cs:line 41
--- End of stack trace from previous location ---
at PowerArgs.ArgAction.Invoke()
at PbiTools.Program.Main(String[] args) in X:\pbi-tools\BRANCHES\fody\src\PBI-Tools\Program.cs:line 104
Error: Process completed with exit code 247.

Thanks in advance.

@mthierba
Copy link
Contributor

mthierba commented Nov 17, 2023 via email

@Khushi186
Copy link

Khushi186 commented Nov 17, 2023

Here Thin report means what? Did not get it.
Because we are trying to deploy report having a live connection to the dataset. and all the required permissions are there in the dataset as well.
Do I need to check with Power BI admin to disable and enable API permissions on Power BI Tenant setting to allow service principal to use Power BI Apis ?

@mthierba
Copy link
Contributor

mthierba commented Nov 17, 2023 via email

@Khushi186
Copy link

Hello @mthierba ,
Service principal already have the access to the workspace, it was working from past 4 months but now its giving an error that I mentioned above.
image

@Khushi186
Copy link

Khushi186 commented Nov 20, 2023

Hello @mthierba ,
I just changed the version in the script and added -what if , now pipeline is working.
image
Can you please let me know in what case I should use -what if or in what case I should drop -what if toggle?

Thanks in advance

@mthierba
Copy link
Contributor

@Khushi186 The -whatif toggle is merely there to allow syntax validation of the deployment manifest. Any whatif deployments, however, do NOT perform any deployment actions. Those will only parse and validate the manifest as well as the credentials.

@mthierba
Copy link
Contributor

Hello @mthierba , Service principal already have the access to the workspace, it was working from past 4 months but now its giving an error that I mentioned above. image

Did you try to replicate the setup in another workspace? I can confirm that the error you've quoted is raised if (1) the referenced model doesn't exist, or (2) the principal does not have sufficient permissions. This is s setup issue and technically outside the scope of pbi-tools.

@Khushi186
Copy link

Yes I tried to do that but it was throwing same error and now when I dropped the -what if toggle from the deployment manifest its again giving same error -
An unhandled exception occurred.
System.AggregateException: One or more errors occurred. (HTTP Error: BadRequest
{
"error": {
"code": "PowerBIModelNotFoundException",
"pbi.error": {
"code": "PowerBIModelNotFoundException",
"parameters": {},
"details": [],
"exceptionCulprit": 1
}
}
})
---> PbiTools.Deployments.DeploymentException: HTTP Error: BadRequest
{
"error": {
"code": "PowerBIModelNotFoundException",
"pbi.error": {
"code": "PowerBIModelNotFoundException",
"parameters": {},
"details": [],
"exceptionCulprit": 1
}
}
}
---> Microsoft.Rest.HttpOperationException: Operation returned an invalid status code 'BadRequest'
at Microsoft.PowerBI.Api.ImportsOperations.UploadFile(Nullable1 groupId, Stream file, String datasetDisplayName, Nullable1 nameConflict, Nullable1 skipReport, Nullable1 overrideReportLabel, Nullable1 overrideModelLabel, Dictionary2 customHeaders, CancellationToken cancellationToken)
at Microsoft.PowerBI.Api.ImportsOperations.PostImportFileWithHttpMessage(Nullable1 groupId, Stream file, String datasetDisplayName, Nullable1 nameConflict, Nullable1 skipReport, Nullable1 overrideReportLabel, Nullable1 overrideModelLabel, Dictionary2 customHeaders, CancellationToken cancellationToken)
at Microsoft.PowerBI.Api.ImportsOperationsExtensions.PostImportWithFileAsyncInGroup(IImportsOperations operations, Guid groupId, Stream fileStream, String datasetDisplayName, Nullable1 nameConflict, Nullable1 skipReport, Nullable1 overrideReportLabel, Nullable1 overrideModelLabel, CancellationToken cancellationToken)
at PbiTools.Deployments.DeploymentManager.ImportReportAsync(ReportDeploymentInfo args, IPowerBIClient powerbi, String workspace, IDictionary`2 workspaceIdCache) in X:\pbi-tools\BRANCHES\rc.5\src\PBI-Tools\Deployments\DeploymentManager.Report.cs:line 302
at PbiTools.Deployments.DeploymentManager.DeployReportAsync(PbiDeploymentManifest manifest, String label, String environment) in X:\pbi-tools\BRANCHES\rc.5\src\PBI-Tools\Deployments\DeploymentManager.Report.cs:line 99
--- End of inner exception stack trace ---
at PbiTools.Deployments.DeploymentManager.DeployReportAsync(PbiDeploymentManifest manifest, String label, String environment) in X:\pbi-tools\BRANCHES\rc.5\src\PBI-Tools\Deployments\DeploymentManager.Report.cs:line 103
at PbiTools.Deployments.DeploymentManager.DeployAsync(String profileName, String environment) in X:\pbi-tools\BRANCHES\rc.5\src\PBI-Tools\Deployments\DeploymentManager.cs:line 88
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at PbiTools.Cli.CmdLineActions.Deploy(String folder, String label, String environment, String basePath, Boolean whatIf) in X:\pbi-tools\BRANCHES\rc.5\src\PBI-Tools\Cli\Deploy.cs:line 41
--- End of stack trace from previous location ---
at PowerArgs.ArgAction.Invoke()
at PbiTools.Program.Main(String[] args) in X:\pbi-tools\BRANCHES\rc.5\src\PBI-Tools\Program.cs:line 104
Error: Process completed with exit code 247.

@Khushi186
Copy link

Khushi186 commented Nov 27, 2023

Hi @mthierba ,
I created new Git Repository and setup everything as it is. And its working properly in the new repository.
I'm wondering what's wrong in the existing Git repository?
Any suggestion if I can fix the issue in existing Git repository?

Thanks

@mthierba
Copy link
Contributor

@Khushi186 Since your issue is related to credentials/permissions, I'm assuming the (working) credentials configured in your new git repo do not match the (failing) ones in the old one?

@Khushi186
Copy link

I have used the same credentials, no change at all...I just created new repository and setup workflow.
Didn't get what's issue is there in the existing one.

@Khushi186
Copy link

This is happening coz I have branch protection rules enabled in GitHub repo and I toggled the "Disable" and "Enable" state of those rules, thats why its impacting the ability to run workflows. and its failing....
Any suggestion to resolve this issue?

@mthierba
Copy link
Contributor

It is virtually impossible to comment further without detailed insights into your specific setup. Since we've already concluded that this is not a pbi-tools issue, this is as far as free community support can go, I'm afraid. Please email me for alternative options.

@Khushi186
Copy link

Hello @mthierba ,
I tried to debug it in workflow and getting below error :
Run echo "GitHub Workspace: $GITHUB_WORKSPACE"
GitHub Workspace: /__w/Workspace/Workspace
PBI_CLIENT_SECRET:
PROFILE: Files
ENVIRONMENT: Test
cat: .pbi-tools.config: No such file or directory

An unhandled exception occurred.
System.AggregateException: One or more errors occurred. (HTTP Error: Unauthorized
{
"error": {
"code": "UnknownError",
"pbi.error": {
"code": "UnknownError",
"parameters": {},
"details": [],
"exceptionCulprit": 1
}
}
})
---> PbiTools.Deployments.DeploymentException: HTTP Error: Unauthorized
{
"error": {
"code": "UnknownError",
"pbi.error": {
"code": "UnknownError",
"parameters": {},
"details": [],
"exceptionCulprit": 1
}
}
}
Same workflow is working in new Git repository but failing in older one.
Please provide your view on the above error.
And is it possible to have a look into this issue together?
Thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants