Azure CLI 2.40.0 breaks stdin passing on PowerShell
See original GitHub issueDescribe the bug
We’re executing an Azure CLI extension in PowerShell which requires interactive input, and that input is passed through stdin using the following code:
$user_in = "..."
$user_in | az arcappliance createconfig vmware --resource-group $resourceGroup --name $resourceName --location $location
This was working fine until the latest Azure CLI version (2.40.0).
Command Name
az arcappliance createconfig vmware
Extension Name: arcappliance.
Version: 0.2.16.
(note: we are using an older arcappliance extension version for testing purposes)
Errors:
ERROR: The command failed with an unexpected error. Here is the traceback:
ERROR: EOF when reading a line
Traceback (most recent call last):
File "C:\hostedtoolcache\windows\Python\3.7.9\x64\lib\site-packages\knack\cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
File "C:\hostedtoolcache\windows\Python\3.7.9\x64\lib\site-packages\azure\cli\core\commands\__init__.py", line 663, in execute
raise ex
File "C:\hostedtoolcache\windows\Python\3.7.9\x64\lib\site-packages\azure\cli\core\commands\__init__.py", line 726, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "C:\hostedtoolcache\windows\Python\3.7.9\x64\lib\site-packages\azure\cli\core\commands\__init__.py", line 697, in _run_job
result = cmd_copy(params)
File "C:\hostedtoolcache\windows\Python\3.7.9\x64\lib\site-packages\azure\cli\core\commands\__init__.py", line 333, in __call__
return self.handler(*args, **kwargs)
File "C:\hostedtoolcache\windows\Python\3.7.9\x64\lib\site-packages\azure\cli\core\commands\command_operation.py", line 121, in handler
return op(**command_args)
File "C:\Program Files\Common Files\AzureCliExtensionDirectory\arcappliance\azext_arcappliance\custom.py", line 193, in create_config
provider.create_config(infra_config_path, working_dir)
File "C:\Program Files\Common Files\AzureCliExtensionDirectory\arcappliance\azext_arcappliance\pkg\providers\vmware\provider.py", line 109, in create_config
vsphere_configuration = self.__prep_for_kva(None, credentials_only=True)
File "C:\Program Files\Common Files\AzureCliExtensionDirectory\arcappliance\azext_arcappliance\pkg\providers\vmware\provider.py", line 62, in __prep_for_kva
self.vsphere_credentials = prompt_vsphere_credentials()
File "C:\Program Files\Common Files\AzureCliExtensionDirectory\arcappliance\azext_arcappliance\pkg\providers\vmware\provider.py", line 176, in prompt_vsphere_credentials
credentials_address = prompt_operations.prompt_input_string(prompt_messages.VSPHERE_ADDRESS)
File "C:\Program Files\Common Files\AzureCliExtensionDirectory\arcappliance\azext_arcappliance\pkg\prompt\operations.py", line 39, in prompt_input_string
user_input = input(prompt_msg)
EOFError: EOF when reading a line
To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
- Use Azure CLI 2.40.0
- Install
arcappliance
extension:az extension add --name arcappliance --version 0.2.16
- PowerShell:
"your_values_here" | az arcappliance createconfig vmware --resource-group {} --name {} --location {}
Expected Behavior
The input
function should be able to use the data passed through stdin.
Environment Summary
Windows-10-10.0.22000-SP0
Python 3.10.5
Installer: PIP
azure-cli 2.40.0
Extensions:
arcappliance 0.2.16
Dependencies:
msal 1.18.0b1
azure-mgmt-resource 21.1.0b1
Additional Context
I think this might be caused by the following PR that got released with 2.40.0: https://github.com/Azure/azure-cli/pull/23514
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Passing Parameters with Azure CLI - MSDN - Microsoft
Hi,. In PowerShell you can do such commands to pass parameters to a variable: $keyEncryptionKeyUrl = (Get-AzureKeyVaultKey -VaultName ...
Read more >GitHub: CVE-2022-39327 Improper Control of ... - Vulners
Azure CLI is the command-line interface for Microsoft Azure. In versions previous to 2.40.0, Azure CLI contains a vulnerability for ...
Read more >How to pass parameter containing spaces to Azure CLI ...
It returns "Bad Request" because $ruleName contains space. If I run the Azure CLI command directly from PowerShell command window with quoted ...
Read more >AZ Cli reports warnings that breaks Releases
Azure Devops Azure CLI task is now using azure-cli version 2.0.73 where yesterday it was ... As said earlier the issue is with...
Read more >Evaluate Azure CLI vs. PowerShell for resource management
PowerShell and Azure CLI have subtle differences. Look at these code snippets and see which is best for resource management.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes. We will rollback the change.
This fix is already shipped today.