title: How to use NEST/elasticsearch with Azure?
body: <p>I got a website (Web App) running on Azure (example.azurewebsites.net) and I want to use NEST (<a href="http://nest.azurewebsites.net" rel="nofollow">http://nest.azurewebsites.net</a>) in my Asp.Net MVC solution. Locally it works fine, but when publishing it to Azure, I can't get a connection to elasticsearch. Because I did not found any useful tutorial, I mixed three together.</p>
  
  <p>First I created a virtual network like described here in Step 1: <a href="http://www.kerrb.com/ecAzureVms101/day4-creating-point-to-site-vpn-to-azure-virtual-machines" rel="nofollow">http://www.kerrb.com/ecAzureVms101/day4-creating-point-to-site-vpn-to-azure-virtual-machines</a>
  I called it VirtualNetwork and got a Gateway-IP-Adress. It shows me that 1 Client is connected.</p>
  
  <p>Then I created a virtual machine like described here: <a href="http://code972.com/blog/2014/07/74-the-definitive-guide-for-elasticsearch-on-windows-azure" rel="nofollow">http://code972.com/blog/2014/07/74-the-definitive-guide-for-elasticsearch-on-windows-azure</a>
  I already had the virtual network, so I skipped the first step here. The cloud service got the name example-elastic-search (example-elastic-search.cloudapp.net) I called the virtual machine elasticsearchvm. I connected via putty, configured elasticsearch like described and I it works fine.</p>
  
  <p>The last step with Azure was to connect the Web App with the virtual network. I did it like this: <a href="http://blogs.technet.com/b/canitpro/archive/2015/04/07/step-by-step-connect-an-azure-web-app-to-an-existing-virtual-network.aspx" rel="nofollow">http://blogs.technet.com/b/canitpro/archive/2015/04/07/step-by-step-connect-an-azure-web-app-to-an-existing-virtual-network.aspx</a></p>
  
  <p>Finally I changed my code to use the elasticsearchvm.</p>
  
  <pre><code>new ElasticClient(new ConnectionSettings(new Uri("http://example-elastic-search.cloudapp.net")))
  </code></pre>
  
  <p>Instead of example-elastic-search.cloudapp.net I also tried the name of the virtual machine (elasticsearchvm), the internal and public IPs of the VM, the IP of the cloud service and the IP of the gateway. All of these with http, https, the port and without the port (9200). Nothing worked.</p>
  
  <p>Any ideas, what I have missed? If more informations are needed, feel free to ask :)</p>