Only Surface Duo AT&T devices may need an unlock code. Surface Duo 2 and Surface Duo non-AT&T devices do not need unlock codes as they are unlocked devices.
AT&T can assist you further with your request. First, you need to submit a SIM unlock code request to AT&T by visiting http://att.com/deviceunlock . You will need to provide the device IMEI (tap Settings, tap About and provide the IMEI number) and other requested information. AT&T will communicate order processing information via e-mail. If your phone is locked to AT&T but was not obtained through AT&T, either through another retailer or a replacement via a warranty exchange, then please allow additional time for AT&T to obtain the unlock code and respond to your request.
After submitting the request, you will receive an email from AT&T to validate your email address is correct. If you are unable to find that email, check your junk mail to see if it is there. You will need to respond to that email within 24 hours to validate your email address. If you do not respond within 24 hours, you will need to go back to http://att.com/deviceunlock and submit a new request and then need to validate your email.
After validating your email address, you will receive another email from AT&T on the status of your request once it has been processed. It may take up to 5 business days to receive a response. If AT&T indicates that they are unable to provide you with an unlock code for your device, then contact Microsoft Support for additional assistance.