You can publish your website directly to an Azure Virtual Machine by using Visual Studio. However, you may run into this error message after selecting the VM: “Could not reach the Web Deploy endpoint on the specified virtual machine“
Turn off Windows Firewall to see if the issue occurs again. You can turn it back on after testing. If it works after turning it off, it means there is an issue with the inbound rule.
The machine Visual Studio is trying to connect should be listening the port 8172. Run the following command in the target VM to see if it is listening to this port:
netstat -ano | findstr :8172
Additionally, make sure that IIS Management Service is installed and running:
Finally, go to IIS Manager and open “Management Service”. Make sure that it is running and it is enabled for remote connections.
A related error: “Could not verify the server’s certificate”
After solving previous error, you may run into another issue while trying to publish the web application: