Hello Jan Vávra
Welcome to Microsoft Q&A Platform, thanks for posting your query here.
To deploy a new version of your application to a VMSS with no errors that could be noticed from the customer side, you can follow these steps:
- Create a new custom VM image with the updated version of your application pre-installed.
- Create a new scale set with the new custom VM image.
- Use the Azure Load Balancer to route traffic to the new scale set.
- Remove the old scale set from the backend pool of the load balancer.
- Wait until there are no incoming connections to the old scale set.
- Stop the web server on the old scale set.
- Deploy the new version of your application to the new scale set.
- Run some smoke tests on the new scale set to ensure that the new version of your application is working correctly.
- Add the new scale set to the backend pool of the load balancer.
- Remove the old scale set.
You can use the Custom Script Extension to install and configure software on your VM instances. The Custom Script Extension downloads and runs scripts on the VM instances in your scale set. You can use this extension to install and configure software on your VM instances.
The Custom Script Extension will not wait until all the steps are done. You will need to script all these five steps and ensure that they are executed in the correct order. You can use Azure PowerShell or Azure CLI to script these steps.
To avoid leaving any alive VM instances, you can use Azure Traffic Manager to route traffic to the new scale set gradually. You can start by routing a small percentage of traffic to the new scale set and gradually increase the percentage as you verify that the new version of your application is working correctly.
Hope this helps.