cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
suvaries Frequent Visitor
Frequent Visitor

Problem while publishing a file with parameterized connection properties

Hi,

I created a .pbix file for our customers. Each customer has its own database, so to be able to use the same file they have their own config.xml file. The powerbi desktop file gets the connection properties from the config file and refreshes the data from the database(using these connection properties). Everything is well with desktop file. They could also publish this file to create dashboards on the web. But for last few days they are not able to publish. You can see the error below.

I think I localized the error. When I use connection properties hard-coded, then publishing is being successful. But if I take connection properties from an xml file then it fails. A few days ago this wasn't an issue.

By the way my file is not in direct-mode.

 

Thanks in advance,

 

 

publishError.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Problem while publishing a file with parameterized connection properties

Hi @suvaries,

 

Since I still can't reproduce your issue, you can post this to issue.(below is a link with the same error message):

Publishing failed for an unknown reason. (Failed to refresh package after import error)

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



For learning resources/Release notes, please visit: | |
6 REPLIES 6
Community Support Team
Community Support Team

Re: Problem while publishing a file with parameterized connection properties

Hi @suvaries,

 

Based on test, I can't reproduce your issue, can you share us some detailed information about this issue?

 

Query:

let
    Source = Xml.Tables(File.Contents("C:\Users\xxxxx\Desktop\Config.xml")),
    Table0 = Source{0}[Table],
    #"Changed Type" = Table.TransformColumnTypes(Table0,{{"Attribute:name", type text}, {"Attribute:connectionString", type text}}),
    #"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Attribute:connectionString", "ConnectionString"}}),
    Custom= List.First(Table.SelectRows(Table.SelectColumns(#"Renamed Columns","ConnectionString"), each [ConnectionString] <> null)[ConnectionString]),
    connectString=Text.Split(Text.Replace(Text.Replace(Custom,"server = ",""),"data source=",""),";"),
    Datasource= SalesRecords(List.First(connectString),List.Last(connectString))
in
    Datasource

 

 

Screenshots:

 

Capture.PNG

 

Capture2.PNG

 

I tested on Version: 2.39.4526.362 64-bit (September 2016).

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



For learning resources/Release notes, please visit: | |
suvaries Frequent Visitor
Frequent Visitor

Re: Problem while publishing a file with parameterized connection properties

Hi @v-shex-msft

Thank you for your attention.

My query is as follows. "sir" is a database table in my mssql database.

 

let
    configPath = "F:\...\Desktop\config.xml",
    Source = Xml.Tables(File.Contents(configPath)),
    Table0 = Source{0}[Table],
    #"Changed Type" = Table.TransformColumnTypes(Table0,{{"server", type text}, {"database", type text}}),
    Table1 = #"Changed Type"{0},
    srvr = Table1[server],
    db = Table1[database],
    databaseCon = Sql.Database(srvr, db),
    dbo_sir = databaseCon{[Schema="dbo",Item="sir"]}[Data]
in
    dbo_sir

 

My config.xml file is,

 

<root>
  <connection>
    <server>localhost</server>
    <database>dbTrial</database>
  </connection>
</root>

 

 

 

Query result is as I expect.:

 

query.png

 

Desktop file works fine.

desktopFile.png

 

And I publish,

publish.png

 

In desktop file I get this error:

error.png

 

Meanwhile in service I get this error:

serviceError.png

 

We are exactly in the same version,

version.png

 

An interesting thing is that I have also a direct-mode file with similar structure. I am not having any trouble while publishing it(even though it seems to connect more than one datasource, an sql server and an xml file)

 

Community Support Team
Community Support Team

Re: Problem while publishing a file with parameterized connection properties

Hi @suvaries,

 

>>Meanwhile in service I get this error:

Did you use the directquery mode to connect the database? If as I said, you need to add a data gateway to connect the database.

 

For more information, you can take a look at below links:

 Use DirectQuery in Power BI Desktop

On-premises data gateway

 

>>An interesting thing is that I have also a direct-mode file with similar structure. I am not having any trouble while publishing it.

I think these success published reports may use the import mode to connect, it not need a gateway to connect and refresh the data.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



For learning resources/Release notes, please visit: | |
suvaries Frequent Visitor
Frequent Visitor

Re: Problem while publishing a file with parameterized connection properties

Hi @v-shex-msft

 

>>Did you use the directquery mode to connect the database?

No, my workbook imports the data.

 

Thank you for your efforts.

Community Support Team
Community Support Team

Re: Problem while publishing a file with parameterized connection properties

Hi @suvaries,

 

Since I still can't reproduce your issue, you can post this to issue.(below is a link with the same error message):

Publishing failed for an unknown reason. (Failed to refresh package after import error)

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



For learning resources/Release notes, please visit: | |
suvaries Frequent Visitor
Frequent Visitor

Re: Problem while publishing a file with parameterized connection properties

Hi @v-shex-msft

I think I was experiencing exactly the same issue with the link you shared. Now I tried publishing again and as of today it seems fixed. 

 

Thank you very much,

Regards

Helpful resources

Announcements
Community Highlights

Community Highlights

Find out what's new in the Power BI Community!

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

Virtual Launch Event

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Kudoed Authors
Users Online
Currently online: 6 members 1,638 guests
Please welcome our newest community members: