Starting with version 10.6.0 Microsoft broke the Mac RDP client resulting in various error codes when attempting to connect to an RDP gateway. https://remotedesktop.uservoice.com/forums/287834-remote-desktop-client-for-mac/filters/hot?category_id=369013
The only workaround for now is to downgrade the RDP client on Apple Mac devices. Instructions on how to do this are bellow. In principle, Pellcomp do not recommend downgrading software and end users do so at their own risk.
Open a web browser and browse to https://install.appcenter.ms/orgs/rdmacios-k2vy/apps/microsoft-remote-desktop-for-mac/distribution_groups/all-users-of-microsoft-remote-desktop-for-mac
Download version 10.5.1 (1852)