Azure / azure-cli-extensions

Public Repository for Extensions of Azure CLI.

Home Page:https://docs.microsoft.com/en-us/cli/azure

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'ServicePrincipalCredential' is not defined in 1.7.1 connectedk8s

renato-marciano opened this issue · comments

Describe the bug

After updating to 1.7.1 release of connectedk8s extension, when logged in to a service principal, I am now getting the error message:
Failed to post access token to client proxyname 'ServicePrincipalCredential' is not defined

Related command

az connectedk8s proxy --name devcluster --resource-group rg-aio050624190206 --port 8001

Errors

Failed to post access token to client proxyname 'ServicePrincipalCredential' is not defined

Issue script & Debug output

cli.azure.cli.core.azclierror: Traceback (most recent call last):
File "/home/vscode/.azure/cliextensions/connectedk8s/azext_connectedk8s/_clientproxyutils.py", line 99, in fetch_and_post_at_to_csp
if isinstance(credential._credential, ServicePrincipalCredential):
^^^^^^^^^^^^^^^^^^^^^^^^^^
NameError: name 'ServicePrincipalCredential' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/az/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 664, in execute
raise ex
File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 731, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 701, in _run_job
result = cmd_copy(params)
^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/init.py", line 334, in call
return self.handler(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
return op(**command_args)
^^^^^^^^^^^^^^^^^^
File "/home/vscode/.azure/cliextensions/connectedk8s/azext_connectedk8s/custom.py", line 2183, in client_side_proxy_wrapper
client_side_proxy_main(cmd, tenant_id, client, resource_group_name, cluster_name, 0, args, client_proxy_port, api_server_port,
File "/home/vscode/.azure/cliextensions/connectedk8s/azext_connectedk8s/custom.py", line 2220, in client_side_proxy_main
expiry, clientproxy_process = client_side_proxy(cmd, tenant_id, client, resource_group_name, cluster_name, 0, args, client_proxy_port,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.azure/cliextensions/connectedk8s/azext_connectedk8s/custom.py", line 2308, in client_side_proxy
post_at_response = clientproxyutils.fetch_and_post_at_to_csp(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/.azure/cliextensions/connectedk8s/azext_connectedk8s/_clientproxyutils.py", line 107, in fetch_and_post_at_to_csp
close_subprocess_and_raise_cli_error(clientproxy_process,
File "/home/vscode/.azure/cliextensions/connectedk8s/azext_connectedk8s/_clientproxyutils.py", line 41, in close_subprocess_and_raise_cli_error
raise CLIInternalError(msg)
azure.cli.core.azclierror.CLIInternalError: Failed to post access token to client proxyname 'ServicePrincipalCredential' is not defined

cli.azure.cli.core.azclierror: Failed to post access token to client proxyname 'ServicePrincipalCredential' is not defined
az_command_data_logger: Failed to post access token to client proxyname 'ServicePrincipalCredential' is not defined

Expected behavior

logged in with service principal

Environment Summary

{
"azure-cli": "2.60.0",
"azure-cli-core": "2.60.0",
"azure-cli-telemetry": "1.1.0",
"extensions": {
"azure-iot-ops": "0.5.0b1",
"connectedk8s": "1.7.1",
"k8s-extension": "1.6.1"
}
}

Additional context

Reverting back to 1.7.0 connectedk8s extension fixes it.

No response

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

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @akashkeshari.