@@ -1391,9 +1391,15 @@ public VirtualMachineImpl withUnmanagedDisks() {
13911391 return this ;
13921392 }
13931393
1394+ @ Override
1395+ public VirtualMachineImpl withBootDiagnosticsOnManagedStorageAccount () {
1396+ this .bootDiagnosticsHandler .withBootDiagnostics (true );
1397+ return this ;
1398+ }
1399+
13941400 @ Override
13951401 public VirtualMachineImpl withBootDiagnostics () {
1396- this .bootDiagnosticsHandler .withBootDiagnostics ();
1402+ this .bootDiagnosticsHandler .withBootDiagnostics (false );
13971403 return this ;
13981404 }
13991405
@@ -2733,6 +2739,7 @@ private StorageAccountTypes getDefaultStorageAccountType() {
27332739 private class BootDiagnosticsHandler {
27342740 private final VirtualMachineImpl vmImpl ;
27352741 private String creatableDiagnosticsStorageAccountKey ;
2742+ private boolean useManagedStorageAccount = false ;
27362743
27372744 BootDiagnosticsHandler (VirtualMachineImpl vmImpl ) {
27382745 this .vmImpl = vmImpl ;
@@ -2756,10 +2763,11 @@ public String bootDiagnosticsStorageUri() {
27562763 return null ;
27572764 }
27582765
2759- BootDiagnosticsHandler withBootDiagnostics () {
2766+ BootDiagnosticsHandler withBootDiagnostics (boolean useManagedStorageAccount ) {
27602767 // Diagnostics storage uri will be set later by this.handleDiagnosticsSettings(..)
27612768 //
27622769 this .enableDisable (true );
2770+ this .useManagedStorageAccount = useManagedStorageAccount ;
27632771 return this ;
27642772 }
27652773
@@ -2773,6 +2781,7 @@ BootDiagnosticsHandler withBootDiagnostics(Creatable<StorageAccount> creatable)
27732781
27742782 BootDiagnosticsHandler withBootDiagnostics (String storageAccountBlobEndpointUri ) {
27752783 this .enableDisable (true );
2784+ this .useManagedStorageAccount = false ;
27762785 this .vmInner ()
27772786 .diagnosticsProfile ()
27782787 .bootDiagnostics ()
@@ -2786,10 +2795,14 @@ BootDiagnosticsHandler withBootDiagnostics(StorageAccount storageAccount) {
27862795
27872796 BootDiagnosticsHandler withoutBootDiagnostics () {
27882797 this .enableDisable (false );
2798+ this .useManagedStorageAccount = false ;
27892799 return this ;
27902800 }
27912801
27922802 void prepare () {
2803+ if (useManagedStorageAccount ) {
2804+ return ;
2805+ }
27932806 DiagnosticsProfile diagnosticsProfile = this .vmInner ().diagnosticsProfile ();
27942807 if (diagnosticsProfile == null
27952808 || diagnosticsProfile .bootDiagnostics () == null
@@ -2822,6 +2835,9 @@ void prepare() {
28222835 }
28232836
28242837 void handleDiagnosticsSettings () {
2838+ if (useManagedStorageAccount ) {
2839+ return ;
2840+ }
28252841 DiagnosticsProfile diagnosticsProfile = this .vmInner ().diagnosticsProfile ();
28262842 if (diagnosticsProfile == null
28272843 || diagnosticsProfile .bootDiagnostics () == null
0 commit comments