Azure-cli: Set analytics workspace with az vm create

Created on 31 May 2019  Â·  10Comments  Â·  Source: Azure/azure-cli

This is autogenerated. Please review and update as needed.

Describe the bug

When creating a VM it is using the "Default" log analytics workspace. This is less than ideal, I would like the ability to specify an existing workspace to use.

Command Name
az vm create

Errors:
None

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
Using az vm create with whatever options you choose, create the VM and then see that it is connected to the default workspace. I also believe a default is created if one does not exist.

  • _Put any pre-requisite steps here..._
  • ``

Expected Behavior

Expose an option to specify the workspace. When used will connect the new VM to that specific workspace.

Environment Summary

Windows-10-10.0.17763-SP0
Python 3.6.6
Shell: cmd.exe

azure-cli 2.0.64 *

Extensions:
aks-preview 0.4.1

Additional Context


Compute-cli question

All 10 comments

@brobichaud Thanks for this feature request. As we look to build out this feature, I would very much like to have a quick 30 minute conversation to better understand your e2e scenario around this request. If interested, please email me (askazcli at microsoft dot com) your availability and timezone and I will setup something.

Looking forward to hear back from you.

Thanks,
Arun Chandrasekhar
Principal Program Manager - Azure CLI

Hi @achandmsft,

Sure, we could have a conversation, though my scenario is super simple and I could start by explaining it here in email.

I am using AKS, which itself utilizes log analytics for container monitoring. In setting up AKS clusters we use a specific Analytics workspace that I am able to specify during creation. As part of that I also create a Windows VM that acts as a “jumpbox” to allow me to remote into the AKS cluster nodes. I’d like that VM to use the same Analytics workspace as the rest of the cluster. I don’t have strong needs yet to log much to Analytics from that VM, but it occurred to me that there must be a bunch of other folks creating VM’s that would want to use a specific Analytics workspace.

But what truly prompted me to create this request is that currently VM creation will auto-magically create a “default” Analytics workspace, and I really truly dislike default resources like this. We control our resource group and resource names quite tightly, and any time something is created outside of our control it causes concern and problems. So seeing this new resource that I didn’t create myself was a red flag.

Let me know if you want more color on this, or feel you still want to talk.

I can also look into this, i.e. being able to specify the analytics work space via vm create.

I would mention that the CLI commands are a compromise between power and convenience. Ultimately arm templates offer the most power and flexibility. To make vm create more convenient / simple we do make certain assumptions and choose certain defaults, depending on the scenario. All this being said, being able to set an analytics workspace through the command is a very fair request.

FYI: running vm create --validate generates an ARM template without creating the vm or its resource which one can modify and then deploy with az deployment create.

I do have one question. _How do you know the vm has an associated "default" log analytics work space?_ It doesn't seem like this is a property of a vm resource but an extension that a user can set on the VM. If so, then it is unlikely that the CLI is setting this as a default on the VM.

@adewaleo I made that assumption about default because after VM creation I found a new Analytics Workspace in my subscription. It had "default" in the name. So at some level it was being created on my behalf.

Hello @brobichaud,

Are you able to reproduce this behavior after deleting the log analytics workspace and running vm create?

I have a very stong feeling this default log analytics workspace is being created by an aks command.

See aks create --workspace-resource-id:

--workspace-resource-id
The resource ID of an existing Log Analytics Workspace to use for storing monitoring data. 
If not specified, uses the default Log Analytics Workspace if it exists, otherwise creates one.

aks create create a default log analytics workspace when no workspace-resource-id is specified

I've not tried to repro the issue, but your comments make sense. Since I can;t specify a workspace-resource-id when creating a VM I assume it is maybe is creating one for me.

I've not tried to repro the issue, but your comments make sense. Since I can;t specify a workspace-resource-id when creating a VM I assume it is maybe is creating one for me.

As far as I know, vm create does not create a log analytics workspace by default. Please make sure you or someone else using your subscription is not creating this workspace via aks create. I will be closing this issue.

Please feel free to reach out with any other questions

OK, but I do know for sure that nobody else is cresting the workspace.

have you run aks create recently? As it is the command (apparently along with two others in the aks command group) which creates a default workspace

Yeah we have created AKS clusters but are using their option to specify a workspace. I suppose it's possible we ran one pass without that and the workspace got created. If you're convinced than I believe you.

Was this page helpful?
0 / 5 - 0 ratings