Azure / Azure/azure-cli

UnicodeDecodeError in Azure Cloud Shell

Open
#16,434 1 comment 0 reactions 1 assignee Claimed by @zhoxing-ms View on GitHub
act-identity-squad ARM feature-request
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

> ### `az feedback` auto-generates most of the information requested below, as of CLI version 2.0.62

**Describe the bug**
Upon entering any `az` command in Azure Cloud Shell, e.g. `az group create --name mytestgroup --location eastus`, I receive the error message shown below. This occurs in my MPN Azure subscription, but not in a customer subscription.

Restarting Azure Cloud Shell does not resolve the problem. I have not made changes to my .bashrc file since my last successful use of the Azure Cloud Shell.

FWIW, I can issue commands successfully from an Azure shell terminal session in VS Code on my local computer.

```
michael@Azure:~$ az group create --name mytestgroup --location eastus
Traceback (most recent call last):
File "/opt/az/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/opt/az/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/opt/az/lib/python3.6/site-packages/azure/cli/__main__.py", line 38, in
az_cli = get_default_cli()
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 853, in get_default_cli
help_cls=AzCliHelp)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 65, in __init__
ACCOUNT.load(os.path.join(azure_folder, 'azureProfile.json'))
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/_session.py", line 49, in load
self.data = json.load(f)
File "/opt/az/lib/python3.6/json/__init__.py", line 296, in load
return loads(fp.read(),
File "/opt/az/lib/python3.6/codecs.py", line 700, in read
return self.reader.read(size)
File "/opt/az/lib/python3.6/codecs.py", line 503, in read
newchars, decodedbytes = self.decode(data, self.errors)
File "/opt/az/lib/python3.6/encodings/utf_8_sig.py", line 117, in decode
return codecs.utf_8_decode(input, errors)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x99 in position 0: invalid start byte
```
**To Reproduce**

Noted above
**Expected behavior**

I expect to be able to run `az` CLI commands in Azure Cloud Shell.

**Environment summary**

Azure Cloud Shell in Azure Portal, or via https://shell.azure.com/.
**Additional context**

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.