Skip to main content

Bastion Tunnel and File Transfer

Synopsis​

Intended end result: Establish secure VM access and reliably transfer model artifacts when direct SSH is unavailable.

How this page gets you there: Create a Bastion tunnel, verify connectivity, transfer files, and validate remote artifacts end-to-end.

Use Bastion tunneling when direct SSH is not available.

Start the tunnel in one terminal:

az login
az account set --subscription <subscription-name-or-id>
$vmId = az vm show -g ai4gl-condor-uat-rg -n ai4gl-condor-uat-vm --query id -o tsv
az network bastion tunnel --name ai4gl-condor-uat-bas --resource-group ai4gl-condor-uat-rg --target-resource-id $vmId --resource-port 22 --port 50022

Copy a file through the tunnel from another terminal:

scp -P 50022 "C:\Users\your_local_user_account\your_local_directory_structure\Alert.CA.CONDOR\model_repository\ai4gsmokefirev1\7\model.onnx" <vm_username>@127.0.0.1:/mnt/datadisk/condor/model_repository/ai4gsmokefirev1/7/model.onnx

Verify the copy:

ssh -p 50022 <vm_username>@127.0.0.1 "ls -lh /mnt/datadisk/condor/model_repository/ai4gsmokefirev1/7/model.onnx"

If tunneling is disabled on the Bastion host:

az network bastion show --name ai4gl-condor-uat-bas --resource-group ai4gl-condor-uat-rg --query "{sku:sku.name,enableTunneling:enableTunneling,enableIpConnect:enableIpConnect}" -o table

az network bastion update --name ai4gl-condor-uat-bas --resource-group ai4gl-condor-uat-rg --enable-tunneling true