Skip to content

Commit 1853d89

Browse files
authored
Merge pull request #271 from cormacpayne/preview-update
Update preview branch with latest from public repo
2 parents 7adf751 + 66ddda2 commit 1853d89

File tree

15 files changed

+347
-70
lines changed

15 files changed

+347
-70
lines changed

build.proj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,8 @@
387387
<Output TaskParameter="AuthCodeSignTaskErrorsDetected" PropertyName="AuthTaskFailed" />
388388
</VerifyAuthenticodeSignatureTask>
389389

390-
<Exec Command="&quot;$(PowerShellCommand)&quot; -NonInteractive -NoLogo -NoProfile -Command &quot;. $(LibraryToolsFolder)\CheckStrongNameSignature.ps1 &quot;"/>
390+
<Exec Command="&quot;$(PowerShellCommand)&quot; -NonInteractive -NoLogo -NoProfile -Command &quot;. $(LibraryToolsFolder)\CheckSignature.ps1 -CustomPath $(LibrarySourceFolder)\Package\$(Configuration) &quot;"
391+
ContinueOnError="ErrorAndContinue" />
391392

392393
<!-- Copying signed shortcut back -->
393394
<Copy SourceFiles="$(LibrarySourceFolder)\Package\$(Configuration)\AzureRM.psd1"

setup/azurecmdfiles.wxi

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,9 +1556,6 @@
15561556
<Component Id="cmpC67F14F377421F1BCD74EC5A579D43CB" Guid="*">
15571557
<File Id="filE9553CEC1D67AB3D4B77759239D60B18" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.IotHub\Microsoft.Azure.Commands.IotHub.dll-Help.xml" />
15581558
</Component>
1559-
<Component Id="cmpD844DA64698210481D550B5CD8799D26" Guid="*">
1560-
<File Id="filA23D9B350E9B87D17B90B2181AE71E4B" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.IotHub\Microsoft.Azure.Commands.IotHub.format.ps1xml" />
1561-
</Component>
15621559
<Component Id="cmp31610C192ED2776279BBDA3D9905552E" Guid="*">
15631560
<File Id="filB571C170B96736E7EE17BBF869A203A8" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.IotHub\Microsoft.Azure.Commands.ResourceManager.Common.dll" />
15641561
</Component>
@@ -5842,7 +5839,6 @@
58425839
<ComponentRef Id="cmp9DFE8C2688F7DF1A3DFF20EFA59BF3B5" />
58435840
<ComponentRef Id="cmpE29D513714759F365A7C0A2A7F2B5DC6" />
58445841
<ComponentRef Id="cmpC67F14F377421F1BCD74EC5A579D43CB" />
5845-
<ComponentRef Id="cmpD844DA64698210481D550B5CD8799D26" />
58465842
<ComponentRef Id="cmp31610C192ED2776279BBDA3D9905552E" />
58475843
<ComponentRef Id="cmpB0A6B8E083FEAEC29D41F54189DC6605" />
58485844
<ComponentRef Id="cmpB2620706D83DB49D3434BB39A5495055" />

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,23 @@ function Test-VirtualMachineProfile
5757
$osDiskVhdUri = "https://$stoname.blob.core.windows.net/test/os.vhd";
5858
$dataDiskVhdUri1 = "https://$stoname.blob.core.windows.net/test/data1.vhd";
5959
$dataDiskVhdUri2 = "https://$stoname.blob.core.windows.net/test/data2.vhd";
60-
$dataDiskVhdUri3 = "https://$stoname.blob.core.windows.net/test/data3.vhd";
6160

6261
$p = Set-AzureRmVMOSDisk -VM $p -Name $osDiskName -VhdUri $osDiskVhdUri -Caching $osDiskCaching -CreateOption Empty;
6362

6463
$p = Add-AzureRmVMDataDisk -VM $p -Name 'testDataDisk1' -Caching 'ReadOnly' -DiskSizeInGB 10 -Lun 0 -VhdUri $dataDiskVhdUri1 -CreateOption Empty;
6564
$p = Add-AzureRmVMDataDisk -VM $p -Name 'testDataDisk2' -Caching 'ReadOnly' -DiskSizeInGB 11 -Lun 1 -VhdUri $dataDiskVhdUri2 -CreateOption Empty;
66-
$p = Add-AzureRmVMDataDisk -VM $p -Name 'testDataDisk3' -Caching 'ReadOnly' -DiskSizeInGB $null -Lun 2 -VhdUri $dataDiskVhdUri3 -CreateOption Empty;
65+
66+
# Managed data disk setting
67+
$managedDataDiskId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rggroup/providers/Microsoft.Compute/disks/dataDisk";
68+
$p = Add-AzureRmVMDataDisk -VM $p -Name 'testDataDisk3' -Caching 'ReadOnly' -DiskSizeInGB $null -Lun 2 -CreateOption Empty -ManagedDiskId $managedDataDiskId -StorageAccountType StandardLRS;
69+
Assert-AreEqual $managedDataDiskId $p.StorageProfile.DataDisks[2].ManagedDisk.Id;
70+
Assert-AreEqual "StandardLRS" $p.StorageProfile.DataDisks[2].ManagedDisk.StorageAccountType;
6771
Assert-Null $p.StorageProfile.DataDisks[2].DiskSizeGB;
72+
73+
$p = Set-AzureRmVMDataDisk -VM $p -Name 'testDataDisk3' -StorageAccountType PremiumLRS;
74+
Assert-AreEqual $managedDataDiskId $p.StorageProfile.DataDisks[2].ManagedDisk.Id;
75+
Assert-AreEqual "PremiumLRS" $p.StorageProfile.DataDisks[2].ManagedDisk.StorageAccountType;
76+
6877
$p = Remove-AzureRmVMDataDisk -VM $p -Name 'testDataDisk3';
6978

7079
Assert-AreEqual $p.StorageProfile.OSDisk.Caching $osDiskCaching;

src/ResourceManager/Compute/Commands.Compute/Common/ConstantStringTypes.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ public static class HelpMessages
4242
public const string VMDataDiskLun = "The virtual machine data disk's Lun.";
4343
public const string VMDataDiskCreateOption = "The virtual machine data disk's create option.";
4444

45+
public const string VMManagedDiskId = "The virtual machine managed disk's Id.";
46+
public const string VMManagedDiskAccountType = "The virtual machine managed disk's account type.";
47+
4548
public const string VMNetworkInterfaceName = "The virtual machine network interface's name.";
4649
public const string VMNetworkInterfaceID = "The virtual machine network interface's ID.";
4750
public const string VMPublicIPAddressName = "The virtual machine public IP address's name.";

src/ResourceManager/Compute/Commands.Compute/Properties/Resources.Designer.cs

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ResourceManager/Compute/Commands.Compute/Properties/Resources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,4 +565,7 @@ The file needs to be a PowerShell script (.ps1 or .psm1) or a ZIP archive (.zip)
565565
<data name="DiagnosticsExtensionMismatchStorageAccountName" xml:space="preserve">
566566
<value>Storage account names provided in public and private configs do not match.</value>
567567
</data>
568+
<data name="NotManagedDisk" xml:space="preserve">
569+
<value>The given disk is not a managed disk.</value>
570+
</data>
568571
</root>

src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Config/AddAzureVMDataDiskCommand.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,15 @@ public class AddAzureVMDataDiskCommand : Microsoft.Azure.Commands.ResourceManage
9393

9494
[Parameter(
9595
Position = 8,
96-
ValueFromPipelineByPropertyName = true)]
96+
ValueFromPipelineByPropertyName = true,
97+
HelpMessage = HelpMessages.VMManagedDiskId)]
9798
[ValidateNotNullOrEmpty]
9899
public string ManagedDiskId { get; set; }
99100

100101
[Parameter(
101102
Position = 9,
102-
ValueFromPipelineByPropertyName = true)]
103+
ValueFromPipelineByPropertyName = true,
104+
HelpMessage = HelpMessages.VMManagedDiskAccountType)]
103105
[ValidateNotNullOrEmpty]
104106
public StorageAccountTypes? StorageAccountType { get; set; }
105107

src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Config/SetAzureVMDataDiskCommand.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ public class SetAzureVMDataDiskCommand : Microsoft.Azure.Commands.ResourceManage
7575
[AllowNull]
7676
public int? DiskSizeInGB { get; set; }
7777

78+
[Parameter(
79+
Mandatory = false,
80+
ValueFromPipelineByPropertyName = true,
81+
HelpMessage = HelpMessages.VMManagedDiskAccountType)]
82+
[ValidateNotNullOrEmpty]
83+
public StorageAccountTypes? StorageAccountType { get; set; }
84+
7885
public override void ExecuteCmdlet()
7986
{
8087
var storageProfile = this.VM.StorageProfile;
@@ -102,6 +109,22 @@ public override void ExecuteCmdlet()
102109
{
103110
dataDisk.DiskSizeGB = this.DiskSizeInGB;
104111
}
112+
if (this.StorageAccountType != null)
113+
{
114+
if (dataDisk.ManagedDisk == null)
115+
{
116+
ThrowTerminatingError
117+
(new ErrorRecord(
118+
new InvalidOperationException(Properties.Resources.NotManagedDisk),
119+
string.Empty,
120+
ErrorCategory.InvalidData,
121+
null));
122+
}
123+
else
124+
{
125+
dataDisk.ManagedDisk.StorageAccountType = this.StorageAccountType;
126+
}
127+
}
105128
}
106129

107130
this.VM.StorageProfile = storageProfile;

src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Config/SetAzureVMOSDiskCommand.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,15 @@ public class SetAzureVMOSDiskCommand : Microsoft.Azure.Commands.ResourceManager.
172172

173173
[Parameter(
174174
Mandatory = false,
175-
ValueFromPipelineByPropertyName = true)]
175+
ValueFromPipelineByPropertyName = true,
176+
HelpMessage = HelpMessages.VMManagedDiskId)]
176177
[ValidateNotNullOrEmpty]
177178
public string ManagedDiskId { get; set; }
178179

179180
[Parameter(
180181
Mandatory = false,
181-
ValueFromPipelineByPropertyName = true)]
182+
ValueFromPipelineByPropertyName = true,
183+
HelpMessage = HelpMessages.VMManagedDiskAccountType)]
182184
[ValidateNotNullOrEmpty]
183185
public StorageAccountTypes? StorageAccountType { get; set; }
184186

src/ResourceManager/Compute/Commands.Compute/help/Set-AzureRMVMDataDisk.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ Modifies properties of a virtual machine data disk.
1515
### ChangeWithName
1616
```
1717
Set-AzureRmVMDataDisk [-VM] <PSVirtualMachine> [-Name] <String> [[-Caching] <CachingTypes>]
18-
[[-DiskSizeInGB] <Int32>] [<CommonParameters>]
18+
[[-DiskSizeInGB] <Int32>] [-StorageAccountType <StorageAccountTypes>] [<CommonParameters>]
1919
```
2020

2121
### ChangeWithLun
2222
```
2323
Set-AzureRmVMDataDisk [-VM] <PSVirtualMachine> [-Lun] <Int32> [[-Caching] <CachingTypes>]
24-
[[-DiskSizeInGB] <Int32>] [<CommonParameters>]
24+
[[-DiskSizeInGB] <Int32>] [-StorageAccountType <StorageAccountTypes>] [<CommonParameters>]
2525
```
2626

2727
## DESCRIPTION
@@ -114,6 +114,22 @@ Accept pipeline input: True (ByPropertyName)
114114
Accept wildcard characters: False
115115
```
116116
117+
### -StorageAccountType
118+
The virtual machine managed disk's account type.
119+
120+
```yaml
121+
Type: StorageAccountTypes
122+
Parameter Sets: (All)
123+
Aliases:
124+
Accepted values: StandardLRS, PremiumLRS
125+
126+
Required: False
127+
Position: Named
128+
Default value: None
129+
Accept pipeline input: True (ByPropertyName)
130+
Accept wildcard characters: False
131+
```
132+
117133
### -VM
118134
Specifies the virtual machine for which this cmdlet modifies a data disk.
119135
To obtain a virtual machine object, use the Get-AzureRmVM cmdlet.
@@ -136,7 +152,6 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
136152
## INPUTS
137153
138154
### PSVirtualMachine
139-
140155
Parameter 'VM' accepts value of type 'PSVirtualMachine' from the pipeline
141156
142157
## OUTPUTS

src/ServiceManagement/Common/Commands.ScenarioTest/Resources/ServiceManagement/ServiceManagementTests.ps1

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -817,10 +817,14 @@ function Test-MigrationAbortAzureStorageAccount
817817
Get-AzureStorageAccount -StorageAccountName $storageName;
818818

819819
Move-AzureStorageAccount -Prepare -StorageAccountName $storageName;
820-
Get-AzureStorageAccount -StorageAccountName $storageName;
820+
$result = Get-AzureStorageAccount -StorageAccountName $storageName;
821+
Assert-AreEqual "Prepared" $result.MigrationState;
822+
$resultOut = $result | Out-String;
821823

822824
Move-AzureStorageAccount -Abort -StorageAccountName $storageName;
823-
Get-AzureStorageAccount -StorageAccountName $storageName;
825+
$result = Get-AzureStorageAccount -StorageAccountName $storageName;
826+
Assert-Null $result.MigrationState;
827+
$resultOut = $result | Out-String;
824828

825829
# Cleanup
826830
Remove-AzureStorageAccount -StorageAccountName $storageName;
@@ -1039,53 +1043,53 @@ function Run-InitiateMaintenanceTest
10391043
# or 400 with error message like "User initiated maintenance on the virtual machine was
10401044
# successfully completed". Both are expected reponses.
10411045
# To continue script, $ErrorActionPreference should be set to 'SilentlyContinue'.
1042-
$tempErrorActionPreference = $ErrorActionPreference;
1046+
$tempErrorActionPreference = $ErrorActionPreference;
10431047
$ErrorActionPreference = 'SilentlyContinue';
1044-
1045-
# Setup
1046-
$location = "Central US EUAP";
1047-
$imgName = Get-DefaultImage $location;
1048+
1049+
# Setup
1050+
$location = "Central US EUAP";
1051+
$imgName = Get-DefaultImage $location;
10481052

1049-
$storageName = 'pstest' + (getAssetName);
1050-
New-AzureStorageAccount -StorageAccountName $storageName -Location $location;
1053+
$storageName = 'pstest' + (getAssetName);
1054+
New-AzureStorageAccount -StorageAccountName $storageName -Location $location;
10511055

1052-
# Associate the new storage account with the current subscription
1053-
Set-CurrentStorageAccountName $storageName;
1056+
# Associate the new storage account with the current subscription
1057+
Set-CurrentStorageAccountName $storageName;
10541058

1055-
$vmName = "psvm01";
1056-
$svcName = 'pstest' + (Get-CloudServiceName);
1057-
$userName = "pstestuser";
1058-
$password = $PLACEHOLDER;
1059+
$vmName = "psvm01";
1060+
$svcName = 'pstest' + (Get-CloudServiceName);
1061+
$userName = "pstestuser";
1062+
$password = $PLACEHOLDER;
10591063

1060-
# Test
1061-
New-AzureService -ServiceName $svcName -Location $location;
1064+
# Test
1065+
New-AzureService -ServiceName $svcName -Location $location;
10621066

1063-
try
1064-
{
1065-
New-AzureQuickVM -Windows -ImageName $imgName -Name $vmName -ServiceName $svcName -AdminUsername $userName -Password $password;
1067+
try
1068+
{
1069+
New-AzureQuickVM -Windows -ImageName $imgName -Name $vmName -ServiceName $svcName -AdminUsername $userName -Password $password;
10661070
#Start-Sleep -s 300; #Uncomment this line for record mode testing.
10671071

1068-
# Get VM
1069-
$vm = Get-AzureVM -ServiceName $svcName -Name $vmName;
1070-
Assert-NotNull $vm;
1071-
Assert-NotNull $vm.MaintenanceStatus;
1072+
# Get VM
1073+
$vm = Get-AzureVM -ServiceName $svcName -Name $vmName;
1074+
Assert-NotNull $vm;
1075+
Assert-NotNull $vm.MaintenanceStatus;
10721076

1073-
# Test Initiate Maintenance
1074-
$result = Restart-AzureVM -InitiateMaintenance -ServiceName $svcName -Name $vmName;
1077+
# Test Initiate Maintenance
1078+
$result = Restart-AzureVM -InitiateMaintenance -ServiceName $svcName -Name $vmName;
10751079

1076-
$vm = Get-AzureVM -ServiceName $svcName -Name $vmName
1077-
Assert-NotNull $vm.MaintenanceStatus;
1080+
$vm = Get-AzureVM -ServiceName $svcName -Name $vmName
1081+
Assert-NotNull $vm.MaintenanceStatus;
10781082
}
10791083
catch
10801084
{
1081-
Assert-True {$result.Result.Contains("User initiated maintenance on the Virtual Machine was successfully completed.")};
1085+
Assert-True {$result.Result.Contains("User initiated maintenance on the Virtual Machine was successfully completed.")};
10821086
$vm = Get-AzureVM -ServiceName $svcName -Name $vmName
10831087
Assert-NotNull $vm.MaintenanceStatus;
1084-
}
1085-
finally
1086-
{
1087-
# Cleanup
1088-
Cleanup-CloudService $srcName;
1089-
$ErrorActionPreference = $tempErrorActionPreference;
1090-
}
1088+
}
1089+
finally
1090+
{
1091+
# Cleanup
1092+
Cleanup-CloudService $srcName;
1093+
$ErrorActionPreference = $tempErrorActionPreference;
1094+
}
10911095
}

src/ServiceManagement/Compute/Commands.ServiceManagement/Model/PSStorageService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ protected PSStorageService(StorageServicePropertiesOperationContext account, Azu
5858
}
5959

6060
this.Endpoints = endpointList;
61+
this.MigrationState = account.MigrationState;
6162
}
6263

6364
public static PSStorageService Create(StorageManagementClient client,

0 commit comments

Comments
 (0)