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

Unable to Enable schedule refresh for dynamic data source (Source is Application Insights)

I have implemented dynamic datasource for my power bi to enable environment wise data in Application Insights URL. But I am unable to schedule refresh for the report.

 

ErrorThis dataset includes a dynamic data source. Since dynamic data sources aren't refreshed in the Power BI service, this dataset won't be refreshed. Learn more: https://aka.ms/dynamic-data-sources.

  • Data source for Query1

Query

let AnalyticsQuery =
let Source = Json.Document(Web.Contents("https://api.applicationinsights.io/v1/apps/"& ParameterForEnvironment & "/query",
[Query=[#"query"="requests
| where timestamp >= ago(2d)
| where  url contains ""Test""
",#"x-ms-app"="AAPBI",#"prefer"="ai.response-thinning=true"],Timeout=#duration(0,0,4,0)])),
TypeMap = #table(
{ "AnalyticsTypes", "Type" },
{
{ "string", Text.Type },
{ "int", Int32.Type },
{ "long", Int64.Type },
{ "real", Double.Type },
{ "timespan", Duration.Type },
{ "datetime", DateTimeZone.Type },
{ "bool", Logical.Type },
{ "guid", Text.Type },
{ "dynamic", Text.Type }
}),
DataTable = Source[tables]{0},
Columns = Table.FromRecords(DataTable[columns]),
ColumnsWithType = Table.Join(Columns, {"type"}, TypeMap , {"AnalyticsTypes"}),
Rows = Table.FromRows(DataTable[rows], Columns[name]),
Table = Table.TransformColumnTypes(Rows, Table.ToList(ColumnsWithType, (c) => { c{0}, c{3}}))
in
Table
in AnalyticsQuery

1 ACCEPTED SOLUTION
ImkeF
Community Champion
Community Champion

Hi @Anonymous ,
you have to use the relative path parameter for the dynamic part like described here:
Chris Webb's BI Blog: Using The RelativePath And Query Options With Web.Contents() In Power Query And Power BI M Code Chris Webb's BI Blog (crossjoin.co.uk)

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

5 REPLIES 5
ImkeF
Community Champion
Community Champion

Hi @Anonymous ,
yes, unfortunately OAuth is not possible without insecure hacks. You need to go via a custom connector (and subsequently an on prem-gateway then) like described here:
Chris Webb's BI Blog: Connecting To REST APIs With OAuth2 Authentication In Power Query/Power BI Chris Webb's BI Blog (crossjoin.co.uk)

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

ImkeF
Community Champion
Community Champion

Hi @Anonymous ,
yes, that's to be expected. Every bit that is variable mustn't sit in the main URL. You need to use it in the relative path or in the query parameters in the record of the call.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

ImkeF
Community Champion
Community Champion

Hi @Anonymous ,
you have to use the relative path parameter for the dynamic part like described here:
Chris Webb's BI Blog: Using The RelativePath And Query Options With Web.Contents() In Power Query And Power BI M Code Chris Webb's BI Blog (crossjoin.co.uk)

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Anonymous
Not applicable

Thanks @ImkeF for the solution.

I am able to see the schedule refresh in Power BI service. But when i try to refresh, i got the below error.

Error : 

  • Data source errorThe credentials provided for the Web source are invalid. Source at https://api.loganalytics.io/v1/workspaces/1232/query. The exception was raised by the IDataReader interface. Please review the error message and provider documentation for further information and corrective action. Table: TableName.

I have checked the "Data source credentials" and not able to see the "OAuth" option in "Authentication Method" and also tried with "Skip Test Connection", but got the same error.

Anonymous
Not applicable

After using the RelativePath, I got the below error 

Error : Scheduled refresh is disabled because at least one data source is missing credentials. To start the refresh again, go to this dataset's settings page and enter credentials for all data sources. Then reactivate scheduled refresh.

 

When I tried to validate the credentials, I got the below error:

Error: Failed to update data source credentials: Web.Contents failed to get contents from 'https://api.applicationinsights.io/v1/apps/' (404): Not Found.

 

"https://api.applicationinsights.io/v1/apps/"& ParameterForEnvironment & "/query"

ParameterForEnvironment ID will come from the Report which is selected by the user, without this value the static URL won't work.

 

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 Kudoed Authors