Florian
Florian

Reputation: 382

Possible to enable diagnostic settings when creating an Azure VM via CLI?

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).

Upvotes: 1

Views: 289

Answers (1)

Hugh Lin
Hugh Lin

Reputation: 19461

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 .

Upvotes: 1

Related Questions