-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated and added more queries for part 8
- Loading branch information
1 parent
38ab6b2
commit b348c7a
Showing
15 changed files
with
235 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Count_Active_In_Last_30Days = | ||
VAR DATA = CALCULATE( | ||
DISTINCTCOUNT('deviceManagement/managedDevices/'[id]), | ||
DATESINPERIOD( | ||
'deviceManagement/managedDevices/'[lastSyncDateTime].[Date], | ||
TODAY(), | ||
-30 | ||
,DAY | ||
)) | ||
RETURN | ||
IF(ISBLANK(DATA),0,DATA) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Count_Total_Encrypted = | ||
VAR Number = | ||
CALCULATE( | ||
DISTINCTCOUNT( | ||
'deviceManagement/managedDevices/'[id]), | ||
'deviceManagement/managedDevices/'[isEncrypted] = "Encrypted" | ||
) | ||
Return | ||
If(ISBLANK(Number),0,Number) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Count_NotCompliant_Windows = | ||
VAR Number = | ||
CALCULATE( | ||
DISTINCTCOUNT( | ||
'deviceManagement/managedDevices/'[id]), | ||
AND( | ||
'deviceManagement/managedDevices/'[complianceState] <> "Compliant", | ||
'deviceManagement/managedDevices/'[operatingSystem] = "Windows") | ||
) | ||
Return | ||
If(ISBLANK(Number),0,Number) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Count_NotEncrypted_Windows = | ||
VAR Number = | ||
CALCULATE( | ||
DISTINCTCOUNT( | ||
'deviceManagement/managedDevices/'[id]), | ||
AND( | ||
'deviceManagement/managedDevices/'[isEncrypted] <> "Encrypted", | ||
'deviceManagement/managedDevices/'[operatingSystem] = "Windows") | ||
) | ||
Return | ||
If(ISBLANK(Number),0,Number) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Count_SKU_Pro = | ||
VAR Number = | ||
CALCULATE( | ||
DISTINCTCOUNT( | ||
'deviceManagement/managedDevices/'[id]), | ||
'deviceManagement/managedDevices/'[skuFamily] = "Pro" | ||
) | ||
Return | ||
If(ISBLANK(Number),0,Number) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Enrolled_This_Month_Android = | ||
VAR PreviousMonthEndDate = EOMONTH(TODAY(), -1) | ||
VAR EnrolledCount = | ||
CALCULATE( | ||
COUNTROWS('deviceManagement/managedDevices/'), | ||
FILTER( | ||
'deviceManagement/managedDevices/', | ||
AND( | ||
'deviceManagement/managedDevices/'[enrolledDateTime] >= PreviousMonthEndDate, | ||
'deviceManagement/managedDevices/'[operatingSystem] = "Android" | ||
) | ||
) | ||
) | ||
RETURN | ||
IF(ISBLANK(EnrolledCount), 0, EnrolledCount) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Enrolled_This_Month_Windows = | ||
VAR PreviousMonthEndDate = EOMONTH(TODAY(), -1) | ||
VAR EnrolledCount = | ||
CALCULATE( | ||
COUNTROWS('deviceManagement/managedDevices/'), | ||
FILTER( | ||
'deviceManagement/managedDevices/', | ||
AND( | ||
'deviceManagement/managedDevices/'[enrolledDateTime] >= PreviousMonthEndDate, | ||
'deviceManagement/managedDevices/'[operatingSystem] = "Windows" | ||
) | ||
) | ||
) | ||
RETURN | ||
IF(ISBLANK(EnrolledCount), 0, EnrolledCount) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Enrolled_This_Month_iOS = | ||
VAR PreviousMonthEndDate = EOMONTH(TODAY(), -1) | ||
VAR EnrolledCount = | ||
CALCULATE( | ||
COUNTROWS('deviceManagement/managedDevices/'), | ||
FILTER( | ||
'deviceManagement/managedDevices/', | ||
AND( | ||
'deviceManagement/managedDevices/'[enrolledDateTime] >= PreviousMonthEndDate, | ||
'deviceManagement/managedDevices/'[operatingSystem] = "iOS" | ||
) | ||
) | ||
) | ||
RETURN | ||
IF(ISBLANK(EnrolledCount), 0, EnrolledCount) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Enrolled_This_Month_macOS = | ||
VAR PreviousMonthEndDate = EOMONTH(TODAY(), -1) | ||
VAR EnrolledCount = | ||
CALCULATE( | ||
COUNTROWS('deviceManagement/managedDevices/'), | ||
FILTER( | ||
'deviceManagement/managedDevices/', | ||
AND( | ||
'deviceManagement/managedDevices/'[enrolledDateTime] >= PreviousMonthEndDate, | ||
'deviceManagement/managedDevices/'[operatingSystem] = "macOS" | ||
) | ||
) | ||
) | ||
RETURN | ||
IF(ISBLANK(EnrolledCount), 0, EnrolledCount) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Patch Rank = RANKX( | ||
FILTER( | ||
'XT - Windows Client Patching Data', | ||
'XT - Windows Client Patching Data'[Build Number] = | ||
EARLIER( | ||
'XT - Windows Client Patching Data'[Build Number] | ||
) | ||
), | ||
'XT - Windows Client Patching Data'[Patch Number]) |
28 changes: 28 additions & 0 deletions
28
PowerQuery/Queries-LogicApp-BearerToken/Get-AutopilotDevices(Bearer).pq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
let | ||
|
||
// Application Registration Permissions needed to make this call : DeviceManagementServiceConfig.Read.All | ||
// : DeviceManagementConfiguration.Read.All | ||
|
||
// Microsoft Graph URL | ||
Endpoint = "https://graph.microsoft.com/", | ||
Version = "beta/", | ||
Resource = "deviceManagement/windowsAutopilotDeviceIdentities/", | ||
QueryParams = "", | ||
GraphURL = Endpoint & Version & Resource & QueryParams, | ||
|
||
// Get Bearer Token Using Function | ||
Bearer = #"Get-BearerToken" (TenantID, AppID, SecretID, Endpoint), | ||
|
||
// Logic App to handle pagination | ||
LABody = "{ | ||
""GraphUrl"":""" & GraphURL & """, | ||
""Bearer"":""" & Bearer & """ | ||
}", | ||
LogicApp = Json.Document(Web.Contents(#"MSGraphCall", [Headers=[#"Content-Type"="application/json"],Content = Text.ToBinary(LABody)])), | ||
Value = LogicApp[value], | ||
|
||
// Output Processing | ||
#"Converted to Table" = Table.FromList(Value, Splitter.SplitByNothing(), null, null, ExtraValues.Error), | ||
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"id", "deploymentProfileAssignmentStatus", "deploymentProfileAssignmentDetailedStatus", "deploymentProfileAssignedDateTime", "groupTag", "purchaseOrderIdentifier", "serialNumber", "productKey", "manufacturer", "model", "enrollmentState", "lastContactedDateTime", "addressableUserName", "userPrincipalName", "resourceName", "skuNumber", "systemFamily", "azureActiveDirectoryDeviceId", "azureAdDeviceId", "managedDeviceId", "displayName", "deviceAccountUpn", "deviceAccountPassword", "deviceFriendlyName", "remediationState", "remediationStateLastModifiedDateTime", "userlessEnrollmentStatus"}, {"id", "deploymentProfileAssignmentStatus", "deploymentProfileAssignmentDetailedStatus", "deploymentProfileAssignedDateTime", "groupTag", "purchaseOrderIdentifier", "serialNumber", "productKey", "manufacturer", "model", "enrollmentState", "lastContactedDateTime", "addressableUserName", "userPrincipalName", "resourceName", "skuNumber", "systemFamily", "azureActiveDirectoryDeviceId", "azureAdDeviceId", "managedDeviceId", "displayName", "deviceAccountUpn", "deviceAccountPassword", "deviceFriendlyName", "remediationState", "remediationStateLastModifiedDateTime", "userlessEnrollmentStatus"}) | ||
in | ||
#"Expanded Column1" |
29 changes: 29 additions & 0 deletions
29
PowerQuery/Queries-LogicApp-NoBearerToken/Get-AutopilotDevices(NoBearer).pq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
let | ||
|
||
// Application Registration Permissions needed to make this call : DeviceManagementServiceConfig.Read.All | ||
// : DeviceManagementConfiguration.Read.All | ||
|
||
// Microsoft Graph URL | ||
Endpoint = "https://graph.microsoft.com/", | ||
Version = "beta/", | ||
Resource = "deviceManagement/windowsAutopilotDeviceIdentities/", | ||
QueryParams = "", | ||
GraphURL = Endpoint & Version & Resource & QueryParams, | ||
|
||
// Logic App to handle pagination | ||
LABody = "{ | ||
""GraphUrl"":""" & GraphURL & """, | ||
""TenantID"":""" & TenantID & """, | ||
""AppID"":""" & AppID & """, | ||
""SecretID"":""" & SecretID & """, | ||
""Audience"":""" & Endpoint & """ | ||
}", | ||
LogicApp = Json.Document(Web.Contents(#"MSGraphCall-NoBearer", [Headers=[#"Content-Type"="application/json"],Content = Text.ToBinary(LABody)])), | ||
Value = LogicApp[value], | ||
|
||
// Output Processing | ||
#"Converted to Table" = Table.FromList(Value, Splitter.SplitByNothing(), null, null, ExtraValues.Error), | ||
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"id", "deploymentProfileAssignmentStatus", "deploymentProfileAssignmentDetailedStatus", "deploymentProfileAssignedDateTime", "groupTag", "purchaseOrderIdentifier", "serialNumber", "productKey", "manufacturer", "model", "enrollmentState", "lastContactedDateTime", "addressableUserName", "userPrincipalName", "resourceName", "skuNumber", "systemFamily", "azureActiveDirectoryDeviceId", "azureAdDeviceId", "managedDeviceId", "displayName", "deviceAccountUpn", "deviceAccountPassword", "deviceFriendlyName", "remediationState", "remediationStateLastModifiedDateTime", "userlessEnrollmentStatus"}, {"id", "deploymentProfileAssignmentStatus", "deploymentProfileAssignmentDetailedStatus", "deploymentProfileAssignedDateTime", "groupTag", "purchaseOrderIdentifier", "serialNumber", "productKey", "manufacturer", "model", "enrollmentState", "lastContactedDateTime", "addressableUserName", "userPrincipalName", "resourceName", "skuNumber", "systemFamily", "azureActiveDirectoryDeviceId", "azureAdDeviceId", "managedDeviceId", "displayName", "deviceAccountUpn", "deviceAccountPassword", "deviceFriendlyName", "remediationState", "remediationStateLastModifiedDateTime", "userlessEnrollmentStatus"}) | ||
|
||
in | ||
#"Expanded Column1" |
32 changes: 32 additions & 0 deletions
32
PowerQuery/Queries-ODataFeed-BearerToken/Get-AutopilotDevices(OData).pq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
let | ||
|
||
// Application Registration Permissions needed to make this call : DeviceManagementServiceConfig.Read.All | ||
// : DeviceManagementConfiguration.Read.All | ||
|
||
// Microsoft Graph URL | ||
Endpoint = "https://graph.microsoft.com/", | ||
Version = "beta/", | ||
Resource = "deviceManagement/windowsAutopilotDeviceIdentities/", | ||
QueryParams = "", | ||
GraphURL = Endpoint & Version & Resource & QueryParams, | ||
|
||
// Get an Access Token to make Graph Calls (uses Application Registration) | ||
Bearer = #"Get-BearerToken" (TenantID, AppID, SecretID, Endpoint), | ||
|
||
// ODataFeed to process Graph Call | ||
// https://learn.microsoft.com/en-us/powerquery-m/odata-feed | ||
OData = OData.Feed ( | ||
GraphURL, | ||
[ Authorization = Bearer ], | ||
[ | ||
ExcludedFromCacheKey = {"Authorization"}, | ||
ODataVersion = 4, | ||
Implementation = "2.0", | ||
OmitValues = ODataOmitValues.Nulls | ||
] | ||
) | ||
|
||
// Formatting | ||
|
||
in | ||
OData |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
let | ||
|
||
// Application Registration Permissions needed to make this call : DeviceManagementApps.Read.All | ||
|
||
// Microsoft Graph URL | ||
Endpoint = "https://graph.microsoft.com/", | ||
Version = "beta/", | ||
Resource = "deviceAppManagement/mobileApps/", | ||
QueryParams = "", | ||
GraphURL = Endpoint & Version & Resource & QueryParams, | ||
|
||
// Get an Access Token to make Graph Calls (uses Application Registration) | ||
Bearer = #"Get-BearerToken" (TenantID, AppID, SecretID, Endpoint), | ||
|
||
//ODataFeed to process Graph Call | ||
OData = OData.Feed ( | ||
GraphURL, | ||
[ Authorization = Bearer ], | ||
[ | ||
ExcludedFromCacheKey = {"Authorization"}, | ||
ODataVersion = 4, | ||
Implementation = "2.0" | ||
] | ||
) | ||
in | ||
OData |