Skip to content

az acr task credential add crashes when given a password but no username #23340

@ToxicGLaDOS

Description

@ToxicGLaDOS

This is autogenerated. Please review and update as needed.

Describe the bug

When running az acr task credential add I ran into this error message. Because the error message referenced a NoneType I figured I was missing something and it turned out to be the username. The command worked correctly after I ran it with the username, but this should probably give an error message rather than giving a stack trace.

Command Name
az acr task credential add

Errors:

The command failed with an unexpected error. Here is the traceback:
'NoneType' object has no attribute 'upper'
Traceback (most recent call last):
  File "/home/jeff/.local/lib/azcli-env/lib/python3.10/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/home/jeff/.local/lib/azcli-env/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/home/jeff/.local/lib/azcli-env/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/jeff/.local/lib/azcli-env/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
    result = cmd_copy(params)
  File "/home/jeff/.local/lib/azcli-env/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
    return self.handler(*args, **kwargs)
  File "/home/jeff/.local/lib/azcli-env/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/home/jeff/.local/lib/azcli-env/lib/python3.10/site-packages/azure/cli/command_modules/acr/task.py", line 625, in acr_task_credential_add
    credentials=get_custom_registry_credentials(
  File "/home/jeff/.local/lib/azcli-env/lib/python3.10/site-packages/azure/cli/command_modules/acr/_utils.py", line 320, in get_custom_registry_credentials
    type=SecretObjectType.vaultsecret if is_vault_secret(
  File "/home/jeff/.local/lib/azcli-env/lib/python3.10/site-packages/azure/cli/command_modules/acr/_utils.py", line 397, in is_vault_secret
    return keyvault_dns.upper() in credential.upper()
AttributeError: 'NoneType' object has no attribute 'upper'

To Reproduce:

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

  • az acr task credential add --login-server {} --name {} --registry {} --password {} --subscription {}

Expected Behavior

Show an error message.

Environment Summary

Linux-5.15.17_1-x86_64-with-glibc2.32, Void Linux
Python 3.10.5
Installer: PIP

azure-cli 2.38.0

Extensions:
account 0.2.3
azure-devops 0.22.0
aks-preview 0.5.48

Dependencies:
msal 1.18.0b1
azure-mgmt-resource 21.1.0b1

Additional Context

Metadata

Metadata

Labels

Auto-AssignAuto assign by botCXP AttentionThis issue is handled by CXP team.Container Registryaz acrcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions