Describe the bug
az resource wait --custom honors --timeout, but when the custom condition remains false for the entire timeout, the command prints {} and exits with code 0.
A true condition also exits with code 0, so scripts and CI systems cannot distinguish condition satisfaction from timeout.
The current dev source still contains the apparent root cause in src/azure-cli-core/azure/cli/core/commands/command_operation.py: WaitCommandOperation.wait returns a CLIError object on timeout instead of raising it.
progress_indicator.end()
return CLIError('Wait operation timed-out after {} seconds'.format(timeout))
This appears to affect generic Azure CLI wait commands, not only this resource type.
Related command
az resource wait --ids "<RESOURCE_ID>" --custom "properties.connectivityStatus=='Connecting'" --interval 5 --timeout 30
Errors
No error is emitted. The timeout result is:
{}
exit code: 0
elapsed time: 33 seconds
Issue script and debug output
Given an existing ARM resource whose properties.connectivityStatus is Connected:
az resource show \
--ids "<RESOURCE_ID>" \
--query "{connectivityStatus:properties.connectivityStatus,provisioningState:properties.provisioningState}" \
-o json
Result:
{
"connectivityStatus": "Connected",
"provisioningState": "Succeeded"
}
Positive control - true condition:
az resource wait \
--ids "<RESOURCE_ID>" \
--custom "properties.connectivityStatus=='Connected'" \
--interval 15 \
--timeout 900
echo $?
Observed:
exit code: 0
elapsed time: 1.6 seconds
Negative test - false condition:
start_time=$(date +%s)
az resource wait \
--ids "<RESOURCE_ID>" \
--custom "properties.connectivityStatus=='Connecting'" \
--interval 5 \
--timeout 30
wait_exit_code=$?
elapsed_seconds=$(($(date +%s) - start_time))
printf 'wait_exit_code=%s\nelapsed_seconds=%s\n' \
"$wait_exit_code" \
"$elapsed_seconds"
Observed:
{}
wait_exit_code=0
elapsed_seconds=33
Impossible-condition test:
start_time=$(date +%s)
output=$(az resource wait \
--ids "<RESOURCE_ID>" \
--custom "properties.connectivityStatus=='DefinitelyNotAStatus'" \
--interval 2 \
--timeout 10 2>&1)
wait_exit_code=$?
elapsed_seconds=$(($(date +%s) - start_time))
printf 'output=%s\nwait_exit_code=%s\nelapsed_seconds=%s\n' \
"$output" \
"$wait_exit_code" \
"$elapsed_seconds"
Observed:
output={}
wait_exit_code=0
elapsed_seconds=12
The impossible value rules out a transient state transition. No resource identifiers or debug output are included because they are unnecessary for reproduction.
Expected behavior
When --timeout expires before --custom evaluates to true, the command should:
- Exit with a nonzero code.
- Emit
Wait operation timed-out after <seconds> seconds or another clear timeout error.
- Remain distinguishable from successful condition satisfaction in automation.
Environment Summary
Azure CLI: 2.89.1
azure-cli-core: 2.89.1
azure-cli-telemetry: 1.1.0
OS: Linux 6.17.0-1022-azure, x86_64
Shell: GNU bash 5.2.21
Resource type: Microsoft.Kubernetes/connectedClusters
The same timeout code path remains present on current dev commit b92a89e7781c11a5ee8437a84ef4b8fd9edab4f0 (August 27, 2026).
Additional context
Related but not duplicate:
Describe the bug
az resource wait --customhonors--timeout, but when the custom condition remains false for the entire timeout, the command prints{}and exits with code0.A true condition also exits with code
0, so scripts and CI systems cannot distinguish condition satisfaction from timeout.The current
devsource still contains the apparent root cause insrc/azure-cli-core/azure/cli/core/commands/command_operation.py:WaitCommandOperation.waitreturns aCLIErrorobject on timeout instead of raising it.This appears to affect generic Azure CLI wait commands, not only this resource type.
Related command
Errors
No error is emitted. The timeout result is:
Issue script and debug output
Given an existing ARM resource whose
properties.connectivityStatusisConnected:Result:
{ "connectivityStatus": "Connected", "provisioningState": "Succeeded" }Positive control - true condition:
Observed:
Negative test - false condition:
Observed:
Impossible-condition test:
Observed:
The impossible value rules out a transient state transition. No resource identifiers or debug output are included because they are unnecessary for reproduction.
Expected behavior
When
--timeoutexpires before--customevaluates to true, the command should:Wait operation timed-out after <seconds> secondsor another clear timeout error.Environment Summary
The same timeout code path remains present on current
devcommitb92a89e7781c11a5ee8437a84ef4b8fd9edab4f0(August 27, 2026).Additional context
Related but not duplicate:
0on failure.