microsoft / secmgmt-insights-connector

Power BI connector that provides insight into the current state of how Microsoft 365 is configured and whether best practices have been implemented
MIT License
13 stars 3 forks source link

Nested queries #76

Closed ghost closed 4 years ago

ghost commented 4 years ago

Feature Request

Is your feature request related to a problem? The performance of the connector could be improved by not getting the schema for the nested queries until the final request

Describe the solution you would like There should be an intermediate step that would allow the nest requests to obtain the raw data

Describe alternatives you have considered N/A

Additional context

Currently the connector handles nested queries using logic similar to the following

[DataSource.Kind="SecMgmtInsights"]
shared SecMgmtInsights.WindowsProtectionState = (optional tenants as list) as table =>
    let 
        source = Request.GraphFeed("/v1.0/deviceManagement/managedDevices?$select=id", tenants),
        renamedColumn = Table.RenameColumns(source, {"id", "deviceId"}),
        data = Table.AddColumn(renamedColumn, "Custom", each try Request.GraphContents("/beta/deviceManagement/managedDevices/" & [deviceId] & "/windowsProtectionState", {[tenantId]}) otherwise null)
    in
        Table.ExpandData(data, {"id", "tenantId"});

Ideally the GraphContents and GraphFeed functions would either be modified to not request the schema or another function used for this need.