How to List all Windows 365 Cloud PCs in your Tenant using Microsoft Graph API! Let’s list all the Microsoft 365 Cloud PCs in a Tenant using Microsoft Graph API. This article demonstrates how to automate the process of retrieving all Windows 365 Cloud PCs in a tenant using the Microsoft Graph API. Let’s learn together and simplify your work by automating as many GUI tasks as possible.
The Microsoft Graph API provides programmatic access to Cloud PC resources, enabling administrators to query information and perform management actions across their organization. These capabilities mirror the operations available through Microsoft Endpoint Manager, but with the added flexibility of automation and integration into custom workflows.
To leverage the Microsoft Graph API for Cloud PCs, your organization must hold an active Windows 365 license. The API is supported for both Windows 365 Enterprise and Windows 365 Business, ensuring broad applicability across deployment models.In this article, we will explore how to automate process of listing the Windows 365 Cloud PCs in a Tenant using Microsoft Graph API.
With Microsoft Graph, administrators can provision and manage Cloud PCs across their organization. When combined with the Intune API, Cloud PCs can be managed seamlessly alongside physical endpoints, providing a unified approach to device management.
Table of Contents
Windows 365 is your Personal Computer in the Cloud
In today’s dynamic work environment, organizations require robust solutions that strengthen resilience while maximizing return on investment. As IT environments continue to grow, many businesses are turning to cloud-based platforms such as Windows 365 to enhance security, streamline management, and ensure seamless connectivity.
The study identified several key benefits driving this impact. Enhanced productivity was a major outcome, with employees and contractors saving couple of minutes per day due to reduced outages and improved latency compared to traditional environments.
Cost savings were also significant, particularly through the implementation of a bring-your-own-PC program. By avoiding the purchase, provisioning, and maintenance of physical laptops, organizations were projected to save between $1.1 million and $1.2 million over three years.

- How to Change the Region Name and Geography of Microsoft 365 Cloud PCs using Microsoft Graph API
- How to Fix Windows 365 Inactive Azure Network Connection in Intune
- Easy way to Enable Windows Backup using Microsoft Intune Configuration
- How to Resolve Windows 365 Provisioning Policy Unsupported Image Status in Intune
Beyond productivity and lifecycle savings, organizations realized further efficiencies by reducing IT infrastructure costs. Migrating to Windows 365 and Azure Virtual Desktop lowered expenses tied to on-premises operations, with projected savings ranging from $722,000 to $1.5 million over three years.
By leveraging Microsoft-managed services, organizations reduced reliance on extensive on-premises security infrastructure and personnel, resulting in projected savings of $60,000 to $122,000 over three years.
Know More about Permissions
Access to resources in Microsoft Graph is governed by permissions. As a developer, you must explicitly request and configure the appropriate permissions to interact with Windows 365 resources. Always choose the least-privileged permission(s) for this API. Use elevated permissions only when necessary for your app’s functionality.
- Intune Policy Assignment Classification Easy Secrets of using Graph API with PowerShell
- Managing Windows Bitlocker Compliance Policy Using Intune | MS Graph | Grace Period
| Permission type | Least privileged permissions | Higher privileged permissions |
|---|---|---|
| Delegated (work or school account) | CloudPC.Read.All | CloudPC.ReadWrite.All |
| Delegated (personal Microsoft account) | Not supported. | Not supported. |
| Application | CloudPC.Read.All | CloudPC.ReadWrite.All |
For additional details on these permissions, please refer to the table above. Microsoft has provided a comprehensive overview, and in most cases, the CloudPC.Read.All permission is sufficient to run this automation. Thanks to Microsoft for the table.

Also, your Your tenant must have active Windows 365 licenses assigned to users for API operations to succeed. These permissions enable access to endpoints for listing Cloud PCs, managing lifecycle actions (reboot, resize, rename), and configuring provisioning policies.
How to List all Windows 365 Cloud PCs using Microsoft Graph API
Let’s learn how to List all Windows 365 Cloud PCs using Microsoft Graph API. Before proceeding, make sure you have required licenses to call the endpoints.
- Sign in to the Graph Explorer with your credentials.
- Click on Run query after typing the URL below. You should use the GET API request method.
https://graph.microsoft.com/v1.0/deviceManagement/virtualEndpoint/cloudPCs
When you click on Run query, you will receive a success message with the text ‘OK -200.’ The Response preview box will show the desired output.

- Time to use Microsoft Graph Device Management PS Module Instead of MS Graph Intune Module.
- Automate Intune App Deployment using Microsoft Graph API and PowerShell
- Manage Intune Tasks with PowerShell Part 1
Customize the Response with OData Query Parameters
Well, the response above may not be sufficient for real-time automation. In practice, you often need to customize the output to retrieve only the parameters that are relevant to your scenario. Let me demonstrate how you can optimize Microsoft Graph API responses by precisely controlling the data that is returned.
- Simple way to Enable Boot To Cloud PC Enhanced Mode using Intune
- Best Method to Enable and Disable Windows 365 Cloud PCs Redirections using Intune
- How to Securely Access Apps without a Dedicated Cloud PC using Windows 365 Cloud Apps
Instead of retrieving all available properties and data, I will query only properties like displayName, imageDisplayName, userPrincipalName, managedDeviceName etc. You can select any properties that you would to display in the response.
https://graph.microsoft.com/v1.0/deviceManagement/virtualEndpoint/cloudPCs?$select=displayName,imageDisplayName,managedDeviceName,userPrincipalName
PowerShell Script to List all Windows 365 Cloud PCs
The below Powershell script will help you to list all Windows 365 Cloud PCs. This automation requires Microsoft Graph PowerShell modules. The SDK includes two modules, Microsoft. Graph and Microsoft.Graph.Beta, are respectively called the Microsoft Graph REST API v1.0 and Microsoft Graph REST API beta.
Read more : Best Guide to Install Microsoft Graph PowerShell Modules- Best way to Deploy Shell Scripts using Intune
- Run Remediation Script on-demand for Windows Devices using Intune
- PowerShell Script to Create a Local Admin Account using Intune
# Get Cloud PC Data from Microsoft Graph API
# Install Graph module if needed
if (!(Get-Module -ListAvailable Microsoft.Graph.Authentication))
{
Install-Module Microsoft.Graph.Authentication -Force -Scope CurrentUser
}
# Connect to Graph
Connect-MgGraph -Scopes "CloudPC.Read.All"
Write-Host "Connected to Graph successfully"
# Get Cloud PC data
$uri = "https://graph.microsoft.com/v1.0/deviceManagement/virtualEndpoint/cloudPCs?`$select=displayName,imageDisplayName,managedDeviceName,userPrincipalName"
$cloudPCs = Invoke-MgGraphRequest -Uri $uri -Method GET
Write-Host "Found $($cloudPCs.value.Count) Cloud PCs" -ForegroundColor Green
# Display results as table
if ($cloudPCs.value.Count -gt 0)
{
$table = @()
foreach ($pc in $cloudPCs.value)
{
$table += [PSCustomObject]@{
ManagedDeviceName = $pc.managedDeviceName
DisplayName = $pc.displayName
ImageDisplayName = $pc.imageDisplayName
UserPrincipalName = $pc.userPrincipalName
}
}
$output = $table | Format-Table -AutoSize
$output
}
else
{
Write-Host "No Cloud PCs found." -ForegroundColor Yellow
}
# Disconnect
Disconnect-MgGraph
End Result
To view the final result of the automation, copy and paste the PowerShell code into either PowerShell ISE or Visual Studio Code, then execute the script. Make sure to run it with administrator privileges.

Download the Script : Get-CloudPCData.ps1Need Further Assistance or Have Technical Questions?
Join the LinkedIn Page and Telegram group to get the latest step-by-step guides and news updates. Join our Meetup Page to participate in User group meetings. Also, Join the WhatsApp Community to get the latest news on Microsoft Technologies. We are there on Reddit as well.
Author
About the Author: Sujin Nelladath, a Microsoft Graph MVP with over 11 years of experience in SCCM device management and Automation solutions, writes and shares his experiences with Microsoft device management technologies, Azure, DevOps and PowerShell automation
