Azure / azure-cli

Azure Command-Line Interface
MIT License
4k stars 2.98k forks source link

"az ts create" fails to upload successfully compiled Bicep code #26352

Closed Svessir closed 1 year ago

Svessir commented 1 year ago

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name az ts create

Errors:

ERROR: The command failed with an unexpected error. Here is the traceback:
ERROR: string indices must be integers
Traceback (most recent call last):
  File "/home/sverrir/.local/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
  File "/home/sverrir/.local/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/home/sverrir/.local/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/home/sverrir/.local/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
    result = cmd_copy(params)
  File "/home/sverrir/.local/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
    return self.handler(*args, **kwargs)
  File "/home/sverrir/.local/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/home/sverrir/.local/lib/python3.10/site-packages/azure/cli/command_modules/resource/custom.py", line 1986, in create_template_spec
    packed_template = pack(cmd, template_file)
  File "/home/sverrir/.local/lib/python3.10/site-packages/azure/cli/command_modules/resource/_packing_engine.py", line 63, in pack
    _pack_artifacts(cmd, root_template_file_path, context)
  File "/home/sverrir/.local/lib/python3.10/site-packages/azure/cli/command_modules/resource/_packing_engine.py", line 84, in _pack_artifacts
    template_link_to_artifact_objs = _get_template_links_to_artifacts(cmd, artifactable_template_obj,
  File "/home/sverrir/.local/lib/python3.10/site-packages/azure/cli/command_modules/resource/_packing_engine.py", line 155, in _get_template_links_to_artifacts
    deployment_resource_objs = _get_deployment_resource_objects(cmd, template_obj, includeNested)
  File "/home/sverrir/.local/lib/python3.10/site-packages/azure/cli/command_modules/resource/_packing_engine.py", line 140, in _get_deployment_resource_objects
    if (str(resource['type']) == 'Microsoft.Resources/deployments') is True:
TypeError: string indices must be integers

To Reproduce:

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

import 'kubernetes@1.0.0' with { namespace: 'namespace' kubeConfig: kubeConfig } as k8s

resource azureServiceAccount 'core/ServiceAccount@v1' = { metadata: { name: 'azure-service-account' annotations: { 'azure.workload.identity/client-id': '' 'azure.workload.identity/tenant-id': '' } labels: { 'azure.workload.identity/use': 'true' } } }

- `az bicep build -f main.bicep`
- `az ts create -y -g {} -l {} -n {} --template-file ./main.json -v {}`

## Expected Behavior
Expected a template spec to be created in Azure successfully as the template file that is being referenced is a successful compilation of a bicep file.

## Environment Summary

Linux-5.19.0-41-generic-x86_64-with-glibc2.35, Ubuntu 22.04.2 LTS Python 3.10.6 Installer: PIP

azure-cli 2.48.1

Extensions: aks-preview 0.5.137 k8s-configuration 1.7.0 stream-analytics 0.1.2

Dependencies: msal 1.20.0 azure-mgmt-resource 22.0.0


## Additional Context

<!--Please don't remove this:-->
<!--auto-generated-->
yonzhan commented 1 year ago

Thank you for opening this issue, we will look into it.

Svessir commented 1 year ago

@alex-frankel, This might be of interest to you and your team

navba-MSFT commented 1 year ago

@Svessir Thanks for reaching out to us and reporting this issue. We are looking into this issue and we will provide an update.