Skip to content

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

Closed
@Svessir

Description

@Svessir

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.

  • Put any pre-requisite steps here...
  • Create a bicep file called main.bicep with the following code:
@secure()
param kubeConfig string

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

Metadata

Metadata

Assignees

Labels

ARMaz resource/group/lock/tag/deployment/policy/managementapp/account management-groupAuto-AssignAuto assign by botCXP AttentionThis issue is handled by CXP team.bugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions