Objective#
The APIs discussed below are in beta and are subject to change.
This post walks through how to use Microsoft Graph and PowerShell to understand whether Cloud PCs are currently in use or have recent user connection activity. For shared Cloud PCs, the connectivityResult property can provide a near real-time availability signal. For dedicated Cloud PCs, connection history is the more reliable source for recent sign-in activity.
Microsoft Graph#
Microsoft Graph has two endpoints that can help us understand the sign-in or connection status of a Cloud PC:
/deviceManagement/virtualEndpoint/cloudPCs/deviceManagement/virtualEndpoint/cloudPCs/{ID}/getCloudPcConnectivityHistory
The cloudPCs endpoint#
Microsoft Graph includes the /deviceManagement/virtualEndpoint/cloudPCs endpoint in the beta API, which we can use to list Cloud PCs in our tenant and gather rich endpoint details. The API gives us the following response:
{
"id": "941faead-a5db-44ba-aed6-f5c06cea0d18",
"displayName": "",
"imageDisplayName": "customw365",
"provisioningPolicyId": "8e8a545f-6168-4472-9466-9f05520a5eb3",
"provisioningPolicyName": "W365-Flex-Shared",
"onPremisesConnectionName": "",
"servicePlanId": "dd3801e2-4aa1-4b16-a44b-243e55497584",
"servicePlanName": "Cloud PC Frontline 4vCPU/16GB/128GB",
"status": "provisioned",
"userPrincipalName": null,
"lastModifiedDateTime": "2026-05-17T16:00:08.5878348Z",
"managedDeviceId": "61f18b2b-8d04-44b4-bed0-1cb813d09a03",
"managedDeviceName": "CFS-AVVP50J64LL",
"aadDeviceId": "ba37f1d1-e7af-4bd5-8d82-67e1ea6b6c07",
"gracePeriodEndDateTime": null,
"servicePlanType": "enterprise",
"diskEncryptionState": "encryptedUsingPlatformManagedKey",
"provisioningType": "sharedByEntraGroup",
"statusDetails": null,
"statusDetail": null,
"partnerAgentInstallResults": []
}Using this endpoint we can have it return the connectivityResult properties using the $select parameter. Because inUse and underServiceMaintenance are evolvable enum values, include the Prefer: include-unknown-enum-members request header.
Prefer: include-unknown-enum-members
https://graph.microsoft.com/beta/deviceManagement/virtualEndpoint/cloudPCs?$select=id,displayName,managedDeviceName,provisioningType,userPrincipalName,status,aadDeviceId,connectivityResultWhich will give us the following response that includes the connectivityResult properties:
[
{
"id": "198294a2-4d1d-4c28-bb81-74c3f495a9b2",
"displayName": "",
"status": "provisioned",
"userPrincipalName": null,
"managedDeviceName": "CFS-23GSZS0XKJP",
"aadDeviceId": "be7ff878-0c9e-4b76-8213-63108f4b5de8",
"provisioningType": "sharedByEntraGroup",
"connectivityResult": {
"status": "inUse",
"updatedDateTime": "0001-01-01T00:00:00Z",
"lastModifiedDateTime": "2026-06-17T19:21:24.4858865Z",
"failedHealthCheckItems": []
}
},
{
"id": "4a868f5f-dc0d-4d0f-91ac-54aa62a548b2",
"displayName": "W365-Flex-Dedicated - Vance DeLeon",
"status": "provisioned",
"userPrincipalName": "VanceD@M365CPI91293196.OnMicrosoft.com",
"managedDeviceName": "CFD-Vance-XS4KT",
"aadDeviceId": "308415a9-8a30-43a3-a98a-a20684a8bbd8",
"provisioningType": "sharedByUser",
"connectivityResult": null
}
]If you have a mix of dedicated Cloud PCs and shared Cloud PCs, you may notice that only shared Cloud PCs have values that are not null in the connectivityResult property. For shared Cloud PCs, connectivityResult is useful as a near real-time availability signal because Windows 365 Flex Shared mode has a pool lifecycle to track: available, in use, and under service maintenance after sign-out. Dedicated Cloud PCs do not participate in that shared-pool lifecycle, so connectivityResult may be null and should not be treated as a live sign-in signal for those devices.
If I log out of a shared Cloud PC and quickly query the machine in Microsoft Graph, I can see that it moves to a status of underServiceMaintenance before being put back in an available status. The servicing status represents the automatic Windows reset window which is described here.
{
"id": "198294a2-4d1d-4c28-bb81-74c3f495a9b2",
"displayName": "",
"status": "provisioned",
"userPrincipalName": null,
"managedDeviceName": "CFS-23GSZS0XKJP",
"aadDeviceId": "be7ff878-0c9e-4b76-8213-63108f4b5de8",
"provisioningType": "sharedByEntraGroup",
"connectivityResult": {
"status": "underServiceMaintenance",
"updatedDateTime": "0001-01-01T00:00:00Z",
"lastModifiedDateTime": "2026-06-17T19:30:11.7890139Z",
"failedHealthCheckItems": []
}
}To get the sign-in status of a non-shared Cloud PC we can instead use the getCloudPcConnectivityHistory endpoint. You can read more about the cloudPcConnectivityResult resource type on Microsoft Learn.
The getCloudPcConnectivityHistory endpoint#
The getCloudPcConnectivityHistory endpoint returns the connectivity history for a specified Cloud PC (dedicated and shared).
This endpoint appears to not be instantaneous and instead can be delayed by about five minutes in my testing.
When looking up the connectivity history of a Cloud PC I am returned the following:
[
{
"activityId": "362deb91-d2ec-4e66-9d8a-d8708c440000",
"eventDateTime": "2026-06-17T19:21:00Z",
"eventType": "userConnection",
"eventName": "Connection Started",
"eventResult": "success",
"message": ""
},
{
"activityId": "362deb91-d2ec-4e66-9d8a-d8708c440000",
"eventDateTime": "2026-06-17T19:29:54Z",
"eventType": "userConnection",
"eventName": "Connection Finished",
"eventResult": "success",
"message": ""
}
]WindowsCloudPC PowerShell Module#
The WindowsCloudPC PowerShell module includes the Get-CloudPCUsage function that will iterate through your Cloud PCs and return the sign-in status of each one, including the last active time, days since each one was last signed into, and the signed-in user (not available for shared). For Flex shared devices it will automatically prioritize the cloudPCs endpoint, allowing you to get near instant data, and then gather history results from the getCloudPcConnectivityHistory endpoint.
To get started, run the following command:
Install-Module -Name WindowsCloudPC -Scope CurrentUserOnce the module is installed you can connect to your tenant by running Connect-CloudPC. To get the Cloud PC usage details you can run Get-CloudPCUsage.

Wrapping Up#
The connectivityResult property is a useful near real-time signal for shared Cloud PCs because it reflects the shared pool lifecycle. For dedicated Cloud PCs, use getCloudPcConnectivityHistory to look at recent user connection activity instead of relying on connectivityResult being populated.
