Skip to content

Commit dabd769

Browse files
authored
Merge pull request #5807 from hyonholee/AzureRM.Compute.4.6.0
[Compute] Update for Zone resilient
2 parents 1e29a03 + 1139bbc commit dabd769

File tree

120 files changed

+1352
-1014
lines changed

Some content is hidden

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

120 files changed

+1352
-1014
lines changed

src/ResourceManager/Compute/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Current Release
21+
* Update for Zone Resilient
2122

2223
## Version 4.5.0
2324
* `New-AzureRmVM` and `New-AzureRmVMSS` support data disks.

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

Lines changed: 1 addition & 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.17.5.0\lib\net452\Microsoft.Azure.Management.Compute.dll</HintPath>
67+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Compute.18.0.0\lib\net452\Microsoft.Azure.Management.Compute.dll</HintPath>
6868
</Reference>
6969
<Reference Include="Microsoft.Azure.Management.Network, Version=17.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
7070
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.17.0.0-preview\lib\net452\Microsoft.Azure.Management.Network.dll</HintPath>

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

Lines changed: 4 additions & 4 deletions
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 -Zone "1" -DiskSizeGB 5 -AccountType StandardLRS -OsType Windows -CreateOption Empty -EncryptionSettingsEnabled $true;
36+
$diskconfig = New-AzureRmDiskConfig -Location $loc -Zone "1" -DiskSizeGB 5 -AccountType "Standard_LRS" -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;
@@ -64,7 +64,7 @@ function Test-Disk
6464
$disk = Get-AzureRmDisk -ResourceGroupName $rgname -DiskName $diskname;
6565
Assert-AreEqual $null $disk.Zones;
6666
Assert-AreEqual 5 $disk.DiskSizeGB;
67-
Assert-AreEqual StandardLRS $disk.Sku.Name;
67+
Assert-AreEqual "Standard_LRS" $disk.Sku.Name;
6868
Assert-AreEqual Windows $disk.OsType;
6969
Assert-AreEqual Empty $disk.CreationData.CreateOption;
7070
Assert-AreEqual $false $disk.EncryptionSettings.Enabled;
@@ -112,7 +112,7 @@ function Test-Snapshot
112112
$access = 'Read';
113113

114114
# Config and create test
115-
$snapshotconfig = New-AzureRmSnapshotConfig -Location $loc -DiskSizeGB 5 -AccountType StandardLRS -OsType Windows -CreateOption Empty -EncryptionSettingsEnabled $true;
115+
$snapshotconfig = New-AzureRmSnapshotConfig -Location $loc -DiskSizeGB 5 -AccountType "Standard_LRS" -OsType Windows -CreateOption Empty -EncryptionSettingsEnabled $true;
116116

117117
# Encryption test
118118
$snapshotconfig = Set-AzureRmSnapshotDiskEncryptionKey -Snapshot $snapshotconfig -SecretUrl $mockkey -SourceVaultId $mocksourcevault;
@@ -139,7 +139,7 @@ function Test-Snapshot
139139
# Get snapshot test
140140
$snapshot = Get-AzureRmSnapshot -ResourceGroupName $rgname -SnapshotName $snapshotname;
141141
Assert-AreEqual 5 $snapshot.DiskSizeGB;
142-
Assert-AreEqual StandardLRS $snapshot.Sku.Name;
142+
Assert-AreEqual "Standard_LRS" $snapshot.Sku.Name;
143143
Assert-AreEqual Windows $snapshot.OsType;
144144
Assert-AreEqual Empty $snapshot.CreationData.CreateOption;
145145
Assert-AreEqual $false $snapshot.EncryptionSettings.Enabled;

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ function Test-VirtualMachineProfile
6767

6868
# Managed data disk setting
6969
$managedDataDiskId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rggroup/providers/Microsoft.Compute/disks/dataDisk";
70-
$p = Add-AzureRmVMDataDisk -VM $p -Name 'testDataDisk3' -Caching 'ReadOnly' -DiskSizeInGB $null -Lun 2 -CreateOption Empty -ManagedDiskId $managedDataDiskId -StorageAccountType StandardLRS;
70+
$p = Add-AzureRmVMDataDisk -VM $p -Name 'testDataDisk3' -Caching 'ReadOnly' -DiskSizeInGB $null -Lun 2 -CreateOption Empty -ManagedDiskId $managedDataDiskId -StorageAccountType "Standard_LRS";
7171
Assert-AreEqual $managedDataDiskId $p.StorageProfile.DataDisks[2].ManagedDisk.Id;
72-
Assert-AreEqual "StandardLRS" $p.StorageProfile.DataDisks[2].ManagedDisk.StorageAccountType;
72+
Assert-AreEqual "Standard_LRS" $p.StorageProfile.DataDisks[2].ManagedDisk.StorageAccountType;
7373
Assert-Null $p.StorageProfile.DataDisks[2].DiskSizeGB;
7474
Assert-AreEqual $false $p.StorageProfile.DataDisks[2].WriteAcceleratorEnabled;
7575

@@ -116,20 +116,20 @@ function Test-VirtualMachineProfile
116116
$managedOsDiskId_0 = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rggroup/providers/Microsoft.Compute/disks/osDisk0";
117117
$managedOsDiskId_1 = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rggroup/providers/Microsoft.Compute/disks/osDisk1";
118118

119-
$p = Set-AzureRmVMOsDisk -VM $p -ManagedDiskId $managedOsDiskId_0 -StorageAccountType StandardLRS -WriteAccelerator;
119+
$p = Set-AzureRmVMOsDisk -VM $p -ManagedDiskId $managedOsDiskId_0 -StorageAccountType "Standard_LRS" -WriteAccelerator;
120120
Assert-AreEqual $osDiskCaching $p.StorageProfile.OSDisk.Caching;
121121
Assert-AreEqual $osDiskName $p.StorageProfile.OSDisk.Name;
122122
Assert-AreEqual $p.StorageProfile.OSDisk.Vhd.Uri $osDiskVhdUri;
123123
Assert-AreEqual $managedOsDiskId_0 $p.StorageProfile.OSDisk.ManagedDisk.Id;
124-
Assert-AreEqual 'StandardLRS' $p.StorageProfile.OSDisk.ManagedDisk.StorageAccountType;
124+
Assert-AreEqual "Standard_LRS" $p.StorageProfile.OSDisk.ManagedDisk.StorageAccountType;
125125
Assert-AreEqual $true $p.StorageProfile.OSDisk.WriteAcceleratorEnabled;
126126

127127
$p = Set-AzureRmVMOsDisk -VM $p -ManagedDiskId $managedOsDiskId_1;
128128
Assert-AreEqual $p.StorageProfile.OSDisk.Caching $osDiskCaching;
129129
Assert-AreEqual $p.StorageProfile.OSDisk.Name $osDiskName;
130130
Assert-AreEqual $p.StorageProfile.OSDisk.Vhd.Uri $osDiskVhdUri;
131131
Assert-AreEqual $managedOsDiskId_1 $p.StorageProfile.OSDisk.ManagedDisk.Id;
132-
Assert-AreEqual 'StandardLRS' $p.StorageProfile.OSDisk.ManagedDisk.StorageAccountType;
132+
Assert-AreEqual "Standard_LRS" $p.StorageProfile.OSDisk.ManagedDisk.StorageAccountType;
133133
Assert-AreEqual $false $p.StorageProfile.OSDisk.WriteAcceleratorEnabled;
134134

135135
# Windows OS

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ function Test-VirtualMachineScaleSet-Common($IsManaged)
128128
-ImageReferenceOffer $imgRef.Offer -ImageReferenceSku $imgRef.Skus -ImageReferenceVersion $imgRef.Version `
129129
-ImageReferencePublisher $imgRef.PublisherName -OsDiskWriteAccelerator `
130130
| Add-AzureRmVmssDataDisk -Name 'testDataDisk1' -Caching 'ReadOnly' -DiskSizeGB 20 -Lun 1 -CreateOption Empty `
131-
-StorageAccountType StandardLRS -WriteAccelerator;
131+
-StorageAccountType "Standard_LRS" -WriteAccelerator;
132132

133133
Assert-AreEqual 'FromImage' $vmss.VirtualMachineProfile.StorageProfile.OsDisk.CreateOption;
134134
Assert-AreEqual 'None' $vmss.VirtualMachineProfile.StorageProfile.OsDisk.Caching;
@@ -145,7 +145,7 @@ function Test-VirtualMachineScaleSet-Common($IsManaged)
145145
Assert-AreEqual 20 $vmss.VirtualMachineProfile.StorageProfile.DataDisks[0].DiskSizeGB;
146146
Assert-AreEqual 1 $vmss.VirtualMachineProfile.StorageProfile.DataDisks[0].Lun;
147147
Assert-AreEqual 'Empty' $vmss.VirtualMachineProfile.StorageProfile.DataDisks[0].CreateOption;
148-
Assert-AreEqual 'StandardLRS' $vmss.VirtualMachineProfile.StorageProfile.DataDisks[0].ManagedDisk.StorageAccountType;
148+
Assert-AreEqual "Standard_LRS" $vmss.VirtualMachineProfile.StorageProfile.DataDisks[0].ManagedDisk.StorageAccountType;
149149
Assert-AreEqual $true $vmss.VirtualMachineProfile.StorageProfile.DataDisks[0].WriteAcceleratorEnabled;
150150
$vmss.VirtualMachineProfile.StorageProfile.DataDisks[0].WriteAcceleratorEnabled = $false;
151151

src/ResourceManager/Compute/Commands.Compute.Test/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<package id="Microsoft.Azure.Gallery" version="2.6.2-preview" targetFramework="net45" />
77
<package id="Microsoft.Azure.Graph.RBAC" version="3.4.0-preview" targetFramework="net452" />
88
<package id="Microsoft.Azure.Management.Authorization" version="2.0.0" targetFramework="net45" />
9-
<package id="Microsoft.Azure.Management.Compute" version="17.5.0" targetFramework="net452" />
9+
<package id="Microsoft.Azure.Management.Compute" version="18.0.0" targetFramework="net452" />
1010
<package id="Microsoft.Azure.Management.Network" version="17.0.0-preview" targetFramework="net452" />
1111
<package id="Microsoft.Azure.Management.Storage" version="4.1.0-preview" targetFramework="net45" />
1212
<package id="Microsoft.Azure.Test.Framework" version="1.0.6179.26854-prerelease" targetFramework="net45" />

src/ResourceManager/Compute/Commands.Compute/Commands.Compute.Netcore.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<PackageReference Include="Microsoft.Azure.Management.ResourceManager" Version="1.6.0-preview" />
3131
<PackageReference Include="Microsoft.Azure.Graph.RBAC" Version="3.4.0-preview" />
3232
<PackageReference Include="Microsoft.Azure.Management.Authorization" Version="2.5.0-preview" />
33-
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="17.5.0" />
33+
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="18.0.0" />
3434
<PackageReference Include="Microsoft.Azure.Management.KeyVault" Version="2.3.0-preview" />
3535
<PackageReference Include="Microsoft.Azure.Management.Network" Version="10.1.0-preview" />
3636
<PackageReference Include="AutoMapper" Version="6.0.2" />

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
<Private>True</Private>
5454
</Reference>
5555
<Reference Include="Microsoft.Azure.Management.Compute">
56-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Compute.17.5.0\lib\net452\Microsoft.Azure.Management.Compute.dll</HintPath>
56+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Compute.18.0.0\lib\net452\Microsoft.Azure.Management.Compute.dll</HintPath>
5757
<Private>True</Private>
5858
</Reference>
5959
<Reference Include="Microsoft.Azure.Management.KeyVault, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">

src/ResourceManager/Compute/Commands.Compute/Generated/ComputeAutomationBaseCmdlet.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
using System.Management.Automation;
3030
using System.Reflection;
3131
using System.Text;
32+
using System.Text.RegularExpressions;
3233

3334
namespace Microsoft.Azure.Commands.Compute.Automation
3435
{
@@ -290,6 +291,22 @@ private static Tuple<string, string, int> MakeTuple(string key, string value, in
290291
{
291292
return new Tuple<string, string, int>(key, value, depth);
292293
}
294+
295+
public static string GetResourceGroupName(string resourceId)
296+
{
297+
if (string.IsNullOrEmpty(resourceId)) { return null; }
298+
Regex r = new Regex(@"(.*?)/resourcegroups/(?<rgname>\S+)/providers/(.*?)", RegexOptions.IgnoreCase);
299+
Match m = r.Match(resourceId);
300+
return m.Success ? m.Groups["rgname"].Value : null;
301+
}
302+
303+
public static string GetResourceName(string resourceId, string resourceName)
304+
{
305+
if (string.IsNullOrEmpty(resourceId)) { return null; }
306+
Regex r = new Regex(@"(.*?)/" + resourceName + @"/(?<rgname>\S+)", RegexOptions.IgnoreCase);
307+
Match m = r.Match(resourceId);
308+
return m.Success ? m.Groups["rgname"].Value : null;
309+
}
293310
}
294311
public static class LocationStringExtensions
295312
{

src/ResourceManager/Compute/Commands.Compute/Generated/ContainerService/Config/AddAzureRmContainerServiceAgentPoolProfileCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ private void Run()
8282

8383
var vAgentPoolProfiles = new Microsoft.Azure.Management.Compute.Models.ContainerServiceAgentPoolProfile();
8484

85-
vAgentPoolProfiles.Name = this.Name;
85+
vAgentPoolProfiles.Name = this.MyInvocation.BoundParameters.ContainsKey("Name") ? this.Name : null;
8686
vAgentPoolProfiles.Count = this.Count;
87-
vAgentPoolProfiles.VmSize = this.VmSize;
88-
vAgentPoolProfiles.DnsPrefix = this.DnsPrefix;
87+
vAgentPoolProfiles.VmSize = this.MyInvocation.BoundParameters.ContainsKey("VmSize") ? this.VmSize : null;
88+
vAgentPoolProfiles.DnsPrefix = this.MyInvocation.BoundParameters.ContainsKey("DnsPrefix") ? this.DnsPrefix : null;
8989
this.ContainerService.AgentPoolProfiles.Add(vAgentPoolProfiles);
9090
WriteObject(this.ContainerService);
9191
}

0 commit comments

Comments
 (0)