Azure / Azure/azure-cli

CredentialUnavailableError error

Open
#28,915 16 comments 0 reactions 2 assignees Claimed by @jiasli View on GitHub
act-identity-squad ARM Auto-Assign Azure CLI Team customer-reported question
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

We use below task in pipeline file.

```
- task: AzureCLI@2
displayName: "Run One Sriov test"
inputs:
azureSubscription: 'name'
scriptType: ps
powerShellErrorActionPreference: 'silentlyContinue'
scriptLocation: inlineScript
inlineScript: |
```

And in the inlineScript we launch command to run python code, we always can see below error, I am sure the service connection has enough permission to operate the resources in the azure subscription.

```
2024-05-08 01:57:52.221[4124][ERROR] lisa.runner[0] case failed
Traceback (most recent call last):
File "C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\azure\identity\_credentials\azure_cli.py", line 141, in _run_command
return subprocess.check_output(args, **kwargs)
File "C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\subprocess.py", line 421, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\subprocess.py", line 526, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['cmd', '/c', 'az account get-access-token --output json --resource https://management.azure.com/']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\a\_work\1\s\lisa\lisa\runners\lisa_runner.py", line 295, in _deploy_environment_task
self.platform.deploy_environment(environment)
File "D:\a\_work\1\s\lisa\lisa\platform_.py", line 184, in deploy_environment
self._deploy_environment(environment, log)
File "D:\a\_work\1\s\lisa\lisa\sut_orchestrator\azure\platform_.py", line 638, in _deploy_environment
raise identifier
File "D:\a\_work\1\s\lisa\lisa\sut_orchestrator\azure\platform_.py", line 609, in _deploy_environment
location, deployment_parameters = self._create_deployment_parameters(
File "D:\a\_work\1\s\lisa\lisa\sut_orchestrator\azure\platform_.py", line 1233, in _create_deployment_parameters
node_arm_parameters = self._create_node_arm_parameters(node.capability, log)
File "D:\a\_work\1\s\lisa\lisa\sut_orchestrator\azure\platform_.py", line 1488, in _create_node_arm_parameters
self._get_sig_os_disk_size(arm_parameters.shared_gallery),
File "D:\a\_work\1\s\lisa\lisa\sut_orchestrator\azure\platform_.py", line 2540, in _get_sig_os_disk_size
found_image = self._get_sig_version(shared_image)
File "D:\a\_work\1\s\lisa\lisa\sut_orchestrator\azure\platform_.py", line 2487, in _get_sig_version
sig_version = compute_client.gallery_image_versions.get(
File "C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\azure\core\tracing\decorator.py", line 78, in wrapper_use_tracer
return func(*args, **kwargs)
File "C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\azure\mgmt\compute\v2022_03_03\operations\_operations.py", line 3580, in get
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
```

### Related command

'az account get-access-token --output json --resource'

### Errors

see above

### Issue script & Debug output

see above

### Expected behavior

see above

### Environment Summary

WARNING: You have 2 update(s) available. Consider updating your CLI installation with 'az upgrade'
azure-cli 2.59.0 *

core 2.59.0 *
telemetry 1.1.0

Extensions:
azure-devops 1.0.0

Dependencies:
msal 1.27.0
azure-mgmt-resource 23.1.0b2

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.