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 image builder create

See original GitHub issue

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name az image builder create

Errors:

The command failed with an unexpected error. Here is the traceback:
Unable to build a model: Cannot deserialize as [str] an object of type <class 'str'>, DeserializationError: Cannot deserialize as [str] an object of type <class 'str'>
Traceback (most recent call last):
  File "/usr/local/Cellar/azure-cli/2.33.0/libexec/lib/python3.10/site-packages/msrest/serialization.py", line 620, in body
    data = deserializer._deserialize(data_type, data)
  File "/usr/local/Cellar/azure-cli/2.33.0/libexec/lib/python3.10/site-packages/msrest/serialization.py", line 1442, in _deserialize
    value = self.deserialize_data(raw_value, attr_desc['type'])
  File "/usr/local/Cellar/azure-cli/2.33.0/libexec/lib/python3.10/site-packages/msrest/serialization.py", line 1618, in deserialize_data
    return self.deserialize_type[iter_type](data, data_type[1:-1])
  File "/usr/local/Cellar/azure-cli/2.33.0/libexec/lib/python3.10/site-packages/msrest/serialization.py", line 1649, in deserialize_iter
    return [self.deserialize_data(a, iter_type) for a in attr]
  File "/usr/local/Cellar/azure-cli/2.33.0/libexec/lib/python3.10/site-packages/msrest/serialization.py", line 1649, in <listcomp>
    return [self.deserialize_data(a, iter_type) for a in attr]
  File "/usr/local/Cellar/azure-cli/2.33.0/libexec/lib/python3.10/site-packages/msrest/serialization.py", line 1631, in deserialize_data
    return self._deserialize(obj_type, data)
  File "/usr/local/Cellar/azure-cli/2.33.0/libexec/lib/python3.10/site-packages/msrest/serialization.py", line 1442, in _deserialize
    value = self.deserialize_data(raw_value, attr_desc['type'])
  File "/usr/local/Cellar/azure-cli/2.33.0/libexec/lib/python3.10/site-packages/msrest/serialization.py", line 1618, in deserialize_data
    return self.deserialize_type[iter_type](data, data_type[1:-1])
  File "/usr/local/Cellar/azure-cli/2.33.0/libexec/lib/python3.10/site-packages/msrest/serialization.py", line 1645, in deserialize_iter
    raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(
msrest.exceptions.DeserializationError: Cannot deserialize as [str] an object of type <class 'str'>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/Cellar/azure-cli/2.33.0/libexec/lib/python3.10/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/local/Cellar/azure-cli/2.33.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 658, in execute
    raise ex
  File "/usr/local/Cellar/azure-cli/2.33.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 721, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/usr/local/Cellar/azure-cli/2.33.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 692, in _run_job
    result = cmd_copy(params)
  File "/usr/local/Cellar/azure-cli/2.33.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/local/Cellar/azure-cli/2.33.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/usr/local/Cellar/azure-cli/2.33.0/libexec/lib/python3.10/site-packages/azure/cli/command_modules/vm/_image_builder.py", line 426, in create_image_template
    return client.virtual_machine_image_templates.begin_create_or_update(
  File "/usr/local/Cellar/azure-cli/2.33.0/libexec/lib/python3.10/site-packages/azure/mgmt/imagebuilder/operations/_virtual_machine_image_templates_operations.py", line 280, in begin_create_or_update
    raw_result = self._create_or_update_initial(
  File "/usr/local/Cellar/azure-cli/2.33.0/libexec/lib/python3.10/site-packages/azure/mgmt/imagebuilder/operations/_virtual_machine_image_templates_operations.py", line 224, in _create_or_update_initial
    body_content = self._serialize.body(parameters, 'ImageTemplate')
  File "/usr/local/Cellar/azure-cli/2.33.0/libexec/lib/python3.10/site-packages/msrest/serialization.py", line 622, in body
    raise_with_traceback(
  File "/usr/local/Cellar/azure-cli/2.33.0/libexec/lib/python3.10/site-packages/msrest/exceptions.py", line 51, in raise_with_traceback
    raise error.with_traceback(exc_traceback)
  File "/usr/local/Cellar/azure-cli/2.33.0/libexec/lib/python3.10/site-packages/msrest/serialization.py", line 620, in body
    data = deserializer._deserialize(data_type, data)
  File "/usr/local/Cellar/azure-cli/2.33.0/libexec/lib/python3.10/site-packages/msrest/serialization.py", line 1442, in _deserialize
    value = self.deserialize_data(raw_value, attr_desc['type'])
  File "/usr/local/Cellar/azure-cli/2.33.0/libexec/lib/python3.10/site-packages/msrest/serialization.py", line 1618, in deserialize_data
    return self.deserialize_type[iter_type](data, data_type[1:-1])
  File "/usr/local/Cellar/azure-cli/2.33.0/libexec/lib/python3.10/site-packages/msrest/serialization.py", line 1649, in deserialize_iter
    return [self.deserialize_data(a, iter_type) for a in attr]
  File "/usr/local/Cellar/azure-cli/2.33.0/libexec/lib/python3.10/site-packages/msrest/serialization.py", line 1649, in <listcomp>
    return [self.deserialize_data(a, iter_type) for a in attr]
  File "/usr/local/Cellar/azure-cli/2.33.0/libexec/lib/python3.10/site-packages/msrest/serialization.py", line 1631, in deserialize_data
    return self._deserialize(obj_type, data)
  File "/usr/local/Cellar/azure-cli/2.33.0/libexec/lib/python3.10/site-packages/msrest/serialization.py", line 1442, in _deserialize
    value = self.deserialize_data(raw_value, attr_desc['type'])
  File "/usr/local/Cellar/azure-cli/2.33.0/libexec/lib/python3.10/site-packages/msrest/serialization.py", line 1618, in deserialize_data
    return self.deserialize_type[iter_type](data, data_type[1:-1])
  File "/usr/local/Cellar/azure-cli/2.33.0/libexec/lib/python3.10/site-packages/msrest/serialization.py", line 1645, in deserialize_iter
    raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(
msrest.exceptions.SerializationError: Unable to build a model: Cannot deserialize as [str] an object of type <class 'str'>, DeserializationError: Cannot deserialize as [str] an object of type <class 'str'>

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 image builder create --name {} --resource-group {} --image-template {}

Expected Behavior

Environment Summary

macOS-12.3-x86_64-i386-64bit, Darwin 21.4.0
Python 3.10.2
Installer: HOMEBREW

azure-cli 2.33.0

Additional Context

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
masonhuemmercommented, Feb 16, 2022

Once I updated the replicationRegion to a list, I was able to resolve my issue.

0reactions
zhoxing-mscommented, Feb 16, 2022

@masonhuemmer This issue is caused by the wrong type of replicationRegions value in the template file.

Please note that the definition of replicationRegions is an array, not a string. doc link

"replicationRegions": [
    "<region where the gallery is deployed>",
    "<region>"
]

Therefore, "replicationRegions": "centralus" in your template file should be changed to "replicationRegions": ["centralus"]

Read more comments on GitHub >

github_iconTop Results From Across the Web

az image builder - Microsoft Learn
Create an image builder template from an UbuntuLTS 18.04 image. Distribute it as a managed image and a shared image gallery image version....
Read more >
Tip 273 - Getting started with Azure Image Builder
Azure Image Builder (opens new window) provides a great way to create customized VM images that you can use as a standard to...
Read more >
az image builder create · Issue #14575 · Azure/azure-cli - GitHub
Describe the bug az image builder create does not contain the vmProfile config properties: "vmProfile": { "vmSize": "", "osDiskSizeGB": ,
Read more >
Preparing custom image templates with Azure Image Builder ...
Pre-Requirements · Define the variables · Initialize Azure Image Builder (AIB) · Create the Shared Image Gallery (SIG) · Prepare the source image....
Read more >
Azure Image Builder - Jamie Phillips
So I am going to use Azure Image Builder to build a virtual machine ... Storage | grep registrationState az provider show -n...
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