"Connect-AzAccount:…
- User
"Connect-AzAccount: C:\a_tasks\AzurePowerShell_72a1931b-effb-4d2e-8fd8-f8472a07cb62\5.257.0\ps_modules\VstsAzureHelpers_\InitializeAzModuleFunctions.ps1:470 Line | 470 | & $command @args | ~~~~~~~~~~~~~~~~ | No such host is known. (management.azure.com:443)" Why does it fail in pipeline?
- Assistant
This error indicates that the build agent can't resolve or reach the Azure management endpoint
management.azure.com. Here are the most common causes and solutions:Network Connectivity Issues
If using a self-hosted agent:
- The agent may be behind a firewall or proxy that's blocking outbound connections to Azure endpoints
- DNS resolution might be failing for Azure domains
- Required Azure service endpoints may not be whitelisted
Solutions:
- Ensure these Azure endpoints are accessible from your build agent:
management.azure.comlogin.microsoftonline.comgraph.microsoft.com
- Check your organization's firewall/proxy settings
- Test connectivity manually:
Test-NetConnection management.azure.com -Port 443
Agent Configuration
For self-hosted agents:
- Configure proxy settings if your network requires it
- Ensure the agent service account has appropriate network permissions
For Microsoft-hosted agents:
- This is less common but can happen during Azure service outages
- Try using a different agent pool or region
Temporary Workarounds
Add retry logic to your pipeline:
- task: AzurePowerShell@5 inputs: azureSubscription: 'your-service-connection' ScriptType: 'InlineScript' Inline: | $retryCount = 0 $maxRetries = 3 do { try { Connect-AzAccount -ServicePrincipal -Credential $credential -Tenant $tenantId break } catch { $retryCount++ if ($retryCount -eq $maxRetries) { throw } Start-Sleep -Seconds 30 } } while ($retryCount -lt $maxRetries)The issue is almost always network-related when you see "No such host is known" errors in pipelines.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.