azure-cli: argument of type 'NoneType' is not iterable when running az aks enable-addons

Describe the bug

Getting this error when running az aks enable-addons after I followed the instructions from azure dashboard :

image

The previous command that failed for me was az aks browse --resource-group with the following error : The kube-dashboard addon was disabled for this managed cluster. To use "az aks browse" first enable the add-on by running "az aks enable-addons --addons kube-dashboard".

Command Name az aks enable-addons

Errors:

argument of type 'NoneType' is not iterable
Traceback (most recent call last):
Temp\pip-install-mjd5h3hf\knack\knack\cli.py, ln 206, in invoke
azure\cli\core\commands\__init__.py, ln 603, in execute
azure\cli\core\commands\__init__.py, ln 661, in _run_jobs_serially
azure\cli\core\commands\__init__.py, ln 654, in _run_job
Local\Temp\pip-install-mjd5h3hf\six\six.py, ln 696, in reraise
azure\cli\core\commands\__init__.py, ln 631, in _run_job
azure\cli\core\commands\__init__.py, ln 306, in __call__
azure-cli-core\azure\cli\core\__init__.py, ln 487, in default_command_handler
azure\cli\command_modules\acs\custom.py, ln 1845, in aks_enable_addons
azure\cli\command_modules\acs\custom.py, ln 2488, in _ensure_container_insights_for_monitoring
TypeError: argument of type 'NoneType' is not iterable

To Reproduce:

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

  • az aks enable-addons --addons {} --resource-group {} --name {}

Environment Summary

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

azure-cli 2.0.77

Additional Context

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 7
  • Comments: 21 (8 by maintainers)

Most upvoted comments

The proposed fix has been merged into the AKS-preview extension and core build for the S166 sprint. The core release is set for 3/10.

https://github.com/Azure/azure-cli/milestone/83

Can confirm the latest CLI resolved this issue for me.

$ az --version
azure-cli                          2.2.0

command-modules-nspkg              2.0.3
core                               2.2.0
nspkg                              3.0.4
telemetry                          1.0.4

I uninstalled azure-cli which was pointing to python2.7 and re-installed it

Amols-MacBook-Pro:lib amolshende$ az --version
azure-cli                         2.0.78

command-modules-nspkg              2.0.3
core                              2.0.78
nspkg                              3.0.4
telemetry                          1.0.4

Python location '/usr/local/Cellar/azure-cli/2.0.78/libexec/bin/python'
Extensions directory '/Users/amolshende/.azure/cliextensions'

Python (Darwin) 3.7.5 (default, Nov  1 2019, 02:16:38)
[Clang 10.0.0 (clang-1000.11.45.5)]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.

Still i am getting error

az aks enable-addons --addons kube-dashboard --resource-group firstapp-resources --name hello
The command failed with an unexpected error. Here is the traceback:

argument of type 'NoneType' is not iterable
Traceback (most recent call last):
  File "/usr/local/Cellar/azure-cli/2.0.78/libexec/lib/python3.7/site-packages/knack/cli.py", line 206, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/local/Cellar/azure-cli/2.0.78/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py", line 608, in execute
    raise ex
  File "/usr/local/Cellar/azure-cli/2.0.78/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py", line 666, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/usr/local/Cellar/azure-cli/2.0.78/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py", line 659, in _run_job
    six.reraise(*sys.exc_info())
  File "/usr/local/Cellar/azure-cli/2.0.78/libexec/lib/python3.7/site-packages/six.py", line 696, in reraise
    raise value
  File "/usr/local/Cellar/azure-cli/2.0.78/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py", line 636, in _run_job
    result = cmd_copy(params)
  File "/usr/local/Cellar/azure-cli/2.0.78/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py", line 306, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/local/Cellar/azure-cli/2.0.78/libexec/lib/python3.7/site-packages/azure/cli/core/__init__.py", line 490, in default_command_handler
    return op(**command_args)
  File "/usr/local/Cellar/azure-cli/2.0.78/libexec/lib/python3.7/site-packages/azure/cli/command_modules/acs/custom.py", line 1844, in aks_enable_addons
    _ensure_container_insights_for_monitoring(cmd, instance.addon_profiles['omsagent'])
  File "/usr/local/Cellar/azure-cli/2.0.78/libexec/lib/python3.7/site-packages/azure/cli/command_modules/acs/custom.py", line 2487, in _ensure_container_insights_for_monitoring
    if 'loganalyticsworkspaceresourceid' in addon.config:
TypeError: argument of type 'NoneType' is not iterable

To open an issue, please run: 'az feedback'

@AmitBaranes can you share the command you ran? I am unable to reproduce with the command provided in the error message.

➜  ~ az aks enable-addons --addons kube-dashboard -g myresourcegroup -n newazcluster

getting this exception : image