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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

Cannot create Push Dataset in Group

Hello,

 

I am trying to create a Dataset using Power BI API.

As Datasource I want to chose the OData Query from Business Central.

However, OData requires credentials, and I am not sure where I can provide them.

I am using the code from "Embed for Customers" example and Service Principal as authentication method.

Will provide some of the code below (some lines are commented out since I am experimenting):

 

 

 

public async Task AddDatasetAsync(Guid workspaceId, AddDatasetDto datasetDto)
        {
            using (var pbiClient = await GetPowerBiClient())
            {
                var request = new CreateDatasetRequest
                {
                    Datasources = new List<Datasource>
                    {
                        new Datasource
                        {
                            //ConnectionDetails = new DatasourceConnectionDetails(),
                            //ConnectionString = datasetDto.ConnectionString,
                            DatasourceType = "OData",
                            Name = "Dynamics365BusinessCentral",
                            ConnectionDetails = new DatasourceConnectionDetails
                            {
                                //Database = datasetDto.Database,
                                //Server = datasetDto.Server,
                                Url = datasetDto.Url
                            }
                        }
                    },
                    //DefaultMode = DatasetMode.Streaming,
                    Name = datasetDto.DatasetName,
                    Tables = new List<Table>()
                    //Tables = new List<Table>
                    //{
                    //    new Table
                    //    {
                    //        Source = new List<ASMashupExpression>
                    //        {
                    //            new ASMashupExpression
                    //            {
                    //                Expression = ""
                    //            }
                    //        }
                    //    }
                    //}
                };

                await pbiClient.Datasets.PostDatasetInGroupAsync(workspaceId, request);
            }
        }

 

 

 

The client itself is:

 

 

public async Task<PowerBIClient> GetPowerBiClient()
        {
            var tokenCredentials = new TokenCredentials(await aadService.GetAccessToken(), "Bearer");
            return new PowerBIClient(new Uri(urlPowerBiServiceApiRoot), tokenCredentials);
        }

 

 

 

I am trying to post a Dataset by providing "Url" property, in which I put OData query link.

However, every time I try to post a Dataset I get "BadRequest" error.

Clearly I do not specify credentials (it's using Basic Auth - Web Access Key).

 

Could you help with this issue?

2 REPLIES 2
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

Do you enable Business Central access to the APIs?

Please check out Business Central on-premises for Power BI integration.

 

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

Anonymous
Not applicable

Hi @V-lianl-msft ,

Thank you for a reply.

 

I am using Business Central in cloud and OData Services are already enabled.

I can get data from OData Queries, however I need to provide credentials - currently its Username and API Key.

I can do it in browser in a popup window or specify in Power BI Desktop when chosing data source.

However, I cannot find how can I do this via Power BI REST API.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors