Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Permission type
Least privileged permissions
Higher privileged permissions
Delegated (work or school account)
CloudPC.ReadWrite.All
Not available.
Delegated (personal Microsoft account)
Not supported.
Not supported.
Application
CloudPC.ReadWrite.All
Not available.
HTTP request
POST /deviceManagement/virtualEndpoint/provisioningPolicies
The following table lists the properties that are required when you create the cloudPcProvisioningPolicy.
Property
Type
Description
cloudPcNamingTemplate
String
The template used to name Cloud PCs provisioned using this policy. The template can contain custom text and replacement tokens, including %USERNAME:x% and %RAND:x%, which represent the user's name and a randomly generated number, respectively. For example, CPC-%USERNAME:4%-%RAND:5% means that the name of the Cloud PC starts with CPC-, followed by a four-character username, a - character, and then five random characters. The total length of the text generated by the template can't exceed 15 characters. Supports $filter, $select, and $orderby.
description
String
The provisioning policy description. Supports $filter, $select, and $orderBy.
Specifies a list ordered by priority on how Cloud PCs join Microsoft Entra ID.
enableSingleSignOn
Boolean
True if the provisioned Cloud PC can be accessed by single sign-on. False indicates that the provisioned Cloud PC doesn't support this feature. The default value is false. Windows 365 users can use single sign-on to authenticate to Microsoft Entra ID with passwordless options (for example, FIDO keys) to access their Cloud PC. Optional.
imageDisplayName
String
The display name for the OS image you’re provisioning.
imageId
String
The ID of the operating system image you want to provision on Cloud PCs. The format for a gallery type image is: {publisher_offer_sku}. Supported values for each of the parameters are as follows:
publisher: Microsoftwindowsdesktop.
offer: windows-ent-cpc.
sku: 21h1-ent-cpc-m365, 21h1-ent-cpc-os, 20h2-ent-cpc-m365, 20h2-ent-cpc-os, 20h1-ent-cpc-m365, 20h1-ent-cpc-os, 19h2-ent-cpc-m365, and 19h2-ent-cpc-os.
The specific settings to microsoftManagedDesktop that enables Microsoft Managed Desktop customers to get device managed experience for Cloud PC. To enable microsoftManagedDesktop to provide more value, an admin needs to specify certain settings in it. Supports $filter, $select, and $orderBy.
Specifies the type of license used when provisioning Cloud PCs using this policy. By default, the license type is dedicated if the provisioningType isn't specified when you create the cloudPcProvisioningPolicy. You can't change this property after the cloudPcProvisioningPolicy was created. Possible values are: dedicated, shared, unknownFutureValue.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new CloudPcProvisioningPolicy
{
OdataType = "#microsoft.graph.cloudPcProvisioningPolicy",
Description = "Description value",
DisplayName = "Display Name value",
DomainJoinConfigurations = new List<CloudPcDomainJoinConfiguration>
{
new CloudPcDomainJoinConfiguration
{
OnPremisesConnectionId = "16ee6c71-fc10-438b-88ac-daa1ccafffff",
DomainJoinType = CloudPcDomainJoinType.HybridAzureADJoin,
},
new CloudPcDomainJoinConfiguration
{
OnPremisesConnectionId = "26e16c71-f210-438b-88ac-d481ccafffff",
DomainJoinType = CloudPcDomainJoinType.HybridAzureADJoin,
},
},
Id = "1d164206-bf41-4fd2-8424-a3192d39ffff",
EnableSingleSignOn = true,
ImageDisplayName = "Windows-10 19h1-evd",
ImageId = "MicrosoftWindowsDesktop_Windows-10_19h1-evd",
ImageType = CloudPcProvisioningPolicyImageType.Gallery,
WindowsSetting = new CloudPcWindowsSetting
{
Locale = "en-US",
},
ProvisioningType = CloudPcProvisioningType.Dedicated,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.DeviceManagement.VirtualEndpoint.ProvisioningPolicies.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
CloudPcProvisioningPolicy cloudPcProvisioningPolicy = new CloudPcProvisioningPolicy();
cloudPcProvisioningPolicy.setOdataType("#microsoft.graph.cloudPcProvisioningPolicy");
cloudPcProvisioningPolicy.setDescription("Description value");
cloudPcProvisioningPolicy.setDisplayName("Display Name value");
LinkedList<CloudPcDomainJoinConfiguration> domainJoinConfigurations = new LinkedList<CloudPcDomainJoinConfiguration>();
CloudPcDomainJoinConfiguration cloudPcDomainJoinConfiguration = new CloudPcDomainJoinConfiguration();
cloudPcDomainJoinConfiguration.setOnPremisesConnectionId("16ee6c71-fc10-438b-88ac-daa1ccafffff");
cloudPcDomainJoinConfiguration.setDomainJoinType(CloudPcDomainJoinType.HybridAzureADJoin);
domainJoinConfigurations.add(cloudPcDomainJoinConfiguration);
CloudPcDomainJoinConfiguration cloudPcDomainJoinConfiguration1 = new CloudPcDomainJoinConfiguration();
cloudPcDomainJoinConfiguration1.setOnPremisesConnectionId("26e16c71-f210-438b-88ac-d481ccafffff");
cloudPcDomainJoinConfiguration1.setDomainJoinType(CloudPcDomainJoinType.HybridAzureADJoin);
domainJoinConfigurations.add(cloudPcDomainJoinConfiguration1);
cloudPcProvisioningPolicy.setDomainJoinConfigurations(domainJoinConfigurations);
cloudPcProvisioningPolicy.setId("1d164206-bf41-4fd2-8424-a3192d39ffff");
cloudPcProvisioningPolicy.setEnableSingleSignOn(true);
cloudPcProvisioningPolicy.setImageDisplayName("Windows-10 19h1-evd");
cloudPcProvisioningPolicy.setImageId("MicrosoftWindowsDesktop_Windows-10_19h1-evd");
cloudPcProvisioningPolicy.setImageType(CloudPcProvisioningPolicyImageType.Gallery);
CloudPcWindowsSetting windowsSetting = new CloudPcWindowsSetting();
windowsSetting.setLocale("en-US");
cloudPcProvisioningPolicy.setWindowsSetting(windowsSetting);
cloudPcProvisioningPolicy.setProvisioningType(CloudPcProvisioningType.Dedicated);
CloudPcProvisioningPolicy result = graphClient.deviceManagement().virtualEndpoint().provisioningPolicies().post(cloudPcProvisioningPolicy);