Les API sous la version /beta dans Microsoft Graph sont susceptibles d’être modifiées. L’utilisation de ces API dans des applications de production n’est pas prise en charge. Pour déterminer si une API est disponible dans v1.0, utilisez le sélecteur Version .
Dans les scénarios délégués avec des comptes professionnels ou scolaires, l’utilisateur connecté doit être propriétaire ou membre du groupe ou se voir attribuer un rôle Microsoft Entra pris en charge ou un rôle personnalisé avec une autorisation de rôle prise en charge.
Intune’administrateur ou administrateur de déploiement Windows Update sont les rôles les moins privilégiés pris en charge pour cette opération.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models.WindowsUpdates;
var requestBody = new Deployment
{
OdataType = "#microsoft.graph.windowsUpdates.deployment",
Content = new CatalogContent
{
OdataType = "#microsoft.graph.windowsUpdates.catalogContent",
CatalogEntry = new FeatureUpdateCatalogEntry
{
OdataType = "#microsoft.graph.windowsUpdates.featureUpdateCatalogEntry",
Id = "f341705b-0b15-4ce3-aaf2-6a1681d78606",
},
},
Settings = new DeploymentSettings
{
OdataType = "microsoft.graph.windowsUpdates.deploymentSettings",
Schedule = new ScheduleSettings
{
GradualRollout = new RateDrivenRolloutSettings
{
OdataType = "#microsoft.graph.windowsUpdates.rateDrivenRolloutSettings",
DurationBetweenOffers = TimeSpan.Parse("P7D"),
AdditionalData = new Dictionary<string, object>
{
{
"devicePerOffer" , 100
},
},
},
},
Monitoring = new MonitoringSettings
{
MonitoringRules = new List<MonitoringRule>
{
new MonitoringRule
{
Signal = MonitoringSignal.Rollback,
Threshold = 5,
Action = MonitoringAction.PauseDeployment,
},
},
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Admin.Windows.Updates.Deployments.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.beta.models.windowsupdates.Deployment deployment = new com.microsoft.graph.beta.models.windowsupdates.Deployment();
deployment.setOdataType("#microsoft.graph.windowsUpdates.deployment");
com.microsoft.graph.beta.models.windowsupdates.CatalogContent content = new com.microsoft.graph.beta.models.windowsupdates.CatalogContent();
content.setOdataType("#microsoft.graph.windowsUpdates.catalogContent");
com.microsoft.graph.beta.models.windowsupdates.FeatureUpdateCatalogEntry catalogEntry = new com.microsoft.graph.beta.models.windowsupdates.FeatureUpdateCatalogEntry();
catalogEntry.setOdataType("#microsoft.graph.windowsUpdates.featureUpdateCatalogEntry");
catalogEntry.setId("f341705b-0b15-4ce3-aaf2-6a1681d78606");
content.setCatalogEntry(catalogEntry);
deployment.setContent(content);
com.microsoft.graph.beta.models.windowsupdates.DeploymentSettings settings = new com.microsoft.graph.beta.models.windowsupdates.DeploymentSettings();
settings.setOdataType("microsoft.graph.windowsUpdates.deploymentSettings");
com.microsoft.graph.beta.models.windowsupdates.ScheduleSettings schedule = new com.microsoft.graph.beta.models.windowsupdates.ScheduleSettings();
com.microsoft.graph.beta.models.windowsupdates.RateDrivenRolloutSettings gradualRollout = new com.microsoft.graph.beta.models.windowsupdates.RateDrivenRolloutSettings();
gradualRollout.setOdataType("#microsoft.graph.windowsUpdates.rateDrivenRolloutSettings");
PeriodAndDuration durationBetweenOffers = PeriodAndDuration.ofDuration(Duration.parse("P7D"));
gradualRollout.setDurationBetweenOffers(durationBetweenOffers);
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("devicePerOffer", 100);
gradualRollout.setAdditionalData(additionalData);
schedule.setGradualRollout(gradualRollout);
settings.setSchedule(schedule);
com.microsoft.graph.beta.models.windowsupdates.MonitoringSettings monitoring = new com.microsoft.graph.beta.models.windowsupdates.MonitoringSettings();
LinkedList<com.microsoft.graph.beta.models.windowsupdates.MonitoringRule> monitoringRules = new LinkedList<com.microsoft.graph.beta.models.windowsupdates.MonitoringRule>();
com.microsoft.graph.beta.models.windowsupdates.MonitoringRule monitoringRule = new com.microsoft.graph.beta.models.windowsupdates.MonitoringRule();
monitoringRule.setSignal(com.microsoft.graph.beta.models.windowsupdates.MonitoringSignal.Rollback);
monitoringRule.setThreshold(5);
monitoringRule.setAction(com.microsoft.graph.beta.models.windowsupdates.MonitoringAction.PauseDeployment);
monitoringRules.add(monitoringRule);
monitoring.setMonitoringRules(monitoringRules);
settings.setMonitoring(monitoring);
deployment.setSettings(settings);
com.microsoft.graph.models.windowsupdates.Deployment result = graphClient.admin().windows().updates().deployments().post(deployment);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\WindowsUpdates\Deployment;
use Microsoft\Graph\Beta\Generated\Models\WindowsUpdates\CatalogContent;
use Microsoft\Graph\Beta\Generated\Models\WindowsUpdates\FeatureUpdateCatalogEntry;
use Microsoft\Graph\Beta\Generated\Models\WindowsUpdates\DeploymentSettings;
use Microsoft\Graph\Beta\Generated\Models\WindowsUpdates\ScheduleSettings;
use Microsoft\Graph\Beta\Generated\Models\WindowsUpdates\RateDrivenRolloutSettings;
use Microsoft\Graph\Beta\Generated\Models\WindowsUpdates\MonitoringSettings;
use Microsoft\Graph\Beta\Generated\Models\WindowsUpdates\MonitoringRule;
use Microsoft\Graph\Beta\Generated\Models\WindowsUpdates\MonitoringSignal;
use Microsoft\Graph\Beta\Generated\Models\WindowsUpdates\MonitoringAction;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Deployment();
$requestBody->setOdataType('#microsoft.graph.windowsUpdates.deployment');
$content = new CatalogContent();
$content->setOdataType('#microsoft.graph.windowsUpdates.catalogContent');
$contentCatalogEntry = new FeatureUpdateCatalogEntry();
$contentCatalogEntry->setOdataType('#microsoft.graph.windowsUpdates.featureUpdateCatalogEntry');
$contentCatalogEntry->setId('f341705b-0b15-4ce3-aaf2-6a1681d78606');
$content->setCatalogEntry($contentCatalogEntry);
$requestBody->setContent($content);
$settings = new DeploymentSettings();
$settings->setOdataType('microsoft.graph.windowsUpdates.deploymentSettings');
$settingsSchedule = new ScheduleSettings();
$settingsScheduleGradualRollout = new RateDrivenRolloutSettings();
$settingsScheduleGradualRollout->setOdataType('#microsoft.graph.windowsUpdates.rateDrivenRolloutSettings');
$settingsScheduleGradualRollout->setDurationBetweenOffers(new \DateInterval('P7D'));
$additionalData = [
'devicePerOffer' => 100,
];
$settingsScheduleGradualRollout->setAdditionalData($additionalData);
$settingsSchedule->setGradualRollout($settingsScheduleGradualRollout);
$settings->setSchedule($settingsSchedule);
$settingsMonitoring = new MonitoringSettings();
$monitoringRulesMonitoringRule1 = new MonitoringRule();
$monitoringRulesMonitoringRule1->setSignal(new MonitoringSignal('rollback'));
$monitoringRulesMonitoringRule1->setThreshold(5);
$monitoringRulesMonitoringRule1->setAction(new MonitoringAction('pauseDeployment'));
$monitoringRulesArray []= $monitoringRulesMonitoringRule1;
$settingsMonitoring->setMonitoringRules($monitoringRulesArray);
$settings->setMonitoring($settingsMonitoring);
$requestBody->setSettings($settings);
$result = $graphServiceClient->admin()->windows()->updates()->deployments()->post($requestBody)->wait();