How to create a time series with Application Insight

I have Azure Monitor as datasource and use Application Insights.

My query is as follows:
| where $__timeFilter(TimeGenerated)
| summarize count() by type, bin(TimeGenerated, 1h)
| order by TimeGenerated asc

I receive a syntax error without any details.

What is wrong with my query?

TimeGenerated is not a part of Application Insights. Use timestamp instead.