Get-AzVMGuestPolicyStatusHistory

Gets guest configuration policy compliance status history for an initiative of type "Guest Configuration" that is assigned to a VM. An initiative is a policy of definition type "Initiative".

Syntax

Get-AzVMGuestPolicyStatusHistory
   [-ResourceGroupName] <String>
   [-VMName] <String>
   [-InitiativeName] <String>
   [-ShowOnlyChange]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzVMGuestPolicyStatusHistory
   [-ResourceGroupName] <String>
   [-VMName] <String>
   [[-InitiativeId] <String>]
   [-ShowOnlyChange]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

The Get-AzVMGuestPolicyStatusHistory cmdlet gets compliance status history of guest configuration policies for an initiative of type "Guest Configuration" that is assigned to a VM. An initiative is a policy of definition type "Initiative". Use Get-AzVMGuestPolicyStatus cmdlet to get details of a single compliance status using ReportId that can be found in output of Get-AzVMGuestPolicyStatusHistory cmdlet.

Examples

Example 1

PS C:\> Get-AzVMGuestPolicyStatusHistory -ResourceGroupName "MyResourceGroupName" -VMName "MyVMName" -InitiativeId "/providers/Microsoft.Authorization/policySetDefinitions/3fa7cbf5-c0a4-4a59-85a5-cca4d996d5af" -ShowOnlyChange

Gets compliance status history by initiative Id. ShowOnlyChange switch shows only historical status changes. Skips statuses that have not changed between two compliance checks.

Example 2

PS C:\> Get-AzVMGuestPolicyStatusHistory -ResourceGroupName "MyResourceGroupName" -VMName "MyVMName" -InitiativeName "b5a822e0-ba98-4e54-9278-5d9833aa9b17" -ShowOnlyChange

Gets compliance status history by initiative name. ShowOnlyChange switch shows only historical status changes. Skips statuses that have not changed between two compliance checks.

Example 3

PS C:\> Get-AzVMGuestPolicyStatusHistory -ResourceGroupName "MyResourceGroupName" -VMName "MyVMName" -ShowOnlyChange

Gets compliance status history for all guest configuration policies assigned to the VM. ShowOnlyChange switch shows only historical status changes. Skips statuses that have not changed between two compliance checks.

Example 4

PS C:\> Get-AzVMGuestPolicyStatusHistory -ResourceGroupName "MyResourceGroupName" -VMName "MyVMName" -InitiativeId "/providers/Microsoft.Authorization/policySetDefinitions/3fa7cbf5-c0a4-4a59-85a5-cca4d996d5af"

Gets compliance status history by initiative Id.

Example 5

PS C:\> Get-AzVMGuestPolicyStatusHistory -ResourceGroupName "MyResourceGroupName" -VMName "MyVMName" -InitiativeName "b5a822e0-ba98-4e54-9278-5d9833aa9b17"

Gets compliance status history by initiative name.

Example 6

PS C:\> Get-AzVMGuestPolicyStatusHistory -ResourceGroupName "MyResourceGroupName" -VMName "MyVMName"

Gets compliance status history for all guest configuration policies assigned to the VM.

Example 7

PS C:\>$x = Get-AzVMGuestPolicyStatusHistory -ResourceGroupName "MyResourceGroupName" -VMName "MyVMName"
PS C:\>$x[10].ReportId
/subscriptions/4e6c6ed2-0bf6-41d7-9d21-a452c2cc7920/resourceGroups/MyResourceGroupName/providers/Microsoft.Compute/virtualMachines/MyVMName/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/MaximumPasswordAge/reports/c271f845-2c0a-4456-a441-e48fc332d0ac
PS C:\> Get-AzVMGuestPolicyStatus -ReportId $x[10].ReportId

Get guest configuration policy status by ReportId. The ReportId is the ReportId property that can be found in the results of Get-AzVMGuestPolicyStatusHistory. (please refer other examples)

Parameters

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InitiativeId

Definition Id of a policy where definition type is Initiative and category is Guest Configuration

Type:String
Position:2
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InitiativeName

Name of a policy where definition type is Initiative and category is Guest Configuration

Type:String
Position:2
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ResourceGroupName

Resource group name.

Type:String
Position:0
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ShowOnlyChange

Shows historical status changes only for guest configuration policies. Skips statuses that have not changed between two compliance status audit runs.

Type:SwitchParameter
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-VMName

VM name.

Type:String
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

Outputs

Microsoft.Azure.Commands.GuestConfiguration.Models.PolicyStatus