Repository navigation
AzureCLI Task Intermittently Bypasses Proxy on Self-Hosted Linux Agent (WIF/OIDC) #402
Description
Summary
We are observing inconsistent proxy behavior in AzureCLI@2 / AzureCLI@3 tasks when running pipelines on a self-hosted Azure DevOps Linux agent in a restricted network environment.
The environment requires all outbound traffic to go through an HTTP proxy (localhost:3128), with no direct internet access allowed.
However, some Azure service connections work correctly through the proxy, while others (configured identically) bypass the proxy and fail.
Environment
- Self-hosted Linux agent
- Proxy: Local NTLM proxy (
localhost:3128) - Pipeline task:
AzureCLI@2/AzureCLI@3 - Authentication: AzureRM Service Connection using Workload Identity Federation (OIDC)
Expected Behavior
All AzureCLI task executions should:
- Route outbound traffic via the configured proxy
- Successfully connect to endpoints such as
dev.azure.com - Complete authentication using OIDC/WIF
Actual Behavior
Working Service Connection
- AzureCLI task authenticates successfully
- Proxy is used correctly
- Logs (
NODE_DEBUG=net) show:createConnection localhost:3128 → proxy tunnel → dev.azure.com:443
Failing Service Connection
- AzureCLI task fails during initial authentication phase
- Proxy is bypassed
- Logs show a direct connection attempt:
createConnection dev.azure.com:443 - Since direct internet access is blocked → connection fails (timeout / TLS error)
Key Observations
-
Failure occurs before script execution
- The issue happens during the built-in AzureCLI authentication phase
- User scripts are never reached
-
Proxy works outside AzureCLI task
- Tools like
curl, bash scripts, and direct OIDC calls correctly use the proxy
- Tools like
-
Service connections are identically configured
- Created via Terraform
- No visible configuration differences
Root Cause Analysis (from Engineering Investigation)
- The AzureCLI task internally uses a REST client library that evaluates proxy bypass logic using the full URL string (character-by-character) rather than just the hostname.
- The environment includes a
no_proxyconfiguration with patterns like:10.*, 192.*, 127.* - During authentication, requests include a service connection identifier (GUID) in the URL.
Issue Trigger:
If the GUID contains a sequence such as "10", the library incorrectly matches it against the no_proxy pattern.
Outcome:
- Request is misclassified as internal traffic
- Proxy is bypassed unintentionally
- Connection fails in restricted environments
Impact
- Non-deterministic behavior depending on service connection ID
- Identical configurations produce different outcomes
- Breaks pipeline reliability in restricted network environments
Ask
We request a fix to ensure:
- Proxy evaluation is performed only against the hostname, not the full URL
no_proxymatching does not incorrectly trigger based on GUID values in the request
This issue leads to unpredictable failures and should be addressed to ensure consistent and reliable proxy handling in AzureCLI tasks.
Please find the RCA detail as per investigation:
-
Failure scenario
AzureCLI@2/@3fails during WIF authentication on a self-hosted Linux agent behind a proxy, with requests bypassing the proxy and resulting inECONNRESET. -
Expected vs actual behavior
All outbound traffic should go vialocalhost:3128, but one OIDC token request is sent directly todev.azure.com:443, causing network rejection. -
Trigger point in flow
Failure occurs during OIDC token generation (createOidcToken) where the POST request includes the service connection GUID in the URL query string. -
Key dependency behavior
typed-rest-client(used viaazure-devops-node-api) determines proxy usage using theNO_PROXYenvironment variable. -
Root defect
NO_PROXYentries are treated as raw, unanchored regex patterns and matched against the entire request URL (not just hostname). -
Misconfiguration interaction
Customer used curl-style patterns like10.*,192.168.*, which become regex/10.*/i, matching any occurrence of10anywhere in the URL. -
Why only one service connection fails
- Failing SC GUID contains substring
10→ regex match → proxy bypass - Working SC GUID does not → proxy is correctly used
- Failing SC GUID contains substring
-
Failure mechanism
Regex match → proxy bypass → direct socket todev.azure.com→ blocked by network →ECONNRESETbefore task execution. -
Why other attempts failed
- Setting
HTTP_PROXY/HTTPS_PROXYdoesn’t help because bypass logic overrides it .proxybypassand task flags don’t affecttyped-rest-clientbehavior- Issue is independent of tenant, auth, or SC configuration
- Setting
-
True root cause summary
Library defect intyped-rest-client: improper handling ofNO_PROXY(regex-based, full URL match instead of host-only match), leading to unintended proxy bypass based on GUID content.
Activity
pichuang commentedon Jul 14, 2026
Hi ellendular We’ve recently run into the same issue on our end and are hoping to get it resolved as soon as possible. Could you please take a look at the PR when you have a moment?
github-actions commentedon Oct 12, 2026
This issue has had no activity in 90 days. Please comment if it is not actually stale