Resolving error on Bicep module – on Azure CLI (2.22.0) for Windows 10

If you are seeing “fromisoformat” error while running az bicep version or any other az bicep command – you are not alone πŸ™‚

Check this open issue reported on GitHub by community member – https://github.com/Azure/azure-cli/issues/17718


After updating to the latest Azure CLI (2.22.0) for Windows 10, I am now seeing the same error as others have reported:

Any command such as “az bicep version” is producing the following error:

The command failed with an unexpected error.
Here is the traceback and detailed error:
type object 'datetime.datetime' has no attribute 'fromisoformat'
Traceback (most recent call last):
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 231, in invoke
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 657, in execute
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 720, in _run_jobs_serially
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 691, in _run_job
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 328, in call
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/init.py", line 807, in default_command_handler
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/resource/custom.py", line 3294, in build_bicep_file
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/resource/_bicep.py", line 63, in run_bicep_command
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/resource/_bicep.py", line 152, in _load_bicep_version_check_result_from_cache
AttributeError: type object 'datetime.datetime' has no attribute 'fromisoformat'

Is there a temp workaround?

One of the workarounds is to uninstalled Azure CLI 2.22.0 , and then install the prior version 2.21.0. You could confirm 2.21.0 version is working for you by running the same command.

Hope this will be helpful for you, as i faced with this issue hours before my demo to #GlobalAzure 2021 😐

Loading

Leave a Reply

Your email address will not be published. Required fields are marked *