Skip to content

Commit e3869ff

Browse files
authored
Merge pull request #314 from hyonholee/preview
[AzureRT] VMSS rolling upgrade cmdlets and availability zone features.
2 parents 1a1828a + af7c7a0 commit e3869ff

File tree

226 files changed

+278392
-460
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

226 files changed

+278392
-460
lines changed

setup/azurecmdfiles.wxi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,9 @@
683683
<Component Id="cmp779A0E3965601A707B4FB7EA41991F17" Guid="*">
684684
<File Id="fil59D93D2015C3D1C5F7D257951BDB2A25" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.Compute\Microsoft.Azure.Management.Compute.dll" />
685685
</Component>
686+
<Component Id="cmp7AC2002EE4C365F7ED04A65EB2ECB865" Guid="*">
687+
<File Id="fil214F889EDCC4702A882998D16885E151" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.Compute\Microsoft.Azure.Management.KeyVault.dll" />
688+
</Component>
686689
<Component Id="cmpE7FBE654F66ADDB880F2EED62DDCBC95" Guid="*">
687690
<File Id="fil16AF569E99B99421052FC7DFD8E43BDB" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.Compute\Microsoft.Azure.Management.Storage.dll" />
688691
</Component>
@@ -5477,6 +5480,7 @@
54775480
<ComponentRef Id="cmp8067E53A2217014032225374FB64FDE7" />
54785481
<ComponentRef Id="cmpCEE5FDE7A6F24B1A7B048897D0A4FB10" />
54795482
<ComponentRef Id="cmp779A0E3965601A707B4FB7EA41991F17" />
5483+
<ComponentRef Id="cmp7AC2002EE4C365F7ED04A65EB2ECB865" />
54805484
<ComponentRef Id="cmpE7FBE654F66ADDB880F2EED62DDCBC95" />
54815485
<ComponentRef Id="cmpA5892A5B2CF39458BD6E319D74C3878C" />
54825486
<ComponentRef Id="cmp3D87E7A369012515387799F3AE4D8DA9" />

src/ResourceManager/Compute/AzureRM.Compute.psd1

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,19 @@ CmdletsToExport = 'Remove-AzureRmAvailabilitySet', 'Get-AzureRmAvailabilitySet',
163163
'Add-AzureRmImageDataDisk', 'Remove-AzureRmImageDataDisk',
164164
'ConvertTo-AzureRmVMManagedDisk', 'Set-AzureRmVmssBootDiagnostic',
165165
'Get-AzureRmComputeResourceSku',
166-
'Get-AzureRmVMRunCommandDocument', 'Invoke-AzureRmVMRunCommand'
166+
'Get-AzureRmVMRunCommandDocument', 'Invoke-AzureRmVMRunCommand',
167+
'Start-AzureRmVmssRollingOSUpgrade', 'Stop-AzureRmVmssRollingUpgrade',
168+
'Get-AzureRmVmssRollingUpgrade',
169+
'Set-AzureRmVmssRollingUpgradePolicy',
170+
'Set-AzureRmVmssDiskEncryptionExtension',
171+
'Disable-AzureRmVmssDiskEncryption',
172+
'Get-AzureRmVmssDiskEncryption', 'Get-AzureRmVmssVMDiskEncryption'
167173

168174
# Variables to export from this module
169175
# VariablesToExport = @()
170176

171177
# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
172-
AliasesToExport = @()
178+
AliasesToExport = @('Get-AzureRmVmssDiskEncryptionStatus', 'Get-AzureRmVmssVMDiskEncryptionStatus')
173179

174180
# DSC resources to export from this module
175181
# DscResourcesToExport = @()

src/ResourceManager/Compute/ChangeLog.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,20 @@
2222
- New cmdlet: 'Invoke-AzureRmVMRunCommand' invokes a run command on a VM
2323
- New cmdlet: 'Get-AzureRmVMRunCommandDocument' shows available run command documents
2424
* Add 'StorageAccountType' parameter to Set-AzureRmDataDisk
25+
* Availability Zone support for virtual machine, VM scale set, and disk
26+
- New paramter: 'Zone' is added to New-AzureRmVM, New-AzureRmVMConfig, New-AzureRmVmssConfig, New-AzureRmDiskConfig
27+
* VM scale set rolling upgrade feature:
28+
- New cmdlet: 'Start-AzureRmVmssRollingOSUpgrade' invokes OS rolling upgrade of VM scale set
29+
- New cmdlet: 'Set-AzureRmVmssRollingUpgradePolicy' sets upgrade policy for VM scale set rolling upgrade.
30+
- New cmdlet: 'Stop-AzureRmVmssRollingUpgrade' cancels rolling upgrade of VM scale set
31+
- New cmdlet: 'Get-AzureRmVmssRollingUpgrade' shows the status of VM scale set rolling upgrade.
32+
* AssignIdentity switch parameter is introduced for system assigned identity.
33+
- New parameter: 'AssignIdentity' is added to New-AzureRmVMConfig, New-AzureRmVmssConfig and Update-AzureRmVM
34+
* Vmss disk encryption feature:
35+
- New cmdlet: 'Set-AzureRmVmssDiskEncryptionExtension' enables disk encryption on VM scale set
36+
- New cmdlet: 'Disable-AzureRmVmssDiskEncryption' disables disk encryption on VM scale set
37+
- New cmdlet: 'Get-AzureRmVmssDiskEncryptionStatus' shows the disk encryption status of a VM scale set
38+
- New cmdelt: 'Get-AzureRmVmssVMDiskEncryptionStatus' shows the disk encryption status of VMs in a VM scale set
2539

2640
## Version 3.3.1
2741
*

src/ResourceManager/Compute/Commands.Compute.Test/Commands.Compute.Test.csproj

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.2.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
6565
</Reference>
6666
<Reference Include="Microsoft.Azure.Management.Compute">
67-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Compute.16.2.0\lib\net452\Microsoft.Azure.Management.Compute.dll</HintPath>
67+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Compute.16.3.0\lib\net452\Microsoft.Azure.Management.Compute.dll</HintPath>
6868
</Reference>
6969
<Reference Include="Microsoft.Azure.Management.Network, Version=14.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
7070
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.14.2.0-preview\lib\net452\Microsoft.Azure.Management.Network.dll</HintPath>
@@ -165,6 +165,7 @@
165165
<Compile Include="Common\ComputeTestController.cs" />
166166
<Compile Include="ScenarioTests\AddVhdTests.cs" />
167167
<Compile Include="ScenarioTests\AEMExtensionTests.cs" />
168+
<Compile Include="ScenarioTests\AvailabilityZoneTests.cs" />
168169
<Compile Include="ScenarioTests\ChefExtensionTests.cs" />
169170
<Compile Include="ScenarioTests\ComputeCloudExceptionTests.cs" />
170171
<Compile Include="ScenarioTests\ContainerServiceTests.cs" />
@@ -179,6 +180,7 @@
179180
<Compile Include="ScenarioTests\RunnerTests.cs" />
180181
<Compile Include="ScenarioTests\VirtualMachineBootDiagnosticsTests.cs" />
181182
<Compile Include="ScenarioTests\VirtualMachineRunCommandTests.cs" />
183+
<Compile Include="ScenarioTests\VirtualMachineScaleSetExtensionTests.cs" />
182184
<Compile Include="ScenarioTests\VirtualMachineScaleSetTests.cs" />
183185
<Compile Include="ScenarioTests\VMDynamicTests.cs" />
184186
<Compile Include="ScenarioTests\VirtualMachineProfileTests.cs" />
@@ -250,6 +252,9 @@
250252
<Content Include="ConfigFiles\DiagnosticsExtensionPublicConfig.json">
251253
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
252254
</Content>
255+
<None Include="ScenarioTests\AvailabilityZoneTests.ps1">
256+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
257+
</None>
253258
<None Include="ScenarioTests\DiskRPTests.ps1">
254259
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
255260
</None>
@@ -316,6 +321,9 @@
316321
<None Include="ScenarioTests\VirtualMachineRunCommandTests.ps1">
317322
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
318323
</None>
324+
<None Include="ScenarioTests\VirtualMachineScaleSetExtensionTests.ps1">
325+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
326+
</None>
319327
<None Include="ScenarioTests\VirtualMachineScaleSetTests.ps1">
320328
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
321329
</None>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
16+
using Xunit;
17+
18+
namespace Microsoft.Azure.Commands.Compute.Test.ScenarioTests
19+
{
20+
public partial class AvailabilityZoneTests
21+
{
22+
[Fact]
23+
[Trait(Category.AcceptanceType, Category.CheckIn)]
24+
public void TestVirtualMachineZone()
25+
{
26+
ComputeTestController.NewInstance.RunPsTest("Test-VirtualMachineZone");
27+
}
28+
}
29+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# ----------------------------------------------------------------------------------
2+
#
3+
# Copyright Microsoft Corporation
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
# ----------------------------------------------------------------------------------
14+
15+
<#
16+
.SYNOPSIS
17+
Test Virtual Machine Performance Maintenance
18+
#>
19+
function Test-VirtualMachineZone
20+
{
21+
# Setup
22+
$rgname = Get-ComputeTestResourceName
23+
24+
try
25+
{
26+
# Common
27+
$loc = 'eastus2';
28+
29+
New-AzureRmResourceGroup -Name $rgname -Location $loc -Force;
30+
31+
# VM Profile & Hardware
32+
$vmsize = 'Standard_A4';
33+
$vmname = 'vm' + $rgname;
34+
35+
# NRP
36+
$subnet = New-AzureRmVirtualNetworkSubnetConfig -Name ('subnet' + $rgname) -AddressPrefix "10.0.0.0/24";
37+
$vnet = New-AzureRmVirtualNetwork -Force -Name ('vnet' + $rgname) -ResourceGroupName $rgname -Location $loc -AddressPrefix "10.0.0.0/16" -Subnet $subnet;
38+
$vnet = Get-AzureRmVirtualNetwork -Name ('vnet' + $rgname) -ResourceGroupName $rgname;
39+
$subnetId = $vnet.Subnets[0].Id;
40+
$pubip = New-AzureRmPublicIpAddress -Force -Name ('pubip' + $rgname) -ResourceGroupName $rgname -Location $loc -AllocationMethod Dynamic -DomainNameLabel ('pubip' + $rgname);
41+
$pubip = Get-AzureRmPublicIpAddress -Name ('pubip' + $rgname) -ResourceGroupName $rgname;
42+
$pubipId = $pubip.Id;
43+
$nic = New-AzureRmNetworkInterface -Force -Name ('nic' + $rgname) -ResourceGroupName $rgname -Location $loc -SubnetId $subnetId -PublicIpAddressId $pubip.Id;
44+
$nic = Get-AzureRmNetworkInterface -Name ('nic' + $rgname) -ResourceGroupName $rgname;
45+
$nicId = $nic.Id;
46+
47+
# Storage Account (SA)
48+
$stoname = 'sto' + $rgname;
49+
$stotype = 'Standard_GRS';
50+
New-AzureRmStorageAccount -ResourceGroupName $rgname -Name $stoname -Location $loc -Type $stotype;
51+
$stoaccount = Get-AzureRmStorageAccount -ResourceGroupName $rgname -Name $stoname;
52+
53+
# OS & Image
54+
$user = "Foo12";
55+
$password = $PLACEHOLDER;
56+
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force;
57+
$cred = New-Object System.Management.Automation.PSCredential ($user, $securePassword);
58+
$computerName = 'test';
59+
60+
$p = New-AzureRmVMConfig -VMName $vmname -VMSize $vmsize -Zone "1" `
61+
| Add-AzureRmVMNetworkInterface -Id $nicId -Primary `
62+
| Set-AzureRmVMOperatingSystem -Windows -ComputerName $computerName -Credential $cred;
63+
64+
$imgRef = Get-DefaultCRPImage -loc $loc;
65+
66+
$p = $imgRef | Set-AzureRmVMSourceImage -VM $p;
67+
68+
Assert-ThrowsContains { New-AzureRmVM -ResourceGroupName $rgname -Location $loc -VM $p;} `
69+
"does not support availability zones";
70+
$p.Zones = $null;
71+
Assert-ThrowsContains { New-AzureRmVM -ResourceGroupName $rgname -Location $loc -Zone "1" -VM $p;} `
72+
"does not support availability zones";
73+
$p.Zones = $null;
74+
75+
New-AzureRmVM -ResourceGroupName $rgname -Location $loc -VM $p;
76+
$vm = Get-AzureRmVM -ResourceGroupName $rgname -Name $vmname;
77+
$vm | Update-AzureRmVM;
78+
}
79+
finally
80+
{
81+
# Cleanup
82+
Clean-ResourceGroup $rgname
83+
}
84+
}

src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/DiskRPTests.ps1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function Test-Disk
3333
$access = 'Read';
3434

3535
# Config create test
36-
$diskconfig = New-AzureRmDiskConfig -Location $loc -DiskSizeGB 5 -AccountType StandardLRS -OsType Windows -CreateOption Empty -EncryptionSettingsEnabled $true;
36+
$diskconfig = New-AzureRmDiskConfig -Location $loc -Zone "1" -DiskSizeGB 5 -AccountType StandardLRS -OsType Windows -CreateOption Empty -EncryptionSettingsEnabled $true;
3737
# Encryption test
3838
$diskconfig = Set-AzureRmDiskDiskEncryptionKey -Disk $diskconfig -SecretUrl $mockkey -SourceVaultId $mocksourcevault;
3939
$diskconfig = Set-AzureRmDiskKeyEncryptionKey -Disk $diskconfig -KeyUrl $mockkey -SourceVaultId $mocksourcevault;
@@ -52,6 +52,9 @@ function Test-Disk
5252
$diskconfig.EncryptionSettings.DiskEncryptionKey = $null;
5353
$diskconfig.EncryptionSettings.KeyEncryptionKey = $null;
5454
$diskconfig.CreationData.ImageReference = $null;
55+
56+
Assert-AreEqual "1" $diskconfig.Zones
57+
$diskconfig.Zones = $null
5558

5659
New-AzureRmDisk -ResourceGroupName $rgname -DiskName $diskname -Disk $diskconfig;
5760

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
16+
using Xunit;
17+
18+
namespace Microsoft.Azure.Commands.Compute.Test.ScenarioTests
19+
{
20+
public partial class VirtualMachineScaleSetExtensionTests
21+
{
22+
[Fact(Skip = "TODO: only works for live mode")]
23+
[Trait(Category.RunType, Category.LiveOnly)]
24+
public void TestVirtualMachineScaleSetDiskEncryptionExtension()
25+
{
26+
ComputeTestController.NewInstance.RunPsTest("Test-VirtualMachineScaleSetDiskEncryptionExtension");
27+
}
28+
29+
[Fact]
30+
[Trait(Category.AcceptanceType, Category.CheckIn)]
31+
public void TestDisableVirtualMachineScaleSetDiskEncryption()
32+
{
33+
ComputeTestController.NewInstance.RunPsTest("Test-DisableVirtualMachineScaleSetDiskEncryption");
34+
}
35+
36+
[Fact]
37+
[Trait(Category.AcceptanceType, Category.CheckIn)]
38+
public void TestGetVirtualMachineScaleSetDiskEncryptionStatus()
39+
{
40+
ComputeTestController.NewInstance.RunPsTest("Test-GetVirtualMachineScaleSetDiskEncryptionStatus");
41+
}
42+
}
43+
44+
}

0 commit comments

Comments
 (0)