Skip to content

Commit 2b763f9

Browse files
authored
Merge branch 'preview' into feature/aks
2 parents b0d4ea1 + 1014bb2 commit 2b763f9

File tree

7 files changed

+84
-56
lines changed

7 files changed

+84
-56
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,23 @@ function Test-VirtualMachineProfile
106106
Assert-AreEqual $p.StorageProfile.DataDisks[1].Lun 1;
107107
Assert-AreEqual $p.StorageProfile.DataDisks[1].Vhd.Uri $dataDiskVhdUri2;
108108

109+
$managedOsDiskId_0 = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rggroup/providers/Microsoft.Compute/disks/osDisk0";
110+
$managedOsDiskId_1 = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rggroup/providers/Microsoft.Compute/disks/osDisk1";
111+
112+
$p = Set-AzureRmVMOsDisk -VM $p -ManagedDiskId $managedOsDiskId_0 -StorageAccountType StandardLRS;
113+
Assert-AreEqual $osDiskCaching $p.StorageProfile.OSDisk.Caching;
114+
Assert-AreEqual $osDiskName $p.StorageProfile.OSDisk.Name;
115+
Assert-AreEqual $p.StorageProfile.OSDisk.Vhd.Uri $osDiskVhdUri;
116+
Assert-AreEqual $managedOsDiskId_0 $p.StorageProfile.OSDisk.ManagedDisk.Id;
117+
Assert-AreEqual 'StandardLRS' $p.StorageProfile.OSDisk.ManagedDisk.StorageAccountType;
118+
119+
$p = Set-AzureRmVMOsDisk -VM $p -ManagedDiskId $managedOsDiskId_1;
120+
Assert-AreEqual $p.StorageProfile.OSDisk.Caching $osDiskCaching;
121+
Assert-AreEqual $p.StorageProfile.OSDisk.Name $osDiskName;
122+
Assert-AreEqual $p.StorageProfile.OSDisk.Vhd.Uri $osDiskVhdUri;
123+
Assert-AreEqual $managedOsDiskId_1 $p.StorageProfile.OSDisk.ManagedDisk.Id;
124+
Assert-AreEqual 'StandardLRS' $p.StorageProfile.OSDisk.ManagedDisk.StorageAccountType;
125+
109126
# Windows OS
110127
$user = "Foo12";
111128
$password = $PLACEHOLDER;

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

Lines changed: 50 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ public class SetAzureVMOSDiskCommand : Microsoft.Azure.Commands.ResourceManager.
3939
Mandatory = true,
4040
Position = 0,
4141
ValueFromPipeline = true,
42-
ValueFromPipelineByPropertyName = true,
4342
HelpMessage = HelpMessages.VMProfile)]
4443
[ValidateNotNullOrEmpty]
4544
public PSVirtualMachine VM { get; set; }
@@ -48,7 +47,6 @@ public class SetAzureVMOSDiskCommand : Microsoft.Azure.Commands.ResourceManager.
4847
[Parameter(
4948
Mandatory = false,
5049
Position = 1,
51-
ValueFromPipelineByPropertyName = true,
5250
HelpMessage = HelpMessages.VMOSDiskName)]
5351
[ValidateNotNullOrEmpty]
5452
public string Name { get; set; }
@@ -57,129 +55,110 @@ public class SetAzureVMOSDiskCommand : Microsoft.Azure.Commands.ResourceManager.
5755
[Parameter(
5856
Mandatory = false,
5957
Position = 2,
60-
ValueFromPipelineByPropertyName = true,
6158
HelpMessage = HelpMessages.VMOSDiskVhdUri)]
6259
[ValidateNotNullOrEmpty]
6360
public string VhdUri { get; set; }
6461

6562
[Parameter(
6663
Position = 3,
67-
ValueFromPipelineByPropertyName = true,
6864
HelpMessage = HelpMessages.VMOSDiskCaching)]
6965
public CachingTypes? Caching { get; set; }
7066

7167
[Alias("SourceImage")]
7268
[Parameter(
7369
Position = 4,
74-
ValueFromPipelineByPropertyName = true,
7570
HelpMessage = HelpMessages.VMSourceImageUri)]
7671
[ValidateNotNullOrEmpty]
7772
public string SourceImageUri { get; set; }
7873

7974
[Parameter(
80-
Mandatory = true,
75+
Mandatory = false,
8176
Position = 5,
82-
ValueFromPipelineByPropertyName = true,
8377
HelpMessage = HelpMessages.VMDataDiskCreateOption)]
8478
public DiskCreateOptionTypes CreateOption { get; set; }
8579

8680
[Parameter(
8781
ParameterSetName = WindowsParamSet,
8882
Position = 6,
89-
ValueFromPipelineByPropertyName = true,
9083
HelpMessage = HelpMessages.VMOSDiskWindowsOSType)]
9184
[Parameter(
9285
ParameterSetName = WindowsAndDiskEncryptionParameterSet,
9386
Position = 6,
94-
ValueFromPipelineByPropertyName = true,
9587
HelpMessage = HelpMessages.VMOSDiskWindowsOSType)]
9688
public SwitchParameter Windows { get; set; }
9789

9890
[Parameter(
9991
ParameterSetName = LinuxParamSet,
10092
Position = 6,
101-
ValueFromPipelineByPropertyName = true,
10293
HelpMessage = HelpMessages.VMOSDiskLinuxOSType)]
10394
[Parameter(
10495
ParameterSetName = LinuxAndDiskEncryptionParameterSet,
10596
Position = 6,
106-
ValueFromPipelineByPropertyName = true,
10797
HelpMessage = HelpMessages.VMOSDiskLinuxOSType)]
10898
public SwitchParameter Linux { get; set; }
10999

110100
[Parameter(
111101
ParameterSetName = WindowsAndDiskEncryptionParameterSet,
112102
Mandatory = true,
113103
Position = 7,
114-
ValueFromPipelineByPropertyName = true,
115104
HelpMessage = HelpMessages.VMOSDiskDiskEncryptionKeyUrl)]
116105
[Parameter(
117106
ParameterSetName = LinuxAndDiskEncryptionParameterSet,
118107
Mandatory = true,
119108
Position = 7,
120-
ValueFromPipelineByPropertyName = true,
121109
HelpMessage = HelpMessages.VMOSDiskDiskEncryptionKeyUrl)]
122110
public string DiskEncryptionKeyUrl { get; set; }
123111

124112
[Parameter(
125113
ParameterSetName = WindowsAndDiskEncryptionParameterSet,
126114
Mandatory = true,
127115
Position = 8,
128-
ValueFromPipelineByPropertyName = true,
129116
HelpMessage = HelpMessages.VMOSDiskDiskEncryptionKeyVaultId)]
130117
[Parameter(
131118
ParameterSetName = LinuxAndDiskEncryptionParameterSet,
132119
Mandatory = true,
133120
Position = 8,
134-
ValueFromPipelineByPropertyName = true,
135121
HelpMessage = HelpMessages.VMOSDiskDiskEncryptionKeyVaultId)]
136122
public string DiskEncryptionKeyVaultId { get; set; }
137123

138124
[Parameter(
139125
ParameterSetName = WindowsAndDiskEncryptionParameterSet,
140126
Mandatory = false,
141127
Position = 9,
142-
ValueFromPipelineByPropertyName = true,
143128
HelpMessage = HelpMessages.VMOSDiskKeyEncryptionKeyUrl)]
144129
[Parameter(
145130
ParameterSetName = LinuxAndDiskEncryptionParameterSet,
146131
Mandatory = false,
147132
Position = 9,
148-
ValueFromPipelineByPropertyName = true,
149133
HelpMessage = HelpMessages.VMOSDiskKeyEncryptionKeyUrl)]
150134
public string KeyEncryptionKeyUrl { get; set; }
151135

152136
[Parameter(
153137
ParameterSetName = WindowsAndDiskEncryptionParameterSet,
154138
Mandatory = false,
155139
Position = 10,
156-
ValueFromPipelineByPropertyName = true,
157140
HelpMessage = HelpMessages.VMOSDiskKeyEncryptionKeyVaultId)]
158141
[Parameter(
159142
ParameterSetName = LinuxAndDiskEncryptionParameterSet,
160143
Mandatory = false,
161144
Position = 10,
162-
ValueFromPipelineByPropertyName = true,
163145
HelpMessage = HelpMessages.VMOSDiskKeyEncryptionKeyVaultId)]
164146
public string KeyEncryptionKeyVaultId { get; set; }
165147

166148
[Parameter(
167149
Mandatory = false,
168-
ValueFromPipelineByPropertyName = true,
169150
HelpMessage = HelpMessages.VMOSDiskSizeInGB)]
170151
[AllowNull]
171152
public int? DiskSizeInGB { get; set; }
172153

173154
[Parameter(
174155
Mandatory = false,
175-
ValueFromPipelineByPropertyName = true,
176156
HelpMessage = HelpMessages.VMManagedDiskId)]
177157
[ValidateNotNullOrEmpty]
178158
public string ManagedDiskId { get; set; }
179159

180160
[Parameter(
181161
Mandatory = false,
182-
ValueFromPipelineByPropertyName = true,
183162
HelpMessage = HelpMessages.VMManagedDiskAccountType)]
184163
[ValidateNotNullOrEmpty]
185164
public StorageAccountTypes? StorageAccountType { get; set; }
@@ -199,24 +178,48 @@ public override void ExecuteCmdlet()
199178
string.Empty, ErrorCategory.InvalidArgument, null));
200179
}
201180

202-
this.VM.StorageProfile.OsDisk = new OSDisk
181+
if (this.VM.StorageProfile.OsDisk == null)
203182
{
204-
Caching = this.Caching,
205-
Name = this.Name,
206-
OsType = this.Windows.IsPresent ? OperatingSystemTypes.Windows : this.Linux.IsPresent ? OperatingSystemTypes.Linux : (OperatingSystemTypes?)null,
207-
Vhd = string.IsNullOrEmpty(this.VhdUri) ? null : new VirtualHardDisk
183+
this.VM.StorageProfile.OsDisk = new OSDisk();
184+
}
185+
186+
this.VM.StorageProfile.OsDisk.Name = this.Name ?? this.VM.StorageProfile.OsDisk.Name;
187+
this.VM.StorageProfile.OsDisk.Caching = this.Caching ?? this.VM.StorageProfile.OsDisk.Caching;
188+
this.VM.StorageProfile.OsDisk.DiskSizeGB = this.DiskSizeInGB ?? this.VM.StorageProfile.OsDisk.DiskSizeGB;
189+
190+
if (this.Windows.IsPresent)
191+
{
192+
this.VM.StorageProfile.OsDisk.OsType = OperatingSystemTypes.Windows;
193+
}
194+
else if (this.Linux.IsPresent)
195+
{
196+
this.VM.StorageProfile.OsDisk.OsType = OperatingSystemTypes.Linux;
197+
}
198+
199+
if (!string.IsNullOrEmpty(this.VhdUri))
200+
{
201+
this.VM.StorageProfile.OsDisk.Vhd = new VirtualHardDisk
208202
{
209203
Uri = this.VhdUri
210-
},
211-
DiskSizeGB = this.DiskSizeInGB,
212-
Image = string.IsNullOrEmpty(this.SourceImageUri) ? null : new VirtualHardDisk
204+
};
205+
}
206+
207+
if (!string.IsNullOrEmpty(this.SourceImageUri))
208+
{
209+
this.VM.StorageProfile.OsDisk.Image = new VirtualHardDisk
213210
{
214211
Uri = this.SourceImageUri
215-
},
216-
CreateOption = this.CreateOption,
217-
EncryptionSettings =
218-
(this.ParameterSetName.Equals(WindowsAndDiskEncryptionParameterSet) || this.ParameterSetName.Equals(LinuxAndDiskEncryptionParameterSet))
219-
? new DiskEncryptionSettings
212+
};
213+
}
214+
215+
if (this.MyInvocation.BoundParameters.ContainsKey("CreateOption"))
216+
{
217+
this.VM.StorageProfile.OsDisk.CreateOption = this.CreateOption;
218+
}
219+
220+
if (this.ParameterSetName.Equals(WindowsAndDiskEncryptionParameterSet) || this.ParameterSetName.Equals(LinuxAndDiskEncryptionParameterSet))
221+
{
222+
this.VM.StorageProfile.OsDisk.EncryptionSettings = new DiskEncryptionSettings
220223
{
221224
DiskEncryptionKey = new KeyVaultSecretReference
222225
{
@@ -236,16 +239,19 @@ public override void ExecuteCmdlet()
236239
Id = this.KeyEncryptionKeyVaultId
237240
},
238241
}
242+
};
243+
}
244+
245+
if (!string.IsNullOrEmpty(this.ManagedDiskId) || this.StorageAccountType != null)
246+
{
247+
if (this.VM.StorageProfile.OsDisk.ManagedDisk == null)
248+
{
249+
this.VM.StorageProfile.OsDisk.ManagedDisk = new ManagedDiskParameters();
239250
}
240-
: null,
241-
ManagedDisk = (this.ManagedDiskId == null && this.StorageAccountType == null)
242-
? null
243-
: new ManagedDiskParameters
244-
{
245-
Id = this.ManagedDiskId,
246-
StorageAccountType = this.StorageAccountType
247-
}
248-
};
251+
252+
this.VM.StorageProfile.OsDisk.ManagedDisk.Id = this.ManagedDiskId ?? this.VM.StorageProfile.OsDisk.ManagedDisk.Id;
253+
this.VM.StorageProfile.OsDisk.ManagedDisk.StorageAccountType = this.StorageAccountType ?? this.VM.StorageProfile.OsDisk.ManagedDisk.StorageAccountType;
254+
}
249255

250256
WriteObject(this.VM);
251257
}

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@ Sets the operating system disk properties on a virtual machine.
1616
### DefaultParamSet (Default)
1717
```
1818
Set-AzureRmVMOSDisk [-VM] <PSVirtualMachine> [[-Name] <String>] [[-VhdUri] <String>]
19-
[[-Caching] <CachingTypes>] [[-SourceImageUri] <String>] [-CreateOption] <DiskCreateOptionTypes>
19+
[[-Caching] <CachingTypes>] [[-SourceImageUri] <String>] [[-CreateOption] <DiskCreateOptionTypes>]
2020
[-DiskSizeInGB <Int32>] [-ManagedDiskId <String>] [-StorageAccountType <StorageAccountTypes>]
2121
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
2222
```
2323

2424
### WindowsParamSet
2525
```
2626
Set-AzureRmVMOSDisk [-VM] <PSVirtualMachine> [[-Name] <String>] [[-VhdUri] <String>]
27-
[[-Caching] <CachingTypes>] [[-SourceImageUri] <String>] [-CreateOption] <DiskCreateOptionTypes> [-Windows]
27+
[[-Caching] <CachingTypes>] [[-SourceImageUri] <String>] [[-CreateOption] <DiskCreateOptionTypes>] [-Windows]
2828
[-DiskSizeInGB <Int32>] [-ManagedDiskId <String>] [-StorageAccountType <StorageAccountTypes>]
2929
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
3030
```
3131

3232
### WindowsDiskEncryptionParameterSet
3333
```
3434
Set-AzureRmVMOSDisk [-VM] <PSVirtualMachine> [[-Name] <String>] [[-VhdUri] <String>]
35-
[[-Caching] <CachingTypes>] [[-SourceImageUri] <String>] [-CreateOption] <DiskCreateOptionTypes> [-Windows]
35+
[[-Caching] <CachingTypes>] [[-SourceImageUri] <String>] [[-CreateOption] <DiskCreateOptionTypes>] [-Windows]
3636
[-DiskEncryptionKeyUrl] <String> [-DiskEncryptionKeyVaultId] <String> [[-KeyEncryptionKeyUrl] <String>]
3737
[[-KeyEncryptionKeyVaultId] <String>] [-DiskSizeInGB <Int32>] [-ManagedDiskId <String>]
3838
[-StorageAccountType <StorageAccountTypes>] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
@@ -41,15 +41,15 @@ Set-AzureRmVMOSDisk [-VM] <PSVirtualMachine> [[-Name] <String>] [[-VhdUri] <Stri
4141
### LinuxParamSet
4242
```
4343
Set-AzureRmVMOSDisk [-VM] <PSVirtualMachine> [[-Name] <String>] [[-VhdUri] <String>]
44-
[[-Caching] <CachingTypes>] [[-SourceImageUri] <String>] [-CreateOption] <DiskCreateOptionTypes> [-Linux]
44+
[[-Caching] <CachingTypes>] [[-SourceImageUri] <String>] [[-CreateOption] <DiskCreateOptionTypes>] [-Linux]
4545
[-DiskSizeInGB <Int32>] [-ManagedDiskId <String>] [-StorageAccountType <StorageAccountTypes>]
4646
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
4747
```
4848

4949
### LinuxDiskEncryptionParameterSet
5050
```
5151
Set-AzureRmVMOSDisk [-VM] <PSVirtualMachine> [[-Name] <String>] [[-VhdUri] <String>]
52-
[[-Caching] <CachingTypes>] [[-SourceImageUri] <String>] [-CreateOption] <DiskCreateOptionTypes> [-Linux]
52+
[[-Caching] <CachingTypes>] [[-SourceImageUri] <String>] [[-CreateOption] <DiskCreateOptionTypes>] [-Linux]
5353
[-DiskEncryptionKeyUrl] <String> [-DiskEncryptionKeyVaultId] <String> [[-KeyEncryptionKeyUrl] <String>]
5454
[[-KeyEncryptionKeyVaultId] <String>] [-DiskSizeInGB <Int32>] [-ManagedDiskId <String>]
5555
[-StorageAccountType <StorageAccountTypes>] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
@@ -164,7 +164,7 @@ Parameter Sets: (All)
164164
Aliases:
165165
Accepted values: FromImage, Empty, Attach
166166

167-
Required: True
167+
Required: False
168168
Position: 5
169169
Default value: None
170170
Accept pipeline input: True (ByPropertyName)
@@ -303,7 +303,7 @@ Aliases: OSDiskName, DiskName
303303
Required: False
304304
Position: 1
305305
Default value: None
306-
Accept pipeline input: True (ByPropertyName)
306+
Accept pipeline input: False
307307
Accept wildcard characters: False
308308
```
309309

src/ResourceManager/IotHub/Commands.IotHub.Test/Commands.IotHub.Test.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll</HintPath>
4444
</Reference>
4545
<Reference Include="Microsoft.Azure.Management.EventHub, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
46-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.EventHub.2.0.0\lib\net452\Microsoft.Azure.Management.EventHub.dll</HintPath>
46+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.EventHub.2.0.3\lib\net452\Microsoft.Azure.Management.EventHub.dll</HintPath>
4747
<Private>True</Private>
4848
</Reference>
4949
<Reference Include="Microsoft.Azure.Common.NetFramework">
@@ -244,4 +244,4 @@
244244
<Target Name="AfterBuild">
245245
</Target>
246246
-->
247-
</Project>
247+
</Project>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
55
<package id="Microsoft.Azure.Gallery" version="2.6.2-preview" targetFramework="net45" />
66
<package id="Microsoft.Azure.Management.Authorization" version="2.0.0" targetFramework="net45" />
7-
<package id="Microsoft.Azure.Management.EventHub" version="2.0.0" targetFramework="net452" />
7+
<package id="Microsoft.Azure.Management.EventHub" version="2.0.3" targetFramework="net452" />
88
<package id="Microsoft.Azure.Management.IotHub" version="1.1.3" targetFramework="net452" />
99
<package id="Microsoft.Azure.Management.Resources" version="2.20.0-preview" targetFramework="net45" />
1010
<package id="Microsoft.Azure.Test.Framework" version="1.0.6179.26854-prerelease" targetFramework="net45" />
@@ -28,4 +28,4 @@
2828
<package id="xunit.extensibility.core" version="2.1.0" targetFramework="net45" />
2929
<package id="xunit.extensibility.execution" version="2.1.0" targetFramework="net45" />
3030
<package id="xunit.runner.visualstudio" version="2.1.0" targetFramework="net45" />
31-
</packages>
31+
</packages>

src/ResourceManager/Sql/Commands.Sql/help/New-AzureRmSqlDatabaseCopy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ Accept wildcard characters: False
143143
```
144144
145145
### -ResourceGroupName
146-
Specifies the name of the Resource Group to which this cmdlet assigns the copied database.
146+
Specifies the name of the Resource Group that contains the database to copy.
147147
148148
```yaml
149149
Type: String

0 commit comments

Comments
 (0)