Describe the bug
Running Bicep from the terminal works fine - running the DevOps pipeline results in errors.
Related command
az deployment sub create
Errors
2023-11-06T07:46:10.8624527Z Resource changes: 29 to create.DEBUG: cli.knack.prompting: No tty available.
2023-11-06T07:46:10.8625345Z DEBUG: cli.azure.cli.core.azclierror: Traceback (most recent call last):
2023-11-06T07:46:10.8626614Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 697, in _run_job
2023-11-06T07:46:10.8628216Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 333, in call
2023-11-06T07:46:10.8629884Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
2023-11-06T07:46:10.8631833Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/resource/custom.py", line 458, in deploy_arm_template_at_subscription_scope
2023-11-06T07:46:10.8633569Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/prompting.py", line 71, in prompt_y_n
2023-11-06T07:46:10.8635038Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/prompting.py", line 79, in _prompt_bool
2023-11-06T07:46:10.8636396Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/prompting.py", line 28, in verify_is_a_tty
2023-11-06T07:46:10.8637210Z knack.prompting.NoTTYException
2023-11-06T07:46:10.8637410Z
2023-11-06T07:46:10.8637786Z During handling of the above exception, another exception occurred:
2023-11-06T07:46:10.8638218Z
2023-11-06T07:46:10.8638436Z Traceback (most recent call last):
2023-11-06T07:46:10.8639591Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/arm.py", line 109, in handle_template_based_exception
2023-11-06T07:46:10.8640918Z AttributeError: 'NoTTYException' object has no attribute 'inner_exception'
2023-11-06T07:46:10.8641401Z
2023-11-06T07:46:10.8641765Z During handling of the above exception, another exception occurred:
2023-11-06T07:46:10.8642342Z
2023-11-06T07:46:10.8642565Z Traceback (most recent call last):
2023-11-06T07:46:10.8643409Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
2023-11-06T07:46:10.8644831Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 663, in execute
2023-11-06T07:46:10.8646440Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 726, in _run_jobs_serially
2023-11-06T07:46:10.8648724Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 718, in run_job
2023-11-06T07:46:10.8650485Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/arm.py", line 114, in handle_template_based_exception
2023-11-06T07:46:10.8651535Z knack.util.CLIError
2023-11-06T07:46:10.8651721Z
2023-11-06T07:46:10.8651940Z ERROR: cli.azure.cli.core.azclierror:
2023-11-06T07:46:10.8652345Z ERROR: az_command_data_logger:
2023-11-06T07:46:10.8653138Z DEBUG: cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x000001D722FBC8B0>]
2023-11-06T07:46:10.8654006Z INFO: az_command_data_logger: exit code: 1
2023-11-06T07:46:10.8654601Z INFO: cli.main: Command ran in 40.453 seconds (init: 0.312, invoke: 40.141)
2023-11-06T07:46:10.8898196Z INFO: telemetry.main: Begin splitting cli events and extra events, total events: 1
2023-11-06T07:46:10.8899401Z INFO: telemetry.client: Accumulated 0 events. Flush the clients.
2023-11-06T07:46:10.8900263Z INFO: telemetry.main: Finish splitting cli events and extra events, cli events: 1
2023-11-06T07:46:10.8904700Z INFO: telemetry.save: Save telemetry record of length 3514 in cache
2023-11-06T07:46:10.8905557Z INFO: telemetry.main: Begin creating telemetry upload process.
2023-11-06T07:46:10.8911879Z INFO: telemetry.process: Creating upload process: "C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\cli\telemetry_init.pyc D:\a_temp.azclitask"
2023-11-06T07:46:10.8952925Z INFO: telemetry.process: Return from creating process
2023-11-06T07:46:10.9007881Z
2023-11-06T07:46:10.9053959Z INFO: telemetry.main: Finish creating telemetry upload process.
2023-11-06T07:46:11.2788896Z Something went wrong. Please check the error and try again.
2023-11-06T07:46:11.5629439Z [command]C:\Windows\system32\cmd.exe /D /S /C ""C:\Program Files\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" account clear"
2023-11-06T07:46:12.4698936Z ##[section]Finishing: AzureCLI
Issue script & Debug output
az deployment sub create --name $deploymentID
--location $location --template-file ./Build.bicep
--parameters deployDefenderForCloud=$deployDefenderForCloud deployVM=$deployVM subscriptionID=$subscriptionID loggedinUserObjectId=$loggedinUserObjectId deployedBy=$deployedBy tenantId=$tenantID customerName=$customerName environmentName=$environmentName location=$location locationshortcode=$LocationShortCode sqlAdminPassword=$sqlPassword localAdminPassword=$localPassword --confirm-with-what-if
--debug `
--output json
Expected behavior
This DevOps pipeline doesn't run but the code runs from the terminal just fine
Environment Summary
Using the DevOps Task AzureCLI@2
Additional context
Ive ran the same code locally via bicep and az cli and it works just fine
Describe the bug
Running Bicep from the terminal works fine - running the DevOps pipeline results in errors.
Related command
az deployment sub create
Errors
2023-11-06T07:46:10.8624527Z Resource changes: 29 to create.DEBUG: cli.knack.prompting: No tty available.
2023-11-06T07:46:10.8625345Z DEBUG: cli.azure.cli.core.azclierror: Traceback (most recent call last):
2023-11-06T07:46:10.8626614Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 697, in _run_job
2023-11-06T07:46:10.8628216Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 333, in call
2023-11-06T07:46:10.8629884Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
2023-11-06T07:46:10.8631833Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/resource/custom.py", line 458, in deploy_arm_template_at_subscription_scope
2023-11-06T07:46:10.8633569Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/prompting.py", line 71, in prompt_y_n
2023-11-06T07:46:10.8635038Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/prompting.py", line 79, in _prompt_bool
2023-11-06T07:46:10.8636396Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/prompting.py", line 28, in verify_is_a_tty
2023-11-06T07:46:10.8637210Z knack.prompting.NoTTYException
2023-11-06T07:46:10.8637410Z
2023-11-06T07:46:10.8637786Z During handling of the above exception, another exception occurred:
2023-11-06T07:46:10.8638218Z
2023-11-06T07:46:10.8638436Z Traceback (most recent call last):
2023-11-06T07:46:10.8639591Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/arm.py", line 109, in handle_template_based_exception
2023-11-06T07:46:10.8640918Z AttributeError: 'NoTTYException' object has no attribute 'inner_exception'
2023-11-06T07:46:10.8641401Z
2023-11-06T07:46:10.8641765Z During handling of the above exception, another exception occurred:
2023-11-06T07:46:10.8642342Z
2023-11-06T07:46:10.8642565Z Traceback (most recent call last):
2023-11-06T07:46:10.8643409Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
2023-11-06T07:46:10.8644831Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 663, in execute
2023-11-06T07:46:10.8646440Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 726, in _run_jobs_serially
2023-11-06T07:46:10.8648724Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 718, in run_job
2023-11-06T07:46:10.8650485Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/arm.py", line 114, in handle_template_based_exception
2023-11-06T07:46:10.8651535Z knack.util.CLIError
2023-11-06T07:46:10.8651721Z
2023-11-06T07:46:10.8651940Z ERROR: cli.azure.cli.core.azclierror:
2023-11-06T07:46:10.8652345Z ERROR: az_command_data_logger:
2023-11-06T07:46:10.8653138Z DEBUG: cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x000001D722FBC8B0>]
2023-11-06T07:46:10.8654006Z INFO: az_command_data_logger: exit code: 1
2023-11-06T07:46:10.8654601Z INFO: cli.main: Command ran in 40.453 seconds (init: 0.312, invoke: 40.141)
2023-11-06T07:46:10.8898196Z INFO: telemetry.main: Begin splitting cli events and extra events, total events: 1
2023-11-06T07:46:10.8899401Z INFO: telemetry.client: Accumulated 0 events. Flush the clients.
2023-11-06T07:46:10.8900263Z INFO: telemetry.main: Finish splitting cli events and extra events, cli events: 1
2023-11-06T07:46:10.8904700Z INFO: telemetry.save: Save telemetry record of length 3514 in cache
2023-11-06T07:46:10.8905557Z INFO: telemetry.main: Begin creating telemetry upload process.
2023-11-06T07:46:10.8911879Z INFO: telemetry.process: Creating upload process: "C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\cli\telemetry_init.pyc D:\a_temp.azclitask"
2023-11-06T07:46:10.8952925Z INFO: telemetry.process: Return from creating process
2023-11-06T07:46:10.9007881Z
2023-11-06T07:46:10.9053959Z INFO: telemetry.main: Finish creating telemetry upload process.
2023-11-06T07:46:11.2788896Z Something went wrong. Please check the error and try again.
2023-11-06T07:46:11.5629439Z [command]C:\Windows\system32\cmd.exe /D /S /C ""C:\Program Files\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" account clear"
2023-11-06T07:46:12.4698936Z ##[section]Finishing: AzureCLI
Issue script & Debug output
az deployment sub create
--name $deploymentID--location $location
--template-file ./Build.bicep--parameters deployDefenderForCloud=$deployDefenderForCloud deployVM=$deployVM subscriptionID=$subscriptionID loggedinUserObjectId=$loggedinUserObjectId deployedBy=$deployedBy tenantId=$tenantID customerName=$customerName environmentName=$environmentName location=$location locationshortcode=$LocationShortCode sqlAdminPassword=$sqlPassword localAdminPassword=$localPassword
--confirm-with-what-if--debug `
--output json
Expected behavior
This DevOps pipeline doesn't run but the code runs from the terminal just fine
Environment Summary
Using the DevOps Task AzureCLI@2
Additional context
Ive ran the same code locally via bicep and az cli and it works just fine