Forum Discussion
JJGuirola
Microsoft
Mar 02, 2023How to Automate Windows 365 Cloud PC Last Login monitoring!
Automate Windows 365 Cloud PC Last Login monitoring!
(Windows 365, Azure Active Directory, Power Automate, MS Graph)
Contributors:
Juan José Guirola Sr. (Next Generation Endpoint GBB for Am...
JJGuirola
Microsoft
Mar 20, 2023Hi Dawn. Pay attention to the steps 4 - 5 right under Figure 10 of the article. To get those values for each Cloud PC, you will have to Parse through each Cloud PC and extract that value to a variable. That value is returned as NULL when doing a bulk request, but if you isolate the query to specific Cloud PC id, you will get the necessary value. Hope that helps.
Robin_Herbert
Apr 04, 2025Copper Contributor
Hi Juan José!
Useful example, although I can't help wondering why you included returning the lastRemoteActionResult and lastLoginResult properties in the first GET (when all Cloud PCs are returned) when you then state (correctly) that those values will always be NULL?
Also, looks like the lastLoginResult is now (or was it then?) either Null, or has a sub-value of Time. So need to parse down one more layer to get that value for comparison. e.g.:
"body": {
"@odata.context": "https://graph.microsoft.com/beta/$metadata#deviceManagement/virtualEndpoint/cloudPCs(userPrincipalName,id,displayName,managedDeviceName,status,imageDisplayName,lastModifiedDateTime,lastLoginResult,provisioningPolicyName,servicePlanName)/$entity",
"id": "0cac010b-e5ff-49c4-a097-dc60eb2da45a",
"displayName": "cloudpc-prd-weu - username",
"imageDisplayName": "Windows 11 Enterprise + Microsoft 365 Apps 22H2",
"provisioningPolicyName": "cloudpc-prd-weu",
"servicePlanName": "Cloud PC Enterprise 4vCPU/16GB/128GB",
"status": "provisioned",
"userPrincipalName": "userUPN",
"lastModifiedDateTime": "2025-04-04T11:30:50Z",
"managedDeviceName": "CPC-abcde-F62IJ",
"lastLoginResult": {
"time": "2025-04-04T09:16:58.8915555Z"
}
}
(returned values changed a little to protect my org.)
I also found you could just do the 'div' action upon the lastLoginResult.Time value directly, without the additional compose action. Saves a few actions!