Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
4 changes: 2 additions & 2 deletions src/Compute/Compute.Test/Compute.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<PsModuleName>Compute</PsModuleName>
Expand All @@ -12,7 +12,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Graph.RBAC" Version="3.4.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="38.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="38.1.0" />
<PackageReference Include="Microsoft.Azure.Management.KeyVault" Version="3.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="20.0.2-preview" />
</ItemGroup>
Expand Down
7 changes: 7 additions & 0 deletions src/Compute/Compute.Test/ScenarioTests/VirtualMachineTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,13 @@ public void TestVirtualMachineGetStatus()
TestRunner.RunTestScript("Test-VirtualMachineGetStatus");
}

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

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestVirtualMachineGetStatusWithAssignedHost()
Expand Down
64 changes: 64 additions & 0 deletions src/Compute/Compute.Test/ScenarioTests/VirtualMachineTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2959,6 +2959,7 @@ function Test-VirtualMachineGetStatus
Assert-AreEqual $vm1.HardwareProfile.VmSize $vmsize;

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

$a = $vm | Out-String;
Write-Verbose($a);
Assert-True {$a.Contains("Statuses");}
Expand Down Expand Up @@ -2994,6 +2995,69 @@ function Test-VirtualMachineGetStatus
}
}

<#
.SYNOPSIS
Test Virtual Machines's Status With Health Extension
Description:
This test creates a virtual machine and adds a vm health extension
and gets the virtual machine with -Status flag which returns the instance
view of the virtual machine. Since the vm has a health extension,
the vm's instance view should have the "vmHealth" field present in its return
object.
#>
function Test-VirtualMachineGetStatusWithHealhtExtension
{
# Setup
$rgname = Get-ComputeTestResourceName

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

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

# VM Profile & Hardware
$vmsize = 'Standard_DS2_v2';
$vmname = 'vm' + $rgname;

# OS & Image
$username = "admin01";
$password = $PLACEHOLDER | ConvertTo-SecureString -AsPlainText -Force;
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password;
[string]$domainNameLabel = "vcrptestps7691-6f2166";
# Virtual Machine
New-AzVM -ResourceGroupName $rgname -Location $loc -DomainNameLabel $domainNameLabel -Name $vmname -Credential $cred -Size $vmsize;

# Adding health extension on VM
$publicConfig = @{"protocol" = "http"; "port" = 80; "requestPath" = "/healthEndpoint"};
$extensionName = "myHealthExtension"
$extensionType = "ApplicationHealthWindows"
$publisher = "Microsoft.ManagedServices"
Set-AzVMExtension -ResourceGroupName $rgname -VMName $vmname -Publisher $publisher -Settings $publicConfig -ExtensionType $extensionType -ExtensionName $extensionName -Loc $loc -TypeHandlerVersion "1.0"

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

# Check for VmHealth Property
Assert-NotNull $vm.VMHealth
Assert-NotNull $vm.VMHealth.Status
Assert-NotNull $vm.VMHealth.Status.Code
Assert-NotNull $vm.VMHealth.Status.Level
Assert-NotNull $vm.VMHealth.Status.DisplayStatus
Assert-NotNull $vm.VMHealth.Status.Time

# Remove
Remove-AzVM -Name $vmname -ResourceGroupName $rgname -Force;
}
finally
{
# Cleanup
Clean-ResourceGroup $rgname
}
}

<#
.SYNOPSIS
Test Virtual Machines
Expand Down

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 ``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
* Added '-EncryptionAtHost' parameter to New-AzVm, New-AzVmss, New-AzVMConfig, New-AzVmssConfig, Update-AzVM, and Update-AzVmss
Expand Down
2 changes: 1 addition & 1 deletion src/Compute/Compute/Compute.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<ItemGroup>
<PackageReference Include="AutoMapper" Version="6.2.2" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="38.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="38.1.0" />
<PackageReference Include="System.Security.Permissions" Version="4.5.0" />
<PackageReference Include="System.ServiceModel.Primitives" Version="4.4.1" />
<PackageReference Include="WindowsAzure.Storage" Version="9.3.0" />
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 VirtualMachineHealthStatus VmHealth { get; set; }

}
}
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 VirtualMachineHealthStatus VMHealth { get; set; }
}

public static class PSVirtualMachineInstanceViewExtension
Expand All @@ -71,6 +72,7 @@ public static PSVirtualMachineInstanceView ToPSVirtualMachineInstanceView(
OsName = virtualMachineInstanceView.OsName,
OsVersion = virtualMachineInstanceView.OsVersion,
HyperVGeneration = virtualMachineInstanceView.HyperVGeneration,
VMHealth = virtualMachineInstanceView.VmHealth,
AssignedHost = virtualMachineInstanceView.AssignedHost
};

Expand Down
2 changes: 1 addition & 1 deletion src/Network/Network.Test/Network.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageReference Include="Microsoft.Azure.Graph.RBAC" Version="3.4.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="20.0.2-preview" />
<PackageReference Include="Microsoft.Azure.Insights" Version="0.16.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="38.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="38.1.0" />
<PackageReference Include="Microsoft.Azure.Management.ContainerInstance" Version="2.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Redis" Version="4.4.1" />
<PackageReference Include="Microsoft.Azure.Management.OperationalInsights" Version="0.21.0-preview" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="38.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="38.1.0" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="20.0.2-preview" />
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices" Version="4.3.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="4.0.1-preview" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="38.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="38.1.0" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="20.0.2-preview" />
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices" Version="4.3.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="14.3.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="38.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="38.1.0" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="20.0.2-preview" />
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="13.1.0" />
<PackageReference Include="Microsoft.Azure.Management.ResourceManager" Version="3.7.1-preview" />
Expand Down