Hello ahd,
Welcome to the Microsoft Q&A and thank you for posting your questions here.
I understand that you would like to test or debug api requests in an APIM with the disabled public network access.
This might not be too challenging but depends on the steps you take.
The error "The remote name could not be resolved" shows a DNS issue. Test the remote DNS and verify that your network configuration allows traffic between the application gateway and the APIM instance, and the private endpoint is correctly set up and accessible.
So, to enable tracing, preform trace and Debugging with Visual Studio Code use these links for more details - https://learn.microsoft.com/en-us/azure/api-management/api-management-howto-api-inspector and https://learn.microsoft.com/en-us/azure/api-management/api-management-debug-policies
I hope this is helpful! Do not hesitate to let me know if you have any other questions.
Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.