Turns out I misunderstood the way azure virtual machines work. I needed to add an endpoint to the azure virtual machine.
I entered the asp .net state server port in the endpoint in my case it was 42424 and then it worked. I also added rules in the firewall for the asp .net state service.