L’exemple suivant illustre une demande.
PATCH https://graph.microsoft.com/beta/deviceManagement/virtualEndpoint/provisioningPolicies/1d164206-bf41-4fd2-8424-a3192d39ffff
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.cloudPcProvisioningPolicy",
"displayName": "HR provisioning policy",
"description": "Provisioning policy for India HR employees",
"onPremisesConnectionId": "4e47d0f6-6f77-44f0-8893-c0fe1701ffff",
"imageId": "Image ID value",
"imageDisplayName": "Image Display Name value",
"imageType": "custom",
"windowsSettings": {
"language": "en-US"
},
"windowsSetting": {
"locale": "en-US"
},
"microsoftManagedDesktop": {
"managedType": "starterManaged",
"profile": null
},
"autopatch": {
"autopatchGroupId": "91197a0b-3a74-408d-ba88-bce3fdc4e5eb"
},
"autopilotConfiguration": {
"devicePreparationProfileId": "59e5d3d2-ec68-4bfe-9693-27975b318990",
"applicationTimeoutInMinutes": 30,
"onFailureDeviceAccessDenied": false
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new CloudPcProvisioningPolicy
{
OdataType = "#microsoft.graph.cloudPcProvisioningPolicy",
DisplayName = "HR provisioning policy",
Description = "Provisioning policy for India HR employees",
ImageId = "Image ID value",
ImageDisplayName = "Image Display Name value",
ImageType = CloudPcProvisioningPolicyImageType.Custom,
WindowsSettings = new CloudPcWindowsSettings
{
Language = "en-US",
},
WindowsSetting = new CloudPcWindowsSetting
{
Locale = "en-US",
},
MicrosoftManagedDesktop = new MicrosoftManagedDesktop
{
ManagedType = MicrosoftManagedDesktopType.StarterManaged,
Profile = null,
},
Autopatch = new CloudPcProvisioningPolicyAutopatch
{
AutopatchGroupId = "91197a0b-3a74-408d-ba88-bce3fdc4e5eb",
},
AutopilotConfiguration = new CloudPcAutopilotConfiguration
{
DevicePreparationProfileId = "59e5d3d2-ec68-4bfe-9693-27975b318990",
ApplicationTimeoutInMinutes = 30,
OnFailureDeviceAccessDenied = false,
},
AdditionalData = new Dictionary<string, object>
{
{
"onPremisesConnectionId" , "4e47d0f6-6f77-44f0-8893-c0fe1701ffff"
},
},
};
// 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["{cloudPcProvisioningPolicy-id}"].PatchAsync(requestBody);
mgc-beta device-management virtual-endpoint provisioning-policies patch --cloud-pc-provisioning-policy-id {cloudPcProvisioningPolicy-id} --body '{\
"@odata.type": "#microsoft.graph.cloudPcProvisioningPolicy",\
"displayName": "HR provisioning policy",\
"description": "Provisioning policy for India HR employees",\
"onPremisesConnectionId": "4e47d0f6-6f77-44f0-8893-c0fe1701ffff",\
"imageId": "Image ID value",\
"imageDisplayName": "Image Display Name value",\
"imageType": "custom",\
"windowsSettings": {\
"language": "en-US"\
},\
"windowsSetting": {\
"locale": "en-US"\
},\
"microsoftManagedDesktop": {\
"managedType": "starterManaged",\
"profile": null\
},\
"autopatch": {\
"autopatchGroupId": "91197a0b-3a74-408d-ba88-bce3fdc4e5eb"\
},\
"autopilotConfiguration": {\
"devicePreparationProfileId": "59e5d3d2-ec68-4bfe-9693-27975b318990",\
"applicationTimeoutInMinutes": 30,\
"onFailureDeviceAccessDenied": false\
}\
}\
'
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewCloudPcProvisioningPolicy()
displayName := "HR provisioning policy"
requestBody.SetDisplayName(&displayName)
description := "Provisioning policy for India HR employees"
requestBody.SetDescription(&description)
imageId := "Image ID value"
requestBody.SetImageId(&imageId)
imageDisplayName := "Image Display Name value"
requestBody.SetImageDisplayName(&imageDisplayName)
imageType := graphmodels.CUSTOM_CLOUDPCPROVISIONINGPOLICYIMAGETYPE
requestBody.SetImageType(&imageType)
windowsSettings := graphmodels.NewCloudPcWindowsSettings()
language := "en-US"
windowsSettings.SetLanguage(&language)
requestBody.SetWindowsSettings(windowsSettings)
windowsSetting := graphmodels.NewCloudPcWindowsSetting()
locale := "en-US"
windowsSetting.SetLocale(&locale)
requestBody.SetWindowsSetting(windowsSetting)
microsoftManagedDesktop := graphmodels.NewMicrosoftManagedDesktop()
managedType := graphmodels.STARTERMANAGED_MICROSOFTMANAGEDDESKTOPTYPE
microsoftManagedDesktop.SetManagedType(&managedType)
profile := null
microsoftManagedDesktop.SetProfile(&profile)
requestBody.SetMicrosoftManagedDesktop(microsoftManagedDesktop)
autopatch := graphmodels.NewCloudPcProvisioningPolicyAutopatch()
autopatchGroupId := "91197a0b-3a74-408d-ba88-bce3fdc4e5eb"
autopatch.SetAutopatchGroupId(&autopatchGroupId)
requestBody.SetAutopatch(autopatch)
autopilotConfiguration := graphmodels.NewCloudPcAutopilotConfiguration()
devicePreparationProfileId := "59e5d3d2-ec68-4bfe-9693-27975b318990"
autopilotConfiguration.SetDevicePreparationProfileId(&devicePreparationProfileId)
applicationTimeoutInMinutes := int32(30)
autopilotConfiguration.SetApplicationTimeoutInMinutes(&applicationTimeoutInMinutes)
onFailureDeviceAccessDenied := false
autopilotConfiguration.SetOnFailureDeviceAccessDenied(&onFailureDeviceAccessDenied)
requestBody.SetAutopilotConfiguration(autopilotConfiguration)
additionalData := map[string]interface{}{
"onPremisesConnectionId" : "4e47d0f6-6f77-44f0-8893-c0fe1701ffff",
}
requestBody.SetAdditionalData(additionalData)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
provisioningPolicies, err := graphClient.DeviceManagement().VirtualEndpoint().ProvisioningPolicies().ByCloudPcProvisioningPolicyId("cloudPcProvisioningPolicy-id").Patch(context.Background(), requestBody, nil)
// 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.setDisplayName("HR provisioning policy");
cloudPcProvisioningPolicy.setDescription("Provisioning policy for India HR employees");
cloudPcProvisioningPolicy.setImageId("Image ID value");
cloudPcProvisioningPolicy.setImageDisplayName("Image Display Name value");
cloudPcProvisioningPolicy.setImageType(CloudPcProvisioningPolicyImageType.Custom);
CloudPcWindowsSettings windowsSettings = new CloudPcWindowsSettings();
windowsSettings.setLanguage("en-US");
cloudPcProvisioningPolicy.setWindowsSettings(windowsSettings);
CloudPcWindowsSetting windowsSetting = new CloudPcWindowsSetting();
windowsSetting.setLocale("en-US");
cloudPcProvisioningPolicy.setWindowsSetting(windowsSetting);
MicrosoftManagedDesktop microsoftManagedDesktop = new MicrosoftManagedDesktop();
microsoftManagedDesktop.setManagedType(MicrosoftManagedDesktopType.StarterManaged);
microsoftManagedDesktop.setProfile(null);
cloudPcProvisioningPolicy.setMicrosoftManagedDesktop(microsoftManagedDesktop);
CloudPcProvisioningPolicyAutopatch autopatch = new CloudPcProvisioningPolicyAutopatch();
autopatch.setAutopatchGroupId("91197a0b-3a74-408d-ba88-bce3fdc4e5eb");
cloudPcProvisioningPolicy.setAutopatch(autopatch);
CloudPcAutopilotConfiguration autopilotConfiguration = new CloudPcAutopilotConfiguration();
autopilotConfiguration.setDevicePreparationProfileId("59e5d3d2-ec68-4bfe-9693-27975b318990");
autopilotConfiguration.setApplicationTimeoutInMinutes(30);
autopilotConfiguration.setOnFailureDeviceAccessDenied(false);
cloudPcProvisioningPolicy.setAutopilotConfiguration(autopilotConfiguration);
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("onPremisesConnectionId", "4e47d0f6-6f77-44f0-8893-c0fe1701ffff");
cloudPcProvisioningPolicy.setAdditionalData(additionalData);
CloudPcProvisioningPolicy result = graphClient.deviceManagement().virtualEndpoint().provisioningPolicies().byCloudPcProvisioningPolicyId("{cloudPcProvisioningPolicy-id}").patch(cloudPcProvisioningPolicy);
const options = {
authProvider,
};
const client = Client.init(options);
const cloudPcProvisioningPolicy = {
'@odata.type': '#microsoft.graph.cloudPcProvisioningPolicy',
displayName: 'HR provisioning policy',
description: 'Provisioning policy for India HR employees',
onPremisesConnectionId: '4e47d0f6-6f77-44f0-8893-c0fe1701ffff',
imageId: 'Image ID value',
imageDisplayName: 'Image Display Name value',
imageType: 'custom',
windowsSettings: {
language: 'en-US'
},
windowsSetting: {
locale: 'en-US'
},
microsoftManagedDesktop: {
managedType: 'starterManaged',
profile: null
},
autopatch: {
autopatchGroupId: '91197a0b-3a74-408d-ba88-bce3fdc4e5eb'
},
autopilotConfiguration: {
devicePreparationProfileId: '59e5d3d2-ec68-4bfe-9693-27975b318990',
applicationTimeoutInMinutes: 30,
onFailureDeviceAccessDenied: false
}
};
await client.api('/deviceManagement/virtualEndpoint/provisioningPolicies/1d164206-bf41-4fd2-8424-a3192d39ffff')
.version('beta')
.update(cloudPcProvisioningPolicy);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\CloudPcProvisioningPolicy;
use Microsoft\Graph\Beta\Generated\Models\CloudPcProvisioningPolicyImageType;
use Microsoft\Graph\Beta\Generated\Models\CloudPcWindowsSettings;
use Microsoft\Graph\Beta\Generated\Models\CloudPcWindowsSetting;
use Microsoft\Graph\Beta\Generated\Models\MicrosoftManagedDesktop;
use Microsoft\Graph\Beta\Generated\Models\MicrosoftManagedDesktopType;
use Microsoft\Graph\Beta\Generated\Models\CloudPcProvisioningPolicyAutopatch;
use Microsoft\Graph\Beta\Generated\Models\CloudPcAutopilotConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new CloudPcProvisioningPolicy();
$requestBody->setOdataType('#microsoft.graph.cloudPcProvisioningPolicy');
$requestBody->setDisplayName('HR provisioning policy');
$requestBody->setDescription('Provisioning policy for India HR employees');
$requestBody->setImageId('Image ID value');
$requestBody->setImageDisplayName('Image Display Name value');
$requestBody->setImageType(new CloudPcProvisioningPolicyImageType('custom'));
$windowsSettings = new CloudPcWindowsSettings();
$windowsSettings->setLanguage('en-US');
$requestBody->setWindowsSettings($windowsSettings);
$windowsSetting = new CloudPcWindowsSetting();
$windowsSetting->setLocale('en-US');
$requestBody->setWindowsSetting($windowsSetting);
$microsoftManagedDesktop = new MicrosoftManagedDesktop();
$microsoftManagedDesktop->setManagedType(new MicrosoftManagedDesktopType('starterManaged'));
$microsoftManagedDesktop->setProfile(null);
$requestBody->setMicrosoftManagedDesktop($microsoftManagedDesktop);
$autopatch = new CloudPcProvisioningPolicyAutopatch();
$autopatch->setAutopatchGroupId('91197a0b-3a74-408d-ba88-bce3fdc4e5eb');
$requestBody->setAutopatch($autopatch);
$autopilotConfiguration = new CloudPcAutopilotConfiguration();
$autopilotConfiguration->setDevicePreparationProfileId('59e5d3d2-ec68-4bfe-9693-27975b318990');
$autopilotConfiguration->setApplicationTimeoutInMinutes(30);
$autopilotConfiguration->setOnFailureDeviceAccessDenied(false);
$requestBody->setAutopilotConfiguration($autopilotConfiguration);
$additionalData = [
'onPremisesConnectionId' => '4e47d0f6-6f77-44f0-8893-c0fe1701ffff',
];
$requestBody->setAdditionalData($additionalData);
$result = $graphServiceClient->deviceManagement()->virtualEndpoint()->provisioningPolicies()->byCloudPcProvisioningPolicyId('cloudPcProvisioningPolicy-id')->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.DeviceManagement.Administration
$params = @{
"@odata.type" = "#microsoft.graph.cloudPcProvisioningPolicy"
displayName = "HR provisioning policy"
description = "Provisioning policy for India HR employees"
onPremisesConnectionId = "4e47d0f6-6f77-44f0-8893-c0fe1701ffff"
imageId = "Image ID value"
imageDisplayName = "Image Display Name value"
imageType = "custom"
windowsSettings = @{
language = "en-US"
}
windowsSetting = @{
locale = "en-US"
}
microsoftManagedDesktop = @{
managedType = "starterManaged"
profile = $null
}
autopatch = @{
autopatchGroupId = "91197a0b-3a74-408d-ba88-bce3fdc4e5eb"
}
autopilotConfiguration = @{
devicePreparationProfileId = "59e5d3d2-ec68-4bfe-9693-27975b318990"
applicationTimeoutInMinutes = 30
onFailureDeviceAccessDenied = $false
}
}
Update-MgBetaDeviceManagementVirtualEndpointProvisioningPolicy -CloudPcProvisioningPolicyId $cloudPcProvisioningPolicyId -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.cloud_pc_provisioning_policy import CloudPcProvisioningPolicy
from msgraph_beta.generated.models.cloud_pc_provisioning_policy_image_type import CloudPcProvisioningPolicyImageType
from msgraph_beta.generated.models.cloud_pc_windows_settings import CloudPcWindowsSettings
from msgraph_beta.generated.models.cloud_pc_windows_setting import CloudPcWindowsSetting
from msgraph_beta.generated.models.microsoft_managed_desktop import MicrosoftManagedDesktop
from msgraph_beta.generated.models.microsoft_managed_desktop_type import MicrosoftManagedDesktopType
from msgraph_beta.generated.models.cloud_pc_provisioning_policy_autopatch import CloudPcProvisioningPolicyAutopatch
from msgraph_beta.generated.models.cloud_pc_autopilot_configuration import CloudPcAutopilotConfiguration
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = CloudPcProvisioningPolicy(
odata_type = "#microsoft.graph.cloudPcProvisioningPolicy",
display_name = "HR provisioning policy",
description = "Provisioning policy for India HR employees",
image_id = "Image ID value",
image_display_name = "Image Display Name value",
image_type = CloudPcProvisioningPolicyImageType.Custom,
windows_settings = CloudPcWindowsSettings(
language = "en-US",
),
windows_setting = CloudPcWindowsSetting(
locale = "en-US",
),
microsoft_managed_desktop = MicrosoftManagedDesktop(
managed_type = MicrosoftManagedDesktopType.StarterManaged,
profile = None,
),
autopatch = CloudPcProvisioningPolicyAutopatch(
autopatch_group_id = "91197a0b-3a74-408d-ba88-bce3fdc4e5eb",
),
autopilot_configuration = CloudPcAutopilotConfiguration(
device_preparation_profile_id = "59e5d3d2-ec68-4bfe-9693-27975b318990",
application_timeout_in_minutes = 30,
on_failure_device_access_denied = False,
),
additional_data = {
"on_premises_connection_id" : "4e47d0f6-6f77-44f0-8893-c0fe1701ffff",
}
)
result = await graph_client.device_management.virtual_endpoint.provisioning_policies.by_cloud_pc_provisioning_policy_id('cloudPcProvisioningPolicy-id').patch(request_body)
L’exemple suivant illustre la réponse.