Azure / azure-libraries-for-java

Azure Management Libraries for Java
https://docs.microsoft.com/en-us/java/azure/
MIT License
94 stars 97 forks source link

[QUERY] create a vm with managed boot diagnostics #1346

Closed erzads closed 3 years ago

erzads commented 3 years ago

Query/Question How can I create a new vm with managed boot diagnostics enabled? The sdk has a method with no parameters to enable boot diagnostics but it ends up configuring it with a custom storage account, even thought there are overloaded method to inform a storage account. This makes me think this is a bug but I am not sure.

Why is this not a Bug or a feature Request? I am not sure if this is expected or not.

Setup (please complete the following information if applicable):

xseeseesee commented 3 years ago

@erzads For the method without parameters, it would create storage account implicitly. The code for creating storage account with random name could be found here. The code to validate if storage account exists for boot diagnostics is here. Thanks.

erzads commented 3 years ago

Let me try to clarify it. How can I use the sdk such that when I check the boot diagnostics page in the portal I see this: IMG-20210121-WA0001

I don't want to inform a storage account nor do I want it to create a random storage account.

xseeseesee commented 3 years ago

@erzads Thanks for clarification. By the Learn more link of shared screenshot, it looks managed boot diagnostics is new feature since API version 2020-06-01 here. We have upgraded API version to the expected one while we haven't updated internal logic inside our implementation.

For now, you may set via below sample code

VirtualMachineInner vmInner = new VirtualMachineInner();
vmInner.diagnosticsProfile().withBootDiagnostics(new BootDiagnostics().withEnabled(true));
computeManager.inner().virtualMachines().createOrUpdate("rgName", "vmName", vmInner);

Alternatively, you may also try with arm template as it mentioned here.

We will plan to support this in our new SDK.

weidongxu-microsoft commented 3 years ago

Add a withBootDiagnosticsOnManagedStorageAccount for this.

weidongxu-microsoft commented 3 years ago

1.40.0 released