azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

Installing latest aks-preview on az CLI 2.54.0 results in ERROR: module 'azure.core.pipeline.policies' has no attribute 'SensitiveHeaderCleanupPolicy'

Open wasker opened this issue 11 months ago • 8 comments

Describe the bug

After installing latest aks-preview extension on v2.54, I'm observing an error when executing az aks get-credentials

2024-03-28 02:59:21.112049: ERROR: The command failed with an unexpected error. Here is the traceback: ERROR: module 'azure.core.pipeline.policies' has no attribute 'SensitiveHeaderCleanupPolicy' Traceback (most recent call last): File "/usr/lib64/az/lib/python3.9/site-packages/knack/cli.py", line 233, in invoke cmd_result = self.invocation.execute(args) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 663, in execute raise ex File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 726, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 697, in _run_job result = cmd_copy(params) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 333, in call return self.handler(*args, **kwargs) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/command_operation.py", line 112, in handler client = self.client_factory(self.cli_ctx, command_args) if self.client_factory else None File "/root/.azure/cliextensions/aks-preview/azext_aks_preview/_client_factory.py", line 31, in cf_managed_clusters return get_container_service_client(cli_ctx).managed_clusters File "/root/.azure/cliextensions/aks-preview/azext_aks_preview/_client_factory.py", line 23, in get_container_service_client return get_mgmt_service_client(cli_ctx, CUSTOM_MGMT_AKS_PREVIEW, subscription_id=subscription_id) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/client_factory.py", line 83, in get_mgmt_service_client client, _ = _get_mgmt_service_client(cli_ctx, client_type, subscription_id=subscription_id, File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/client_factory.py", line 251, in _get_mgmt_service_client client = client_type(credential, subscription_id, **client_kwargs) File "/root/.azure/cliextensions/aks-preview/azext_aks_preview/vendored_sdks/azure_mgmt_preview_aks/_container_service_client.py", line 98, in init policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, AttributeError: module 'azure.core.pipeline.policies' has no attribute 'SensitiveHeaderCleanupPolicy' To check existing issues, please visit: https://github.com/Azure/azure-cli/issues

Related command

az aks get-credentials

Errors

2024-03-28 02:59:21.112049: ERROR: The command failed with an unexpected error. Here is the traceback: ERROR: module 'azure.core.pipeline.policies' has no attribute 'SensitiveHeaderCleanupPolicy' Traceback (most recent call last): File "/usr/lib64/az/lib/python3.9/site-packages/knack/cli.py", line 233, in invoke cmd_result = self.invocation.execute(args) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 663, in execute raise ex File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 726, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 697, in _run_job result = cmd_copy(params) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 333, in call return self.handler(*args, **kwargs) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/command_operation.py", line 112, in handler client = self.client_factory(self.cli_ctx, command_args) if self.client_factory else None File "/root/.azure/cliextensions/aks-preview/azext_aks_preview/_client_factory.py", line 31, in cf_managed_clusters return get_container_service_client(cli_ctx).managed_clusters File "/root/.azure/cliextensions/aks-preview/azext_aks_preview/_client_factory.py", line 23, in get_container_service_client return get_mgmt_service_client(cli_ctx, CUSTOM_MGMT_AKS_PREVIEW, subscription_id=subscription_id) File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/client_factory.py", line 83, in get_mgmt_service_client client, _ = _get_mgmt_service_client(cli_ctx, client_type, subscription_id=subscription_id, File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/client_factory.py", line 251, in _get_mgmt_service_client client = client_type(credential, subscription_id, **client_kwargs) File "/root/.azure/cliextensions/aks-preview/azext_aks_preview/vendored_sdks/azure_mgmt_preview_aks/_container_service_client.py", line 98, in init policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, AttributeError: module 'azure.core.pipeline.policies' has no attribute 'SensitiveHeaderCleanupPolicy' To check existing issues, please visit: https://github.com/Azure/azure-cli/issues

Issue script & Debug output

n/a

Expected behavior

No error.

Environment Summary

az CLI v 2.54.

Additional context

No response

wasker avatar Mar 28 '24 03:03 wasker

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

yonzhan avatar Mar 28 '24 03:03 yonzhan

Got the same issue.

{ "azure-cli": "2.55.0", "azure-cli-core": "2.55.0", "azure-cli-telemetry": "1.1.0", "extensions": { "aks-preview": "2.0.0b7", "subscription": "0.1.5" } }

seguler avatar Mar 29 '24 02:03 seguler

az cli version 2.50.0 runs into this issue suddenly from 4 days ago. it was running fine.

vickenliu avatar Mar 31 '24 01:03 vickenliu

Got the same issue.

az version
{
  "azure-cli": "2.53.0",
  "azure-cli-core": "2.53.0",
  "azure-cli-telemetry": "1.1.0",
  "extensions": {
    "aks-preview": "2.0.0b7"
  }
}

The error gone after upgrading the azure-core.

pip install --upgrade azure-core

galiacheng avatar Apr 01 '24 03:04 galiacheng

Got the same issue.

az version
{
  "azure-cli": "2.53.0",
  "azure-cli-core": "2.53.0",
  "azure-cli-telemetry": "1.1.0",
  "extensions": {
    "aks-preview": "2.0.0b7"
  }
}

The error gone after upgrading the azure-core.

pip install --upgrade azure-core

This command does work.

My version:

az version
{
  "azure-cli": "2.57.0",
  "azure-cli-core": "2.57.0",
  "azure-cli-telemetry": "1.1.0",
  "extensions": {
    "acrtransfer": "1.1.0",
    "aks-preview": "2.0.0b7",
    "alb": "1.0.0",
    "attestation": "1.0.0",
    "azure-firewall": "1.0.1",
    "confcom": "0.3.3",
    "k8s-configuration": "1.7.0",
    "k8s-extension": "1.6.0"
  }
}

It does not look like az version will give you anything useful, because this version does not change after executing pip install --upgrade azure-core the command.

Installing collected packages: azure-core
  Attempting uninstall: azure-core
    Found existing installation: azure-core 1.26.0
    Uninstalling azure-core-1.26.0:
      Successfully uninstalled azure-core-1.26.0
Successfully installed azure-core-1.30.1

/# az version
{
  "azure-cli": "2.57.0",
  "azure-cli-core": "2.57.0",
  "azure-cli-telemetry": "1.1.0",
  "extensions": {
    "acrtransfer": "1.1.0",
    "aks-preview": "2.0.0b7",
    "alb": "1.0.0",
    "attestation": "1.0.0",
    "azure-firewall": "1.0.1",
    "confcom": "0.3.3",
    "k8s-configuration": "1.7.0",
    "k8s-extension": "1.6.0"
  }
}

JoeyC-Dev avatar Apr 01 '24 09:04 JoeyC-Dev

This failed for me using Azure CLI 2.50.0 with the same error. With Azure CLI 2.59.0 it worked.

{
  "azure-cli": "2.59.0",
  "azure-cli-core": "2.59.0",
  "azure-cli-telemetry": "1.1.0",
  "extensions": {
    "aks-preview": "2.0.0b8"
  }
}

egalluzzo avatar Apr 03 '24 14:04 egalluzzo

2.59.0 also works for me, thanks.

vickenliu avatar Apr 10 '24 02:04 vickenliu

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

Can we get some official response from Microsoft/Azure? Is everyone expected to upgrade to Azure CLI 2.59.0?

rafaelrruiz avatar May 03 '24 16:05 rafaelrruiz

Hi, I have the same error since upgrading to version 2.61.0 (azure-cli and core):

azure-cli                         2.61.0
core                                2.61.0
telemetry                        1.1.0

Extensions:
account                            0.2.5
containerapp                    0.3.52

Dependencies:
msal                              1.28.0
azure-mgmt-resource               23.1.1

Any ideas ?

arogic avatar Jun 13 '24 06:06 arogic

The following solution helped in my case: https://github.com/Azure/azure-sdk-for-python/issues/34091#issuecomment-2138417331

sebastian-kopiczko avatar Jul 10 '24 11:07 sebastian-kopiczko