你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Virtual Machines - Assess Patches

评估虚拟机上的修补程序。

POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches?api-version=2025-04-01

URI 参数

名称 必需 类型 说明
resourceGroupName
path True

string

minLength: 1
maxLength: 90

资源组的名称。 此名称不区分大小写。

subscriptionId
path True

string

minLength: 1

目标订阅的 ID。

vmName
path True

string

虚拟机的名称。

api-version
query True

string

minLength: 1

要用于此操作的 API 版本。

响应

名称 类型 说明
200 OK

VirtualMachineAssessPatchesResult

Azure作已成功完成。

202 Accepted

已接受资源作。

标头

  • Location: string
  • Retry-After: integer
Other Status Codes

CloudError

意外错误响应。

安全性

azure_auth

Azure Active Directory OAuth2 Flow。

类型: oauth2
流向: implicit
授权 URL: https://login.microsoftonline.com/common/oauth2/authorize

作用域

名称 说明
user_impersonation 模拟用户帐户

示例

Assess patch state of a virtual machine.

示例请求

POST https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroupName/providers/Microsoft.Compute/virtualMachines/myVMName/assessPatches?api-version=2025-04-01

示例响应

{
  "status": "Succeeded",
  "assessmentActivityId": "68f8b292-dfc2-4646-9781-33cc88631968",
  "rebootPending": true,
  "criticalAndSecurityPatchCount": 1,
  "otherPatchCount": 2,
  "startDateTime": "2020-04-24T21:02:04.2556154Z",
  "availablePatches": [
    {
      "patchId": "35428702-5784-4ba4-a6e0-5222258b5411",
      "name": "Definition Update for Windows Defender Antivirus - KB2267602 (Definition 1.279.1373.0)",
      "version": "",
      "kbId": "2267602",
      "classifications": [
        "Definition Updates"
      ],
      "rebootBehavior": "NeverReboots",
      "activityId": "68f8b292-dfc2-4646-9781-33cc88631968",
      "publishedDate": "2018-11-07T00:00:00Z",
      "lastModifiedDateTime": "2020-04-24T21:18:45.2830263Z",
      "assessmentState": "Available"
    },
    {
      "patchId": "39f9cdd1-795c-4d0e-8c0a-73ab3f31746d",
      "name": "Windows Malicious Software Removal Tool x64 - October 2018 (KB890830)",
      "version": "",
      "kbId": "890830",
      "classifications": [
        "Update Rollups"
      ],
      "rebootBehavior": "CanRequestReboot",
      "activityId": "68f8b292-dfc2-4646-9781-33cc88631968",
      "publishedDate": "2018-11-07T00:00:00Z",
      "lastModifiedDateTime": "2020-04-24T21:18:45.2830263Z",
      "assessmentState": "Available"
    }
  ],
  "error": null
}
Location: https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/westus/operations/{operationId}&monitor=true&api-version=2025-04-01

定义

名称 说明
ApiError

API 错误。

ApiErrorBase

Api 错误库。

CloudError

来自计算服务的错误响应。

InnerError

内部错误详细信息。

PatchAssessmentState

描述给定修补程序的可用性。

PatchOperationStatus

作的总体成功或失败状态。 在作完成之前,它将保持“InProgress”状态。 此时,它将变为“未知”、“失败”、“成功”或“CompletedWithWarnings”。

VirtualMachineAssessPatchesResult

描述 AssessPatches 结果的属性。

VirtualMachineSoftwarePatchProperties

描述虚拟机软件修补程序的属性。

VMGuestPatchRebootBehavior

描述修补程序的重新启动要求。

ApiError

API 错误。

名称 类型 说明
code

string

错误代码。

details

ApiErrorBase[]

Api 错误详细信息

innererror

InnerError

Api 内部错误

message

string

错误消息。

target

string

特定错误的目标。

ApiErrorBase

Api 错误库。

名称 类型 说明
code

string

错误代码。

message

string

错误消息。

target

string

特定错误的目标。

CloudError

来自计算服务的错误响应。

名称 类型 说明
error

ApiError

API 错误。

InnerError

内部错误详细信息。

名称 类型 说明
errordetail

string

内部错误消息或异常转储。

exceptiontype

string

异常类型。

PatchAssessmentState

描述给定修补程序的可用性。

说明
Unknown
Available

PatchOperationStatus

作的总体成功或失败状态。 在作完成之前,它将保持“InProgress”状态。 此时,它将变为“未知”、“失败”、“成功”或“CompletedWithWarnings”。

说明
Unknown
InProgress
Failed
Succeeded
CompletedWithWarnings

VirtualMachineAssessPatchesResult

描述 AssessPatches 结果的属性。

名称 类型 说明
assessmentActivityId

string

生成此结果的作的活动 ID。 它用于跨 CRP 和扩展日志进行关联。

availablePatches

VirtualMachineSoftwarePatchProperties[]

已检测到可用于安装的修补程序列表。

criticalAndSecurityPatchCount

integer (int32)

已检测到可用但尚未安装的关键修补程序或安全修补程序的数量。

error

ApiError

执行作期间遇到的错误。 details 数组包含它们的列表。

otherPatchCount

integer (int32)

所有可用补丁的数量,不包括关键修补程序和安全修补程序。

rebootPending

boolean

VM 的总体重新启动状态。 当部分安装的补丁需要重新启动才能完成安装但尚未重新启动时,情况确实如此。

startDateTime

string (date-time)

作开始时的 UTC 时间戳。

status

PatchOperationStatus

作的总体成功或失败状态。 在作完成之前,它将保持“InProgress”状态。 此时,它将变为“未知”、“失败”、“成功”或“CompletedWithWarnings”。

VirtualMachineSoftwarePatchProperties

描述虚拟机软件修补程序的属性。

名称 类型 说明
activityId

string

生成此结果的作的活动 ID。 它用于跨 CRP 和扩展日志进行关联。

assessmentState

PatchAssessmentState

描述给定修补程序的可用性。

classifications

string[]

修补程序发布者提供的修补程序的分类。

kbId

string

修补程序的 KBID。 仅适用于 Windows 补丁。

lastModifiedDateTime

string (date-time)

此补丁记录的上次更新的 UTC 时间戳。

name

string

修补程序的友好名称。

patchId

string

修补程序的唯一标识符。

publishedDate

string (date-time)

存储库发布此补丁时的 UTC 时间戳。

rebootBehavior

VMGuestPatchRebootBehavior

描述修补程序的重新启动要求。

version

string

修补程序的版本号。 此属性仅适用于 Linux 修补程序。

VMGuestPatchRebootBehavior

描述修补程序的重新启动要求。

说明
Unknown
NeverReboots
AlwaysRequiresReboot
CanRequestReboot