After installing the script don't forget to Open the port 5985 in the NSG (inbound)
Again, in a production environment, you will need to secure this. Add a DNS label to your Public IP DNS (if you’re not using you’re own DNS) Test that the connection works
nc -z -w1 <IP or host name> 5985;echo $?
PowerShell script for enabling WinRM