@@ -483,19 +483,28 @@ private string GetStorageRandomName()
483
483
484
484
private VirtualMachineScaleSetStorageProfile GetStorageProfile ( VirtualMachineScaleSetStorageProfile existingProfile )
485
485
{
486
- var vhds = CreateStorageAccount ( ) . Select ( a => string . Concat ( a . PrimaryEndpoints . Blob , "vhd" ) ) . ToList ( ) ;
486
+ var osDisk = new VirtualMachineScaleSetOSDisk ( )
487
+ {
488
+ Caching = existingProfile . OsDisk . Caching ,
489
+ OsType = existingProfile . OsDisk . OsType ,
490
+ CreateOption = existingProfile . OsDisk . CreateOption
491
+ } ;
492
+
493
+ if ( existingProfile . OsDisk . ManagedDisk != null )
494
+ {
495
+ osDisk . ManagedDisk = existingProfile . OsDisk . ManagedDisk ;
496
+ }
497
+ else
498
+ {
499
+ osDisk . Image = existingProfile . OsDisk . Image ;
500
+ osDisk . Name = existingProfile . OsDisk . Name ;
501
+ osDisk . VhdContainers = CreateStorageAccount ( ) . Select ( a => string . Concat ( a . PrimaryEndpoints . Blob , "vhd" ) ) . ToList ( ) ;
502
+ }
503
+
487
504
return new VirtualMachineScaleSetStorageProfile ( )
488
505
{
489
506
ImageReference = existingProfile . ImageReference ,
490
- OsDisk = new VirtualMachineScaleSetOSDisk ( )
491
- {
492
- Caching = existingProfile . OsDisk . Caching ,
493
- OsType = existingProfile . OsDisk . OsType ,
494
- Image = existingProfile . OsDisk . Image ,
495
- Name = existingProfile . OsDisk . Name ,
496
- CreateOption = existingProfile . OsDisk . CreateOption ,
497
- VhdContainers = vhds
498
- }
507
+ OsDisk = osDisk
499
508
} ;
500
509
}
501
510
0 commit comments