Thank you for the quick response. I have now reconfigured the Active Directory so that unauthenticated LDAP binds are no longer allowed and so it works correctly. If anyone else has the problem, I used this guide https://blog.lithnet.io/2018/12/disabling-unauthenticated-binds-in.html