Skip to content

GHA azure/cli@v2 output error #30730

Open
@danielsollondon

Description

Describe the bug

I am using GHA to deploy Azure Deployment Environments and get the outputs of the environment returned, you run this cmd from the laptop terminal and get this output:

az devcenter dev environment show-outputs --environment-name $envName --project-name $projectName --dev-center $devCenterName
{
"outputs": {
"aks-cluster-connection-cmd": {
"sensitive": false,
"type": "String",
"value": "az aks get-credentials --resource-group prod-clu-grp01 --name dev01"
},
"aks-cluster-namespace": {
"sensitive": false,
"type": "String",
"value": "fix123-fips-clin"
},
"argocd_url": {
"sensitive": false,
"type": "String",
"value": "https://xxxxx"
},
"grafana-dashboard_url": {
"sensitive": false,
"type": "String",
"value": "https://xxxxx"
},
"keyvault_id": {
"sensitive": false,
"type": "String",
"value": "/subscriptions/xxxx"
},
"log-analytis-connection-uri": {
"sensitive": false,
"type": "String",
"value": "https://xxxxs"
},
"log_analytics_url": {
"sensitive": false,
"type": "String",
"value": "https://dataexplorer.azure.com"
}
}
}

Related command

I want this output in a GHA, so did the below:

  - name: Get Outputs
    uses: azure/cli@v2
    with:
      azcliversion: latest
      inlineScript: |
        
        devCenterName=devcenter01
        projectName=project01
        envName=fix567-ade22
        echo $envName
        echo $projectName
        echo $devCenterName

        echo "getting outputs"
        az devcenter dev environment show-outputs --environment-name $envName \
          --project-name $projectName --dev-center $devCenterName

Errors

ERROR: The command failed with an unexpected error. Here is the traceback:
ERROR: Expect <class 'dict'>, got az aks get-credentials --resource-group prod-clu-grp01 --name dev01 (<class 'str'>)
Traceback (most recent call last):
File "/usr/lib64/az/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 666, in execute
raise ex
File "/usr/lib64/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 734, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 703, in _run_job
result = cmd_copy(params)
^^^^^^^^^^^^^^^^
File "/usr/lib64/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 336, in call
return self.handler(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/az/lib/python3.12/site-packages/azure/cli/core/commands/command_operation.py", line 120, in handler
return op(**command_args)
^^^^^^^^^^^^^^^^^^
File "/opt/az/azcliextensions/devcenter/azext_devcenter/custom.py", line 1720, in devcenter_environment_show_outputs
return EnvironmentShowOutputs(cli_ctx=cmd.cli_ctx)(command_args={
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/az/lib/python3.12/site-packages/azure/cli/core/aaz/_command.py", line 155, in call
return self._handler(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/azcliextensions/devcenter/azext_devcenter/aaz/latest/devcenter/dev/environment/_show_outputs.py", line 33, in _handler
self._execute_operations()
File "/opt/az/azcliextensions/devcenter/azext_devcenter/aaz/latest/devcenter/dev/environment/_show_outputs.py", line 97, in _execute_operations
self.EnvironmentsGetOutputs(ctx=self.ctx)()
File "/opt/az/azcliextensions/devcenter/azext_devcenter/aaz/latest/devcenter/dev/environment/_show_outputs.py", line 119, in call
return self.on_200(session)
^^^^^^^^^^^^^^^^^^^^
File "/opt/az/azcliextensions/devcenter/azext_devcenter/aaz/latest/devcenter/dev/environment/_show_outputs.py", line 182, in on_200
self.ctx.set_var(
File "/usr/lib64/az/lib/python3.12/site-packages/azure/cli/core/aaz/_command_ctx.py", line 84, in set_var
self.vars[name] = data
~~~~~~~~~^^^^^^
File "/usr/lib64/az/lib/python3.12/site-packages/azure/cli/core/aaz/_field_value.py", line 77, in setitem
self._data[name] = attr_schema.process_data(data, key=name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/az/lib/python3.12/site-packages/azure/cli/core/aaz/_field_type.py", line 232, in process_data
value[key] = sub_data
~~~~~^^^^^
File "/usr/lib64/az/lib/python3.12/site-packages/azure/cli/core/aaz/_field_value.py", line 77, in setitem
self._data[name] = attr_schema.process_data(data, key=name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/az/lib/python3.12/site-packages/azure/cli/core/aaz/_field_type.py", line 306, in process_data
value[key] = sub_data
~~~~~^^^^^
File "/usr/lib64/az/lib/python3.12/site-packages/azure/cli/core/aaz/_field_value.py", line 241, in setitem
self._data[key] = item_schema.process_data(data, key=key)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/az/lib/python3.12/site-packages/azure/cli/core/aaz/_field_type.py", line 232, in process_data
value[key] = sub_data
~~~~~^^^^^
File "/usr/lib64/az/lib/python3.12/site-packages/azure/cli/core/aaz/_field_value.py", line 77, in setitem
self._data[name] = attr_schema.process_data(data, key=name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/az/lib/python3.12/site-packages/azure/cli/core/aaz/_field_type.py", line 303, in process_data
raise AAZInvalidValueError("Expect <class 'dict'>, got {} ({})".format(data, type(data)))
azure.cli.core.aaz.exceptions.AAZInvalidValueError: Expect <class 'dict'>, got az aks get-credentials --resource-group prod-clu-grp01 --name dev01 (<class 'str'>)
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues
Error: Error: az cli script failed.

Issue script & Debug output

As above, it's like its evaluating the output: az aks get-credentials --resource-group prod-clu-grp01 --name dev01

Expected behavior

I'd like the output printed or be able to put to an output variable.

Environment Summary

Starting script execution via docker image mcr.microsoft.com/azure-cli:latest
azure-cli 2.68.0
core 2.68.0
telemetry 1.1.0
Dependencies:
msal 1.31.1
azure-mgmt-resource 23.1.1
Python location '/usr/bin/python3.12'
Extensions directory '/opt/az/azcliextensions'
Python (Linux) 3.12.3 (main, Dec 13 2024, 23:52:02) [GCC 13.2.0]

Additional context

No response

Metadata

Assignees

No one assigned

    Labels

    AKSaz aks/acs/openshiftAuto-AssignAuto assign by botService AttentionThis issue is responsible by Azure service team.bugThis issue requires a change to an existing behavior in the product in order to be resolved.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions