Azure CLI under WSL2
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 60
Description
## Describe the bug
This error occurs when executing `az functionapp config appsettings set` in WSL2 (Ubuntu-20.04). For parsing the `--settings` values, it's requesting the parent (or grandparent) of the executing proc_name [see here](https://github.com/Azure/azure-cli/blob/a12f5762e02d6d41927280557046eb76241194f2/src/azure-cli-core/azure/cli/core/util.py#L1254), but this throws an AccessDenied error.
**Command Name**
`az functionapp config appsettings set`
**Errors:**
```
The command failed with an unexpected error. Here is the traceback:
psutil.AccessDenied (pid=18944)
Traceback (most recent call last):
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/util.py", line 506, in shell_safe_json_parse
File "json\__init__.py", line 370, in loads
File "json\decoder.py", line 337, in decode
File "json\decoder.py", line 355, in raw_decode
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/util.py", line 512, in shell_safe_json_parse
File "ast.py", line 59, in literal_eval
File "ast.py", line 47, in parse
File "", line 1
ASPNETCORE_ENVIRONMENT=development
^
SyntaxError: invalid syntax
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\psutil/_common.py", line 447, in wrapper
AttributeError: _cache
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\psutil/_pswindows.py", line 679, in wrapper
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\psutil/_common.py", line 450, in wrapper
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\psutil/_pswindows.py", line 766, in exe
PermissionError: [WinError 24] The program issued a command but the command length is incorrect: '(originated from NtQuerySystemInformation)'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 231, in invoke
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 657, in execute
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 712, in _run_job
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/appservice/commands.py", line 37, in _ex_handler
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 691, in _run_job
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 328, in __call__
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/appservice/custom.py", line 260, in update_app_settings
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/util.py", line 525, in shell_safe_json_parse
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/util.py", line 1266, in get_parent_proc_name
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/util.py", line 1254, in _get_parent_proc_name
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\psutil/__init__.py", line 617, in name
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\psutil/_pswindows.py", line 750, in name
File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\psutil/_pswindows.py", line 681, in wrapper
psutil.AccessDenied: psutil.AccessDenied (pid=18944)
```
## To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
- `az functionapp config appsettings set --ids {} --settings ASPNETCORE_ENVIRONMENT=development FUNCTIONS_EXTENSION_VERSION=~3`
## Expected Behavior
The command runs without errors (as it does on a Hosted Agent)
## Environment Summary
```
Windows-10-10.0.19041-SP0
Python 3.8.9
Installer:
azure-cli 2.26.1
azure-cli-iot-ext 0.8.9
Extensions:
application-insights 0.1.14
azure-cli-iot-ext 0.8.9
log-analytics-solution 0.1.1
notification-hub 0.2.0
```
## Additional Context
Azure CLI was installed via Azure Agent setup (https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/v2-linux?view=azure-devops), later executed `sudo apt remove azure-cli -y && sudo apt autoremove -y` and `curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash` to ensure the latest AZ CLI version.
Ran following commands in python3:
```python
>>> import psutil
>>> import os
>>> psutil.Process(os.getpid())
psutil.Process(pid=2564, name='python3', status='running', started='15:14:04')
>>> psutil.Process(os.getpid()).parent()
psutil.Process(pid=24486, name='bash', status='sleeping', started='13:11:19')
>>> psutil.Process(os.getpid()).parent().parent()
psutil.Process(pid=24485, name='init', status='sleeping', started='13:11:19')
```
Contributor guide
Assessment
This issue has not been assessed yet.