Skip to content

Azure CLI 2.40.0 breaks stdin passing on PowerShell #23883

Description

@AzureMarker

Describe 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:
#23514

Metadata

Metadata

Assignees

Labels

Auto-AssignAuto assign by botCXP AttentionThis issue is handled by CXP team.InstallationbugThis issue requires a change to an existing behavior in the product in order to be resolved.issue-addressedThis issue is addressed and ready to close.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions