For Windows agents, if you want to use SSH then the image needs to be custom-prepared with an SSH server preinstalled.
When using connecting to the controller, ensure the following:
1) Jenkins URL (Manage Jenkins --> System --> Jenkins Location)
This URL needs to be reachable by the agent, so make sure to configure the firewall rules accordingly.
2) TCP port for JNLP agent agents (Manage Jenkins --> Security --> TCP port for inbound agents).
This port needs to be reachable from the agent. It is recommended to use a fixed port
so that the necessary firewall exceptions can be specified.