Azure / Azure/azure-powershell

Unable to get the list of patches while running Invoke-AzVMPatchAssessment

Open
#25,123 5 comments 0 reactions 1 assignee Assigned to @hilaryw29 View on GitHub
act-observability-squad Compute Compute - VM Compute - VMSS customer-reported question Service Attention
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

### Description

I'm using [Invoke-AzVMPatchAssessment](https://learn.microsoft.com/en-us/powershell/module/az.compute/invoke-azvmpatchassessment?view=azps-12.0.0) to retrieve the list of pending patches in an Azure VM. As per the documentation, it returns [PSVirtualMachinePatchAssessmentResult](https://learn.microsoft.com/en-us/dotnet/api/microsoft.azure.commands.compute.automation.models.psvirtualmachinepatchassessmentresult?view=az-ps-latest) containing a [Patches ](https://learn.microsoft.com/en-us/dotnet/api/microsoft.azure.commands.compute.automation.models.psvirtualmachinepatchassessmentresult.patches?view=az-ps-latest#microsoft-azure-commands-compute-automation-models-psvirtualmachinepatchassessmentresult-patches) property.

However running the Invoke-AzVMPatchAssessment returns empty/null Patches property while CriticalAndSecurityPatchCount is more than 1.

![image](https://github.com/Azure/azure-powershell/assets/13384157/2d3487b7-ad21-43fd-8448-3d26d49ff062)

Shouldn't it return a list of pending patches in the Patches property?

### Script or Debug output

_No response_

### Environment data

```PowerShell
Name Value
---- -----
PSVersion 7.4.2
PSEdition Core
GitCommitId 7.4.2
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
```

### Module versions

```PowerShell
Version Name Repository Description
------- ---- ---------- -----------
12.0.0 Az PSGallery Microsoft Azure PowerShell - Cmdlets to manage resources in Azure. This module is c…
```

### Error output

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.