1
votes

I haven't found a command line switch for enabling diagnostic settings when creating a VM with the Azure CLI.

I know it works in the portal, but likely this is a separate step in the deployment template.

However, there is a new command line switch for enabling log analytics workspace immediately (Preview).

1
Not get your latest information, is the workaround helpful for you? Or if you have any concern, feel free to share it here.Hugh Lin
I think you are right, there is currently not a way to do this directlyFlorian

1 Answers

1
votes

az vm create cli does not provide the arguments about diagnostic settings, so I am afraid that we cannot enable diagnostic settings when creating an azure vm.

As workaround, you can try to enable the diagnostics settings using Azure CLI by following this document.

az vm diagnostics set --settings
                      [--ids]
                      [--no-auto-upgrade {false, true}]
                      [--protected-settings]
                      [--resource-group]
                      [--subscription]
                      [--version]
                      [--vm-name]

Here is a case on github you can refer to .