命名空间:microsoft.graph.windowsUpdates
重要
Microsoft Graph /beta 版本下的 API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
更新 环 对象的属性。
可以将此方法用于以下子对象类型: qualityUpdateRing。
此 API 可用于以下国家级云部署。
| 全局服务 |
美国政府 L4 |
美国政府 L5 (DOD) |
由世纪互联运营的中国 |
| ✅ |
✅ |
✅ |
❌ |
权限
为此 API 选择标记为最低特权的权限。
只有在应用需要它时,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考。
| 权限类型 |
最低特权权限 |
更高特权权限 |
| 委派(工作或学校帐户) |
WindowsUpdates.ReadWrite.All |
不可用。 |
| 委派(个人 Microsoft 帐户) |
不支持。 |
不支持。 |
| 应用程序 |
WindowsUpdates.ReadWrite.All |
不可用。 |
重要
对于使用工作或学校帐户的委派访问,登录用户必须是所有者或组的成员,或者分配有受支持的Microsoft Entra角色或授予此操作所需权限的自定义角色。
Intune管理员或Windows 更新部署管理员是此操作支持的最低特权角色。
HTTP 请求
PATCH /admin/windows/updates/policies/{policyId}/rings/{ringId}
| 名称 |
说明 |
| Authorization |
持有者 {token}。 必填。 详细了解 身份验证和授权。 |
| Content-Type |
application/json. 必需。 |
请求正文
在请求正文中, 仅 提供要更新的属性的值。 请求正文中未包含的现有属性会保留其以前的值,或者根据对其他属性值的更改重新计算。
下表指定可更新的属性。
响应
如果成功,此方法在响应正文中返回响应 200 OK 代码和更新 的 microsoft.graph.windowsUpdates.ring 对象。
示例
请求
以下示例演示如何更新质量更新环。
PATCH https://graph.microsoft.com/beta/admin/windows/updates/policies/{policyId}/rings/{ringId}
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.windowsUpdates.qualityUpdateRing",
"displayName": "Test Policy 123",
"description": "Pre-production test policy",
"deferralInDays": 5,
"isPaused": true,
"isHotpatchEnabled": true
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models.WindowsUpdates;
var requestBody = new QualityUpdateRing
{
OdataType = "#microsoft.graph.windowsUpdates.qualityUpdateRing",
DisplayName = "Test Policy 123",
Description = "Pre-production test policy",
DeferralInDays = 5,
IsPaused = true,
IsHotpatchEnabled = true,
};
// 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.Policies["{policy-id}"].Rings["{ring-id}"].PatchAsync(requestBody);
// 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"
graphmodelswindowsupdates "github.com/microsoftgraph/msgraph-beta-sdk-go/models/windowsupdates"
//other-imports
)
requestBody := graphmodelswindowsupdates.NewRing()
displayName := "Test Policy 123"
requestBody.SetDisplayName(&displayName)
description := "Pre-production test policy"
requestBody.SetDescription(&description)
deferralInDays := int32(5)
requestBody.SetDeferralInDays(&deferralInDays)
isPaused := true
requestBody.SetIsPaused(&isPaused)
isHotpatchEnabled := true
requestBody.SetIsHotpatchEnabled(&isHotpatchEnabled)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
rings, err := graphClient.Admin().Windows().Updates().Policies().ByPolicyId("policy-id").Rings().ByRingId("ring-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);
com.microsoft.graph.beta.models.windowsupdates.QualityUpdateRing ring = new com.microsoft.graph.beta.models.windowsupdates.QualityUpdateRing();
ring.setOdataType("#microsoft.graph.windowsUpdates.qualityUpdateRing");
ring.setDisplayName("Test Policy 123");
ring.setDescription("Pre-production test policy");
ring.setDeferralInDays(5);
ring.setIsPaused(true);
ring.setIsHotpatchEnabled(true);
com.microsoft.graph.models.windowsupdates.Ring result = graphClient.admin().windows().updates().policies().byPolicyId("{policy-id}").rings().byRingId("{ring-id}").patch(ring);
const options = {
authProvider,
};
const client = Client.init(options);
const ring = {
'@odata.type': '#microsoft.graph.windowsUpdates.qualityUpdateRing',
displayName: 'Test Policy 123',
description: 'Pre-production test policy',
deferralInDays: 5,
isPaused: true,
isHotpatchEnabled: true
};
await client.api('/admin/windows/updates/policies/{policyId}/rings/{ringId}')
.version('beta')
.update(ring);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\WindowsUpdates\QualityUpdateRing;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new QualityUpdateRing();
$requestBody->setOdataType('#microsoft.graph.windowsUpdates.qualityUpdateRing');
$requestBody->setDisplayName('Test Policy 123');
$requestBody->setDescription('Pre-production test policy');
$requestBody->setDeferralInDays(5);
$requestBody->setIsPaused(true);
$requestBody->setIsHotpatchEnabled(true);
$result = $graphServiceClient->admin()->windows()->updates()->policies()->byPolicyId('policy-id')->rings()->byRingId('ring-id')->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.WindowsUpdates
$params = @{
"@odata.type" = "#microsoft.graph.windowsUpdates.qualityUpdateRing"
displayName = "Test Policy 123"
description = "Pre-production test policy"
deferralInDays = 5
isPaused = $true
isHotpatchEnabled = $true
}
Update-MgBetaWindowsUpdatesPolicyRing -PolicyId $policyId -RingId $ringId -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.windows_updates.quality_update_ring import QualityUpdateRing
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = QualityUpdateRing(
odata_type = "#microsoft.graph.windowsUpdates.qualityUpdateRing",
display_name = "Test Policy 123",
description = "Pre-production test policy",
deferral_in_days = 5,
is_paused = True,
is_hotpatch_enabled = True,
)
result = await graph_client.admin.windows.updates.policies.by_policy_id('policy-id').rings.by_ring_id('ring-id').patch(request_body)
响应
以下示例显示了相应的响应。
注意:为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.windowsUpdates.qualityUpdateRing",
"displayName": "Ring0 - IT devices",
"description": "First deployment ring to test updates before going to prod.",
"includedGroupAssignment": {
"@odata.type": "microsoft.graph.windowsUpdates.includedGroupAssignment"
},
"excludedGroupAssignment": {
"@odata.type": "microsoft.graph.windowsUpdates.excludedGroupAssignment"
},
"deferralInDays": 5,
"isPaused": false,
"id": "a2c7637a-cda5-e59e-2385-972c4ee528d2",
"createdDateTime": "2020-06-09T10:00:00Z",
"lastModifiedDateTime": "2020-06-09T10:00:00Z",
"isHotpatchEnabled": true
}