Audience: End users Time: 5 minutes Skill Level: Beginner
If you're using azlin in WSL2 and encounter Bastion tunnel failures, this guide will help you fix the problem.
When you run azlin list or any command that uses Bastion tunnels, you see:
Failed to create tunnel for VM <vm-name> (attempt 1/3):
Tunnel failed to become ready within 30 seconds-
Run any azlin command in WSL2:
azlin list
-
If the problem is detected, you'll see a prompt:
═══════════════════════════════════════════════════════════ AZURE CLI INSTALLATION REQUIRED ═══════════════════════════════════════════════════════════ Install Linux Azure CLI now? [y/N]: -
Type
yand press Enter -
Enter your sudo password when prompted
-
Wait 2-3 minutes for installation to complete
-
Run
az loginto authenticate with your Azure account in WSL2 -
Done! Run your
azlincommand again - it should work now
If you prefer to install manually:
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bashwhich az
# Should show: /usr/bin/az (not /mnt/c/...)az loginazlin listAfter installation, verify everything works:
# Check Azure CLI location
which az
# Expected: /usr/bin/az
# Check Azure CLI version
az --version
# Expected: azure-cli 2.x.x
# Test Bastion tunnel (may take 30 seconds)
azlin list
# Expected: VM list with no tunnel errorsSymptom: Installation fails with "Permission denied"
Solution: Make sure you have sudo access:
sudo echo "Testing sudo..."
# If this works, retry installationSymptom: Download times out or fails
Solution: Check your internet connection and retry:
# Test connectivity
curl -I https://aka.ms/InstallAzureCLIDeb
# Retry installation
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bashSymptom: Both /mnt/c/.../az and /usr/bin/az exist
Solution: azlin automatically prefers Linux version. You can verify:
# Check which one azlin uses
azlin --version # Will use /usr/bin/azSymptom: Tunnel failures persist after installation
Solution: See Troubleshooting Guide for detailed diagnostics.