Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,14 @@ public void TestInvokeAzVmPatchAssessment()
{
TestRunner.RunTestScript("Test-InvokeAzVmPatchAssessment");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestPatchStatusGetAzVMinstanceview()
{
TestRunner.RunTestScript("Test-PatchStatusGetAzVMinstanceview");
}


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,47 @@ function Test-InvokeAzVmPatchAssessment
# Cleanup
Clean-ResourceGroup $rgname
}
}


<#
.SYNOPSIS
Test PatchStatus in Get-Azvm instance view
#>
function Test-PatchStatusGetAzVMinstanceview
{
# Setup
$rgname = Get-ComputeTestResourceName

try
{
# Common
$loc = Get-ComputeVMLocation;
$loc = $loc.Replace(' ', '');

New-AzResourceGroup -Name $rgname -Location $loc -Force;

# VM Profile & Hardware
$vmsize = Get-AvailableSku $loc "virtualMachine"
$vmname = 'vm' + $rgname;

$username = "admin01"
$password = Get-PasswordForVM | ConvertTo-SecureString -AsPlainText -Force
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
[string]$domainNameLabel = "$vmname-$vmname".tolower();

$x = New-AzVM -ResourceGroupName $rgname -Name $vmname -Location $loc -Credential $cred -DomainNameLabel $domainNameLabel
$patchResult = invoke-azvmpatchAssessment -resourcegroupname $rgname -vmname $vmname

$vm = Get-AzVM -ResourceGroupName $rgname -Name $vmname -Status;

Assert-NotNull $vm.PatchStatus;
Assert-NotNull $vm.PatchStatus.availablePatchSummary;
Assert-AreEqual "Succeeded" $vm.PatchStatus.availablePatchSummary.status;
}
finally
{
# Cleanup
Clean-ResourceGroup $rgname
}
}

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/Compute/Compute/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- Additional information about change #1
-->
## Upcoming Release
* Added 'PatchStatus'Property to VirtualMachine Instance View
* Added ``VMHealth`` property to the virtual machine's instance view, which is the returned object when ``Get-AzVm`` is invoked with ``-Status``
* Added 'AssignedHost' field to Get-AzVM and Get-AzVmss's instance views. The field shows the resource id of the virtual machine instance
* Added `SupportAutomaticPlacement` to New-AzHostGroup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public partial class PSVirtualMachineInstanceView
public IList<VirtualMachineExtensionInstanceView> Extensions { get; set; }
public BootDiagnosticsInstanceView BootDiagnostics { get; set; }
public IList<InstanceViewStatus> Statuses { get; set; }
public VirtualMachinePatchStatus PatchStatus { get; set; }
public VirtualMachineHealthStatus VmHealth { get; set; }

}
Expand Down
2 changes: 2 additions & 0 deletions src/Compute/Compute/Models/PSVirtualMachineInstanceView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class PSVirtualMachineInstanceView
public IList<InstanceViewStatus> Statuses { get; set; }

public MaintenanceRedeployStatus MaintenanceRedeployStatus { get; set; }
public VirtualMachinePatchStatus PatchStatus { get; set; }
public VirtualMachineHealthStatus VMHealth { get; set; }
}

Expand Down Expand Up @@ -72,6 +73,7 @@ public static PSVirtualMachineInstanceView ToPSVirtualMachineInstanceView(
OsName = virtualMachineInstanceView.OsName,
OsVersion = virtualMachineInstanceView.OsVersion,
HyperVGeneration = virtualMachineInstanceView.HyperVGeneration,
PatchStatus = virtualMachineInstanceView.PatchStatus,
VMHealth = virtualMachineInstanceView.VmHealth,
AssignedHost = virtualMachineInstanceView.AssignedHost
};
Expand Down