@BarryM Thank you for reaching out to Microsoft Q&A, apologize for any inconvenience caused on this.
The status code 502 is a generic and it might be occurred due to multiple reasons like
- If the request is taking longer than expected or longer time to execute
- your application is running with high cpu/memory usage.
- Application might crash due to multiple exceptions.
You can leverage this troubleshooting guide to troubleshoot and fix 502 or 503 errors on app service.
Alternatively, you can use Diagnostic and solve problems under your webapp or you can enable the diagnostic logs in azure app service to identify the cause
Feel free to reach back to me if you have any further questions on this.