question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`az group create` incorrectly requests `--rg-name` argument

See original GitHub issue

Describe the bug In some situations, the Azure CLI requres the use of the --rg-name argument with az group create. When this argument is required, --name does not work as an alias.

This argument only works when the --name argument is refused; otherwise the --name argument is reported as required, and --rg-name does not work.

To Reproduce

  • Reproduction may require a fully clean install (removal of .azure cache, uninstall Azure CLI, reinstall Azure CLI)
az interactive

az>> group create -n 'Example2' --location westus2
az group create: error: the following arguments are required: --rg-name, --location/-l
usage: az group create [-h] [--verbose] [--debug]
[--output {json,jsonc,table,tsv,yaml,none}]
[--query JMESPATH] --rg-name RG_NAME --location
LOCATION [--tags TAGS] [--subscription _SUBSCRIPTION]

az>> /home/stramer/.azure/cliextensions/interactive/azext_interactive/azclishell/_dump_commands.py:136: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.         help_entry = yaml.load(help_yaml)
az>>
az>> group create -n 'Example2' --location westus2
{
"id": "/subscriptions/07a45d58-11b5-4fd3-8cb6-12ac232d1c3f/resourceGroups/Example2", 
"location": "westus2",
"managedBy": null,
"name": "Example2", 
"properties": {
"provisioningState": "Succeeded"
},
"tags": null,
"type": null

Expected behavior az group create requires and works with the --name argument.

Environment summary

  • Ubuntu LTS 18.04 running on WSL (Win 1809, Build 17763.379)
az --version
---
azure-cli                         2.0.61
...
extension                          0.2.4
...
resource                          2.1.12

Extensions:
interactive                        0.4.1
Python location '/opt/az/bin/python3'
Extensions directory '/home/stramer/.azure/cliextensions'
Python (Linux) 3.6.5 (default, Mar 22 2019, 17:43:37) [GCC 7.3.0]

Additional context

  • The bug seems to be triggered only while running in az interactive, and remediated by the failed YAML load.
  • If --rg-name is an allowable switch, it should be an alias for --name to avoid breaking compatibility.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
tjprescottcommented, Apr 8, 2019

Actually, I think that this is most likely a bug in az interactive. I’m going to transfer the issue there and I will investigate. If it turns out to be an issue with the help system, I’ll transfer it back.

1reaction
tjprescottcommented, Apr 8, 2019

--rg-name is definitely not an allowable option. @adewaleo please take a look.

Read more comments on GitHub >

github_iconTop Results From Across the Web

az group | Microsoft Learn
Manage resource groups and template deployments. In this article. Commands; az group create; az group delete; az group exists; az group export; az...
Read more >
Azure ARM Template : Create Resource Group - Stack Overflow
Now you can create a resource group using ARM templates. You can use the following ... --parameters rgName=demoRG rgLocation=northcentralus.
Read more >
Getting started with Terraform and Kubernetes on Azure AKS
TL;DR: In this article, you will learn how to create Kubernetes clusters on Azure Kubernetes Service (AKS) with the Azure CLI and Terraform....
Read more >
Azure Resource Manager Overview | Microsoft Docs
Resource Manager processes the template like any other request. ... az group deployment create --resource-group $resourceGroupName --template-file ...
Read more >
Python | MSFT Stack | Page 2 - WordPress.com
This article shows how to use the Azure Python SDK to create an Azure Key ... az group create --name $RGNAME --location $LOCATION...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found