Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply

Develop a custom connector MEZ file with AUTH or No Auth setup

We are developing a custom connector to read a JSON file from a local location and send it to Power BI. But we are facing an issue with creating a MEZ file. Below I have added the code for the pq file, the same code runs as a blank query in Power BI.  How to set up a mez file for the below code with or without authentication? The Mez file fails if "None" is set at authentication. Create a auth setup or no auth to directly load the data we see via blank query. 

Mohanasudharsan_0-1684499891768.png

 

Attached is the result of the blank query for the same m query.

Mohanasudharsan_1-1684500295315.png

 

 

section PQExtension1;
filePath = "C:\\Users\\ADMIN\\Documents\\navigation2.json";
[DataSource.Kind="PQExtension1", Publish="PQExtension1.Publish"]
shared PQExtension1.Contents = (optional message as text) =>
let
// Read the JSON file
jsonData = Json.Document(File.Contents(filePath)),

// Extract the cube values
cube = jsonData[cube],

// Extract the dimension values
dimension = jsonData[dimension],

// Convert dimension values to a table
dimensionTable = Table.FromColumns(Record.FieldValues(dimension), Record.FieldNames(dimension)),

// Expand the cube values
cubeTable = Table.FromList(cube, Splitter.SplitByNothing(), null, null, ExtraValues.Error),

// Create a new column for each dimension
finalTable = Table.AddColumn(cubeTable, "Dimensions", each dimensionTable)
in
finalTable;

// Data Source Kind description
PQExtension1 = [
Authentication = [
Key = [],
UsernamePassword = [],
Windows = [],
Implicit = [],
None = []
],
Label = Extension.LoadString("DataSourceLabel")
];

// Data Source UI publishing description
PQExtension1.Publish = [
Beta = true,
Category = "Other",
ButtonText = { Extension.LoadString("ButtonTitle"), Extension.LoadString("ButtonHelp") },
LearnMoreUrl = "https://powerbi.microsoft.com/",
SourceImage = PQExtension1.Icons,
SourceTypeImage = PQExtension1.Icons
];

PQExtension1.Icons = [
Icon16 = { Extension.Contents("PQExtension116.png"), Extension.Contents("PQExtension120.png"), Extension.Contents("PQExtension124.png"), Extension.Contents("PQExtension132.png") },
Icon32 = { Extension.Contents("PQExtension132.png"), Extension.Contents("PQExtension140.png"), Extension.Contents("PQExtension148.png"), Extension.Contents("PQExtension164.png") }
];

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @Mohanasudharsan ,

To use a non-certified custom connector:

  1. Put the connector .pq, .pqx, .m, or .mez file in your local [Documents]\Power BI Desktop\Custom Connectors folder. If the folder doesn't exist, create it.

  2. To adjust the data extension security settings, in Power BI Desktop, select File > Options and settings > Options > Security.

  3. Under Data Extensions, select (Not Recommended) Allow any extension to load without validation or warning.

  4. Select OK, and then restart Power BI Desktop.

vyanjiangmsft_2-1684919672432.png

Reference: Connector extensibility in Power BI - Power BI | Microsoft Learn

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Best regards,

Community Support Team_yanjiang

View solution in original post

1 REPLY 1
v-yanjiang-msft
Community Support
Community Support

Hi @Mohanasudharsan ,

To use a non-certified custom connector:

  1. Put the connector .pq, .pqx, .m, or .mez file in your local [Documents]\Power BI Desktop\Custom Connectors folder. If the folder doesn't exist, create it.

  2. To adjust the data extension security settings, in Power BI Desktop, select File > Options and settings > Options > Security.

  3. Under Data Extensions, select (Not Recommended) Allow any extension to load without validation or warning.

  4. Select OK, and then restart Power BI Desktop.

vyanjiangmsft_2-1684919672432.png

Reference: Connector extensibility in Power BI - Power BI | Microsoft Learn

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Best regards,

Community Support Team_yanjiang

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors