azure-cli: Specifying VM ID in "az vm extension set" generates an exception

Describe the bug

When specifying a VM via the ID rather than the resource group & vm name, az cli generates an exception.

Command Name az vm extension set

Errors:

The command failed with an unexpected error. Here is the traceback:

'child_name_1'
Traceback (most recent call last):
  File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 206, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 274, in execute
    self.cli_ctx.raise_event(EVENT_INVOKER_POST_PARSE_ARGS, command=parsed_args.command, args=parsed_args)
  File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 162, in raise_event
    func(self, **kwargs)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/arm.py", line 310, in parse_ids_arguments
    getattr(namespace, arg.name).append(parts[arg.type.settings['id_part']])
KeyError: 'child_name_1'

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Put any pre-requisite steps here…
  • az vm extension set --ids {} --publisher {} -n {} --settings {}

Expected Behavior

Environment Summary

Linux-4.4.0-18908-Microsoft-x86_64-with-debian-buster-sid
Python 3.6.5
Shell: bash

azure-cli 2.0.62

Extensions:
interactive 0.4.1
resource-graph 0.1.8

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 20 (15 by maintainers)

Most upvoted comments

Tosin. Thank you so much! Your great insight of Azure CLI really impresses me. I misunderstood the semantics of vm extension set. I thought it is like general set command of other command. But it’s more like a create command to create or add an extension to VM. We can use id for existing resource rather then the resource we’re going to create or install.

The PR has been merged. If you still have questions, feel free to reopen the issue.

I’m on holiday from 1st Oct to 7th Oct . --ids is a general parameter in Azure CLI. It doesn’t support the usage you expect. But your advice is great. We’ll discuss if it’s feasible later.

@adewaleo I’m not the right person to solve this. I’m not familiar with the cli nor the vm extension service