Skip to content

Commit 7072f46

Browse files
committed
Merge branch 'preview' into common-stack
2 parents 45d5e33 + b141f3a commit 7072f46

File tree

423 files changed

+58241
-23424
lines changed

Some content is hidden

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

423 files changed

+58241
-23424
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ If this issue is not a bug report, please remove the below template
2828

2929
### Module Version
3030

31-
<!-- Please run (Get-Module -Name AzureRM -ListAvailable) to get the version(s) of AzureRM installed on your machine -->
31+
<!-- Please run (Get-Module -ListAvailable) to get the version(s) of all modules, including Azure installed on your machine -->
3232

3333
```powershell
34-
Get-Module -Name AzureRM -ListAvailable
34+
Get-Module -ListAvailable
3535
```
3636

3737
### Environment Data
@@ -44,7 +44,7 @@ $PSVersionTable
4444

4545
### Debug Output
4646

47-
<!-- Please run the above script with $DebugPreference = "Continue" and paste the resulting debug stream in the below code block -->
47+
<!-- Please run the above script with $DebugPreference='Continue' and paste the resulting debug stream in the below code block -->
4848

4949
```
5050

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
sudo: required
22
language: csharp
33
mono: none
4-
dotnet: 2.1.302
4+
dotnet: 2.1.400
55
dist: trusty
66

77
env:
@@ -19,7 +19,6 @@ before_install:
1919
- sudo dpkg -i packages-microsoft-prod.deb
2020
- sudo apt-get install apt-transport-https
2121
- sudo apt-get update
22-
- sudo apt-get install dotnet-sdk-2.1
2322
- sudo apt-get install -y powershell
2423
- sudo pwsh -NonInteractive -NoLogo -NoProfile -Command "Install-Module platyPS -Force -Confirm:\$false -Scope CurrentUser"
2524

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ function Test-VirtualMachineProfile
133133
Assert-AreEqual $p.StorageProfile.OSDisk.Name $osDiskName;
134134
Assert-AreEqual $p.StorageProfile.OSDisk.Vhd.Uri $osDiskVhdUri;
135135
Assert-AreEqual $managedOsDiskId_1 $p.StorageProfile.OSDisk.ManagedDisk.Id;
136-
Assert-AreEqual "Standard_LRS" $p.StorageProfile.OSDisk.ManagedDisk.StorageAccountType;
136+
Assert-Null $p.StorageProfile.OSDisk.ManagedDisk.StorageAccountType;
137137
Assert-AreEqual $false $p.StorageProfile.OSDisk.WriteAcceleratorEnabled;
138138

139139
# Windows OS

src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineTests.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,5 +384,17 @@ public void TestVirtualMachineWriteAcceleratorUpdate()
384384
{
385385
ComputeTestController.NewInstance.RunPsTest(_logger, "Test-VirtualMachineWriteAcceleratorUpdate");
386386
}
387+
388+
#if NETSTANDARD
389+
[Fact(Skip = "Updated Storage, needs re-recorded")]
390+
[Trait(Category.RunType, Category.DesktopOnly)]
391+
#else
392+
[Fact]
393+
#endif
394+
[Trait(Category.AcceptanceType, Category.CheckIn)]
395+
public void TestVirtualMachineManagedDisk()
396+
{
397+
ComputeTestController.NewInstance.RunPsTest(_logger, "Test-VirtualMachineManagedDisk");
398+
}
387399
}
388400
}

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

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3308,11 +3308,142 @@ function Test-VirtualMachineWriteAcceleratorUpdate
33083308
$st = $vm1 | Update-AzureRmVM -OsDiskWriteAccelerator $true; } `
33093309
"not supported on disks with Write Accelerator enabled";
33103310

3311+
$output = $error | Out-String;
3312+
Assert-True {$output.Contains("Target");}
3313+
33113314
$st = $vm1 | Update-AzureRmVM -OsDiskWriteAccelerator $false;
33123315
}
33133316
finally
33143317
{
33153318
# Cleanup
33163319
Clean-ResourceGroup $rgname
33173320
}
3321+
}
3322+
3323+
function Test-VirtualMachineManagedDisk
3324+
{
3325+
# Setup
3326+
$rgname = Get-ComputeTestResourceName
3327+
3328+
try
3329+
{
3330+
$loc = Get-ComputeVMLocation;
3331+
New-AzureRmResourceGroup -Name $rgname -Location $loc -Force;
3332+
3333+
# VM Profile & Hardware
3334+
$vmsize = 'Standard_DS1';
3335+
$vmname = 'vm' + $rgname;
3336+
3337+
$p = New-AzureRmVMConfig -VMName $vmname -VMSize $vmsize;
3338+
3339+
# NRP
3340+
$subnet = New-AzureRmVirtualNetworkSubnetConfig -Name ('subnet' + $rgname) -AddressPrefix "10.0.0.0/24";
3341+
$vnet = New-AzureRmVirtualNetwork -Force -Name ('vnet' + $rgname) -ResourceGroupName $rgname -Location $loc -AddressPrefix "10.0.0.0/16" -Subnet $subnet;
3342+
$vnet = Get-AzureRmVirtualNetwork -Name ('vnet' + $rgname) -ResourceGroupName $rgname;
3343+
$subnetId = $vnet.Subnets[0].Id;
3344+
$pubip = New-AzureRmPublicIpAddress -Force -Name ('pubip' + $rgname) -ResourceGroupName $rgname -Location $loc -AllocationMethod Dynamic -DomainNameLabel ('pubip' + $rgname);
3345+
$pubip = Get-AzureRmPublicIpAddress -Name ('pubip' + $rgname) -ResourceGroupName $rgname;
3346+
$pubipId = $pubip.Id;
3347+
$nic = New-AzureRmNetworkInterface -Force -Name ('nic' + $rgname) -ResourceGroupName $rgname -Location $loc -SubnetId $subnetId -PublicIpAddressId $pubip.Id;
3348+
$nic = Get-AzureRmNetworkInterface -Name ('nic' + $rgname) -ResourceGroupName $rgname;
3349+
$nicId = $nic.Id;
3350+
3351+
$p = Add-AzureRmVMNetworkInterface -VM $p -Id $nicId;
3352+
3353+
# OS & Image
3354+
$user = "Foo2";
3355+
$password = $PLACEHOLDER;
3356+
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force;
3357+
$cred = New-Object System.Management.Automation.PSCredential ($user, $securePassword);
3358+
$computerName = 'test';
3359+
3360+
$p = Set-AzureRmVMOperatingSystem -VM $p -Windows -ComputerName $computerName -Credential $cred;
3361+
3362+
$imgRef = Get-DefaultCRPImage -loc $loc;
3363+
$p = ($imgRef | Set-AzureRmVMSourceImage -VM $p);
3364+
3365+
# Virtual Machine
3366+
New-AzureRmVM -ResourceGroupName $rgname -Location $loc -VM $p;
3367+
3368+
# Get VM
3369+
$vm = Get-AzureRmVM -Name $vmname -ResourceGroupName $rgname;
3370+
3371+
Assert-NotNull $vm.StorageProfile.OsDisk.ManagedDisk.Id;
3372+
Assert-AreEqual 'Premium_LRS' $vm.StorageProfile.OsDisk.ManagedDisk.StorageAccountType;
3373+
3374+
# Create OS snapshot from the VM
3375+
$snapshotConfig = New-AzureRmSnapshotConfig -SourceUri $vm.Storageprofile.OsDisk.ManagedDisk.Id -Location $loc -CreateOption Copy;
3376+
$snapshotname = "ossnapshot";
3377+
New-AzureRmSnapshot -Snapshot $snapshotConfig -SnapshotName $snapshotname -ResourceGroupName $rgname;
3378+
$snapshot = Get-AzureRmSnapshot -SnapshotName $snapshotname -ResourceGroupName $rgname;
3379+
3380+
Assert-NotNull $snapshot.Id;
3381+
Assert-AreEqual $snapshotname $snapshot.Name;
3382+
Assert-AreEqual 'Standard_LRS' $snapshot.Sku.Name;
3383+
3384+
# Create an OS disk from the snapshot
3385+
$osdiskConfig = New-AzureRmDiskConfig -Location $loc -CreateOption Copy -SourceUri $snapshot.Id;
3386+
$osdiskname = "osdisk";
3387+
New-AzureRmDisk -ResourceGroupName $rgname -DiskName $osdiskname -Disk $osdiskConfig;
3388+
$osdisk = Get-AzureRmDisk -ResourceGroupName $rgname -DiskName $osdiskname;
3389+
3390+
Assert-NotNull $osdisk.Id;
3391+
Assert-AreEqual $osdiskname $osdisk.Name;
3392+
Assert-AreEqual 'Standard_LRS' $osdisk.Sku.Name;
3393+
3394+
# Stop the VM
3395+
Stop-AzureRmVM -ResourceGroupName $rgname -Name $vmname -Force;
3396+
3397+
# Change the OS disk of the VM
3398+
$vm = Set-AzureRmVMOSDisk -VM $vm -Name $osdiskname -ManagedDiskId $osdisk.Id;
3399+
3400+
# Create an empty disk
3401+
$datadiskconfig = New-AzureRmDiskConfig -Location $loc -CreateOption Empty -AccountType 'Standard_LRS' -DiskSizeGB 10;
3402+
$datadiskname = "datadisk";
3403+
New-AzureRmDisk -ResourceGroupName $rgname -DiskName $datadiskname -Disk $datadiskconfig;
3404+
$datadisk = Get-AzureRmDisk -ResourceGroupName $rgname -DiskName $datadiskname;
3405+
3406+
Assert-NotNull $datadisk.Id;
3407+
Assert-AreEqual $datadiskname $datadisk.Name;
3408+
Assert-AreEqual 'Standard_LRS' $datadisk.Sku.Name;
3409+
3410+
# Add the disk to the VM
3411+
$vm = Add-AzureRmVMDataDisk -VM $vm -Name $datadiskname -ManagedDiskId $dataDisk.Id -Lun 2 -CreateOption Attach -Caching 'ReadWrite';
3412+
3413+
# Update and start the VM
3414+
Update-AzureRmVM -ResourceGroupName $rgname -VM $vm;
3415+
Start-AzureRmVM -ResourceGroupName $rgname -Name $vmname;
3416+
3417+
# Get the updated VM
3418+
$vm = Get-AzureRmVM -ResourceGroupName $rgname -Name $vmname;
3419+
3420+
Assert-NotNull $vm.VmId;
3421+
Assert-AreEqual $vmname $vm.Name ;
3422+
Assert-AreEqual 1 $vm.NetworkProfile.NetworkInterfaces.Count;
3423+
Assert-AreEqual $nicId $vm.NetworkProfile.NetworkInterfaces[0].Id;
3424+
3425+
Assert-AreEqual $imgRef.Offer $vm.StorageProfile.ImageReference.Offer;
3426+
Assert-AreEqual $imgRef.PublisherName $vm.StorageProfile.ImageReference.Publisher;
3427+
Assert-AreEqual $imgRef.Skus $vm.StorageProfile.ImageReference.Sku;
3428+
Assert-AreEqual $imgRef.Version $vm.StorageProfile.ImageReference.Version;
3429+
3430+
Assert-AreEqual $user $vm.OSProfile.AdminUsername;
3431+
Assert-AreEqual $computerName $vm.OSProfile.ComputerName;
3432+
Assert-AreEqual $vmsize $vm.HardwareProfile.VmSize;
3433+
3434+
Assert-True {$vm.DiagnosticsProfile.BootDiagnostics.Enabled;};
3435+
3436+
Assert-AreEqual "BGInfo" $vm.Extensions[0].VirtualMachineExtensionType;
3437+
Assert-AreEqual "Microsoft.Compute" $vm.Extensions[0].Publisher;
3438+
3439+
Assert-AreEqual $osdisk.Id $vm.StorageProfile.OsDisk.ManagedDisk.Id;
3440+
Assert-AreEqual 'Standard_LRS' $vm.StorageProfile.OsDisk.ManagedDisk.StorageAccountType;
3441+
Assert-AreEqual $datadisk.Id $vm.StorageProfile.DataDisks[0].ManagedDisk.Id;
3442+
Assert-AreEqual 'Standard_LRS' $vm.StorageProfile.DataDisks[0].ManagedDisk.StorageAccountType;
3443+
}
3444+
finally
3445+
{
3446+
# Cleanup
3447+
Clean-ResourceGroup $rgname
3448+
}
33183449
}

src/ResourceManager/Compute/Commands.Compute.Test/SessionRecords/Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineTests/TestVirtualMachineManagedDisk.json

Lines changed: 18607 additions & 0 deletions
Large diffs are not rendered by default.

src/ResourceManager/Compute/Commands.Compute/ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919
- Additional information about change #1
2020
-->
2121
## Current Release
22+
* Fixed the issue that target is missing in error output.
23+
* Fixed issue with storage account type for VM with managed disk
2224
* Fixed issue with default resource groups not being set.
25+
* Fix AEM Extension cmdlets for other environments, for example Azure China
2326

2427
## Version 5.5.0
2528
* Updated to the latest version of the Azure ClientRuntime.

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
using System.Text.RegularExpressions;
1919
using Microsoft.Azure.Commands.Compute.Common;
2020
using Microsoft.Azure.Commands.ResourceManager.Common;
21+
using Microsoft.Azure.Management.Compute.Models;
2122

2223
namespace Microsoft.Azure.Commands.Compute
2324
{
@@ -96,6 +97,28 @@ public static string GetOperationIdFromUrlString(string Url)
9697
Match m = r.Match(Url);
9798
return m.Success ? m.Groups["id"].Value : null;
9899
}
100+
101+
public static ManagedDiskParameters SetManagedDisk(string managedDiskId, string storageAccountType, ManagedDiskParameters managedDisk = null)
102+
{
103+
if (string.IsNullOrWhiteSpace(managedDiskId) && string.IsNullOrWhiteSpace(storageAccountType))
104+
{
105+
return managedDisk;
106+
}
107+
108+
managedDisk = new ManagedDiskParameters();
109+
110+
if (!string.IsNullOrWhiteSpace(managedDiskId))
111+
{
112+
managedDisk.Id = managedDiskId;
113+
}
114+
115+
if (!string.IsNullOrWhiteSpace(storageAccountType))
116+
{
117+
managedDisk.StorageAccountType = storageAccountType;
118+
}
119+
120+
return managedDisk;
121+
}
99122
}
100123
}
101124

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ protected static string GetErrorMessageWithRequestIdInfo(Rest.Azure.CloudExcepti
5757
{
5858
sb.AppendLine().AppendFormat("ErrorCode: {0}", errorReturned.Error.Code);
5959
sb.AppendLine().AppendFormat("ErrorMessage: {0}", errorReturned.Error.Message);
60+
sb.AppendLine().AppendFormat("ErrorTarget: {0}", errorReturned.Error.Target);
6061
}
6162

6263
if (errorReturned.StartTime != null)

src/ResourceManager/Compute/Commands.Compute/Extension/AEM/AEMHelper.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,18 @@ internal class AEMHelper
4646
private Dictionary<string, string> _StorageKeyCache = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
4747
private StorageManagementClient _StorageClient;
4848
private IAzureSubscription _Subscription;
49+
private string _StorageEndpoint;
4950

5051
public AEMHelper(Action<ErrorRecord> errorAction, Action<string> verboseAction, Action<string> warningAction,
51-
PSHostUserInterface ui, StorageManagementClient storageClient, IAzureSubscription subscription)
52+
PSHostUserInterface ui, StorageManagementClient storageClient, IAzureSubscription subscription, String storageEndpoint)
5253
{
5354
this._ErrorAction = errorAction;
5455
this._VerboseAction = verboseAction;
5556
this._WarningAction = warningAction;
5657
this._UI = ui;
5758
this._StorageClient = storageClient;
5859
this._Subscription = subscription;
60+
this._StorageEndpoint = storageEndpoint;
5961
}
6062

6163
internal string GetStorageAccountFromUri(string uri)
@@ -140,7 +142,7 @@ internal bool IsPremiumStorageAccount(string accountName)
140142
StorageCredentialsFactory storageCredentialsFactory = new StorageCredentialsFactory(resGroupName,
141143
this._StorageClient, this._Subscription);
142144
StorageCredentials sc = storageCredentialsFactory.Create(blobUri);
143-
CloudStorageAccount cloudStorageAccount = new CloudStorageAccount(sc, true);
145+
CloudStorageAccount cloudStorageAccount = new CloudStorageAccount(sc, this._StorageEndpoint, true);
144146
CloudBlobClient blobClient = cloudStorageAccount.CreateCloudBlobClient();
145147
CloudBlobContainer blobContainer = blobClient.GetContainerReference(blobUri.BlobContainerName);
146148
var cloudBlob = blobContainer.GetPageBlobReference(blobUri.BlobName);
@@ -729,7 +731,7 @@ internal ServiceProperties GetStorageAnalytics(string storageAccountName)
729731
{
730732
var key = this.GetAzureStorageKeyFromCache(storageAccountName);
731733
var credentials = new StorageCredentials(storageAccountName, key);
732-
var cloudStorageAccount = new CloudStorageAccount(credentials, true);
734+
var cloudStorageAccount = new CloudStorageAccount(credentials, this._StorageEndpoint, true);
733735
return cloudStorageAccount.CreateCloudBlobClient().GetServicePropertiesAsync().ConfigureAwait(false).GetAwaiter().GetResult();
734736
}
735737

src/ResourceManager/Compute/Commands.Compute/Extension/AEM/RemoveAzureRmVMAEMExtension.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ public override void ExecuteCmdlet()
7474
this._Helper = new AEMHelper((err) => this.WriteError(err), (msg) => this.WriteVerbose(msg), (msg) => this.WriteWarning(msg),
7575
this.CommandRuntime.Host.UI,
7676
AzureSession.Instance.ClientFactory.CreateArmClient<StorageManagementClient>(DefaultProfile.DefaultContext, AzureEnvironment.Endpoint.ResourceManager),
77-
this.DefaultContext.Subscription);
77+
this.DefaultContext.Subscription,
78+
this.DefaultContext.Environment.GetEndpoint(AzureEnvironment.Endpoint.StorageEndpointSuffix));
7879

7980
base.ExecuteCmdlet();
8081

src/ResourceManager/Compute/Commands.Compute/Extension/AEM/SetAzureRmVMAEMExtension.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ namespace Microsoft.Azure.Commands.Compute
3838
[OutputType(typeof(PSAzureOperationResponse))]
3939
public class SetAzureRmVMAEMExtension : VirtualMachineExtensionBaseCmdlet
4040
{
41+
private string _StorageEndpoint;
4142
private AEMHelper _Helper = null;
4243

4344
[Parameter(
@@ -91,8 +92,13 @@ public SetAzureRmVMAEMExtension()
9192

9293
public override void ExecuteCmdlet()
9394
{
95+
this._StorageEndpoint = this.DefaultContext.Environment.GetEndpoint(AzureEnvironment.Endpoint.StorageEndpointSuffix);
9496
this._Helper = new AEMHelper((err) => this.WriteError(err), (msg) => this.WriteVerbose(msg), (msg) => this.WriteWarning(msg),
95-
this.CommandRuntime.Host.UI, AzureSession.Instance.ClientFactory.CreateArmClient<StorageManagementClient>(DefaultProfile.DefaultContext, AzureEnvironment.Endpoint.ResourceManager), this.DefaultContext.Subscription);
97+
this.CommandRuntime.Host.UI,
98+
AzureSession.Instance.ClientFactory.CreateArmClient<StorageManagementClient>(
99+
DefaultProfile.DefaultContext, AzureEnvironment.Endpoint.ResourceManager),
100+
this.DefaultContext.Subscription,
101+
this._StorageEndpoint);
96102

97103
base.ExecuteCmdlet();
98104

@@ -521,7 +527,7 @@ private void SetStorageAnalytics(string storageAccountName)
521527

522528
var key = this._Helper.GetAzureStorageKeyFromCache(storageAccountName);
523529
var credentials = new StorageCredentials(storageAccountName, key);
524-
var cloudStorageAccount = new CloudStorageAccount(credentials, true);
530+
var cloudStorageAccount = new CloudStorageAccount(credentials, this._StorageEndpoint, true);
525531

526532
cloudStorageAccount.CreateCloudBlobClient().SetServicePropertiesAsync(props)
527533
.ConfigureAwait(false).GetAwaiter().GetResult();

src/ResourceManager/Compute/Commands.Compute/Extension/AEM/TestAzureRmVMAEMExtension.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ public override void ExecuteCmdlet()
8989
this._Helper = new AEMHelper((err) => this.WriteError(err), (msg) => this.WriteVerbose(msg), (msg) => this.WriteWarning(msg),
9090
this.CommandRuntime.Host.UI,
9191
AzureSession.Instance.ClientFactory.CreateArmClient<StorageManagementClient>(DefaultProfile.DefaultContext, AzureEnvironment.Endpoint.ResourceManager),
92-
this.DefaultContext.Subscription);
92+
this.DefaultContext.Subscription,
93+
this.DefaultContext.Environment.GetEndpoint(AzureEnvironment.Endpoint.StorageEndpointSuffix));
9394

9495
this._Helper.WriteVerbose("Starting TestAzureRmVMAEMExtension");
9596

src/ResourceManager/Compute/Commands.Compute/Generated/Image/Config/AddAzureRmImageDataDiskCommand.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ private void Run()
110110
vDataDisks.BlobUri = this.MyInvocation.BoundParameters.ContainsKey("BlobUri") ? this.BlobUri : null;
111111
vDataDisks.Caching = this.MyInvocation.BoundParameters.ContainsKey("Caching") ? this.Caching : (CachingTypes?) null;
112112
vDataDisks.DiskSizeGB = this.MyInvocation.BoundParameters.ContainsKey("DiskSizeGB") ? this.DiskSizeGB : (int?) null;
113-
vDataDisks.StorageAccountType = this.MyInvocation.BoundParameters.ContainsKey("StorageAccountType") ? (StorageAccountTypes ?) this.StorageAccountType : null;
113+
if (this.MyInvocation.BoundParameters.ContainsKey("StorageAccountType"))
114+
{
115+
vDataDisks.StorageAccountType = (StorageAccountTypes?) this.StorageAccountType;
116+
}
114117
if (this.MyInvocation.BoundParameters.ContainsKey("SnapshotId"))
115118
{
116119
// Snapshot

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

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,7 @@ public override void ExecuteCmdlet()
224224
DiskSizeGB = this.DiskSizeInGB,
225225
Lun = this.Lun.GetValueOrDefault(),
226226
CreateOption = this.CreateOption,
227-
ManagedDisk = (this.ManagedDiskId == null && this.StorageAccountType == null)
228-
? null
229-
: new ManagedDiskParameters
230-
{
231-
Id = this.ManagedDiskId,
232-
StorageAccountType = this.StorageAccountType
233-
},
227+
ManagedDisk = SetManagedDisk(this.ManagedDiskId, this.StorageAccountType),
234228
WriteAcceleratorEnabled = this.WriteAccelerator.IsPresent
235229
});
236230

@@ -258,11 +252,7 @@ public override void ExecuteCmdlet()
258252
DiskSizeGB = this.DiskSizeInGB,
259253
Lun = this.Lun.GetValueOrDefault(),
260254
CreateOption = this.CreateOption,
261-
ManagedDisk = new ManagedDiskParameters
262-
{
263-
Id = this.ManagedDiskId,
264-
StorageAccountType = this.StorageAccountType
265-
},
255+
ManagedDisk = SetManagedDisk(this.ManagedDiskId, this.StorageAccountType),
266256
WriteAcceleratorEnabled = this.WriteAccelerator.IsPresent
267257
});
268258

0 commit comments

Comments
 (0)