So last week I have made a Scale Set with this tutorial let's say: [https://learn.microsoft.com/en-us/azure/load-balancer/tutorial-add-lb-existing-scale-set-portal
As operating system I choose a Image of a VM that I have created earlier, with nginx installed and a script to show, when accessing the public IP of instances on browser with which VM Instance is running (scalling). After following that tutorial, it worked just fine. I installed email-communication, blob and CosmosDB on the first Instance. After that, I stopped both Instances and Started them again after a week, getting 502 Bad Gateway error when accessing the IP.
So I tried stopping/starting both Instances, same error. I tried to change from '/var/www/html' the 'index.nginx-debian.html' with sudo nano, in order to append some random charachers. After that, I saved and executed 'sudo reboot'. When checking if the changes were made after reboot, I saw that the same original message was there, without changes I've made earlier on.
Both VMs in the scale set were displaying properly when connecting via http, but with no changes made, is throwing a 502 error.