Forum Discussion
SQL Dataset Migration using code
Hi sidhharth_1996 - Automating the creation of Power BI reports and connecting to SQL data sources programmatically is challenging because the Power BI .pbix file structure is proprietary and not publicly documented.Unfortunately, the Power BI API does not directly support embedding M queries.
you can try with use Power BI REST API for Automation
suggest some alternative like,
Azure Data Factory (ADF) can integrate with Power BI datasets and handle dynamic SQL data source connections. You can:
Use ADF pipelines to fetch data from SQL Server.
Push the data to Power BI datasets via the REST API.Automating the M query injection is not fully supported in Power BI APIs.
Power BI REST APIs for embedded analytics and automation - Power BI REST API | Microsoft Learn
Power BI Tabular Editor 3: Automate With A Script – Master Data Skills + AI
Thank you for the help.
But i am looking for a solution that can be fetch the data from sql server and upload the dataset to the powerbi and create simatic model automaically what i specified in a json/some other format. So i can create report on top of it.