How to use NEST/elasticsearch with Azure? - azure

I got a website (Web App) running on Azure (example.azurewebsites.net) and I want to use NEST (http://nest.azurewebsites.net) 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.
First I created a virtual network like described here in Step 1: http://www.kerrb.com/ecAzureVms101/day4-creating-point-to-site-vpn-to-azure-virtual-machines
I called it VirtualNetwork and got a Gateway-IP-Adress. It shows me that 1 Client is connected.
Then I created a virtual machine like described here: http://code972.com/blog/2014/07/74-the-definitive-guide-for-elasticsearch-on-windows-azure
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.
The last step with Azure was to connect the Web App with the virtual network. I did it like this: http://blogs.technet.com/b/canitpro/archive/2015/04/07/step-by-step-connect-an-azure-web-app-to-an-existing-virtual-network.aspx
Finally I changed my code to use the elasticsearchvm.
new ElasticClient(new ConnectionSettings(new Uri("http://example-elastic-search.cloudapp.net")))
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.
Any ideas, what I have missed? If more informations are needed, feel free to ask :)

I realise that this is not directly answering your question, but I think this is useful to mention for those finding this question in future. The easiest way to get up and running with Elasticsearch on Azure is to use Elastic's ARM template; I wrote a blog post about some of the features available within the template.
The template can be deployed from within the portal UI or using the Azure CLI; the former is good for getting started and playing around, and the latter is useful to integrate the template into your automation environment of choice. You can of course clone/fork the repository and make changes to the template to suit your requirements.
When adding Elasticsearch to an existing web application, the deployed cluster can be attached to an existing virtual network in the same location; you just need to specify
the name of the network
the name of the subnet
the name of the resource group containing the network
An available IP address to use for the internal load balancer
You'll need enough available IP addresses on the network for the cluster you're deploying.

Related

Azure VPN Gateway: mantain client configuration valid across multiple VPN Gatway creation/deletion

I'm handling my VPN Gateway via Azure Automation script, totally executed on Azure and nothing on premises. The project is to activate the VPN gateway by launching an Azure PS Runbook (which creates and configure the object I need for my VPN) when I need it, and then remove the VPN Gateway with another Azure PS Runbook, to limit the cost of the VPN Gateway provisioning (I need it only in business hours/days, not 24/7).
So far so good, I can create my VPN Gatway when I want it, and I can download the client configuration to connect to my VNet.
The problem is that every time I destroy a VPN Gateway, the previous installed configuration on client it's not valid anymore for the next VPN Gateway: it can't connect anymore. I've tried by using a Standard static public IP address but it doesn't solve the problem. I see that the address used as server name on client changes every time (it's a string like 'azuregateway-9a430069....843cc.vpn.azure.com'). This is annoying since it means that I need to update the client configuration each time the VPN is destroyed, which means to log into Azure portal to download the configuration (very uncomfortable if I have more than one or two client).
Do Azure have a way to avoid this? I'm open to every solution, the best is to avoid completely the configuration update on client.
Maybe something like obtain the new VPN Gateway parameter and display it as result of the PS Runbook, or the worst case to obtain the *.zip file with the new configuration and store it somewhere I want (like a OneDrive).
I've contacted the Microsoft Tech Support and they told me that I can't do as I described in my question: once the Virtual Network Gateway resource is disposed, the link for that istance is deleted and the next allocation won't use the same link, because of datacenter allocation policies.

Azure WebApp - Get Private IP of a service connected on VNET

I have a Azure WebApp inside the VPN. When I go on networking I see the connection like this:
When I click on "Click here to configure"it appears to be up & running:
So, everything appears OK.
The VPN externally connects BUT where can I find the Internal "VPN" IP Address of this Web App?
If I go on configurations / SCM etc I can only find the "external" IP!
Thanks
If you have a normal App Service then you can't get it's IP, mainly because the application is running on a distributed environment and the exact location of the instance might change with little notice.
If you need a dedicated public (or private) IP, then I recommend you have a look at Azure App Service Enviroments.

How to allow specific ip address to access my webapp deployed in azure?

I have a deployed web app in azure but I want to allow only specific ip address ( or mac address if possible) to access the sites on the web app I deployed on azure. I've been searching for internet for step by step instructions but I really cannot find one. I saw several codes to paste to web.config but I do not know how to do it nor find that file.
What I understand is that I need to setup a network security group found under the settings on my web app but I cannot find it there. I can only see networking. Can someone please provide step by step instructions. TIA
According to your description, we should create an app service Environment(virtual network), in this way, we can add NSG to the virtual network, then we can set inbound rules for this virtual network, in this way, we can control inbound traffic to web app.
We can follow this official article to create app service environment and add NSG to web app.

Is Azure Free Website IP address needed in order to "Add to Allowed IP Addresses"?

I set up a simple asp.net web forms test site for learning Azure, with a simple DB. Works fine locally. I deployed it to Azure. Then went through learning curve on the need to separately deploy the DB, link the resource, check connection strings and so on.
There's an issue, where the program on the site gets an error. I'm going through many paths to try to diagnose it. This question is about one specific path.
Several articles say that for the website to use the DB, I have to add the IP address of the website to the allowed IP addresses of the DB server.
https://azure.microsoft.com/en-us/documentation/articles/sql-database-create-configure/
However, I can't find the IP address for my FREE Azure website. When I researched this, it looks like there is no available fixed IP address for free websites.
So either:
1) I need to know where to get the IP address for the free website, or
2) there is some way to use Azure SQL in free websites without having to
designate an allowed IP address, or
3) something completely different.
Any help with this would be appreciated.
Thanks!
UPDATE: Below is all I see on the database configuration page, i.e. no firewall rules. However, I became convinced that the "Allowed IP Address" requirement must be finessed automagically in Azure, and so that was likely NOT the problem, which made me look more closely at the connection string, which WAS the problem. Basically one day of newbie learning curve, which I'll have to sleep on and try to understand more tomorrow.
There's an option to allow Azure services when you configure the database firewall. Check if that's checked. Also, posting the actual error message will help.
You don't need to do that for things that are hosted within the Azure platform.
Under the Azure SQL Server Firewall (Preview Portal) settings, ensure that the Allow access to Azure services is turned on:
Alternatively, via the Old Portal, the setting is found via:
Databases -> Servers -> Configure

Can you get an internal IP for an Azure Cloud Service?

We're currently working on some proof of concept type stuff with Azure. We have a virtual network configured to which we've deployed some test Cloud Services (basically basic Web Roles created in VS2013).
Ideally we'd like to be able to make calls within our virtual network to these Cloud Services using internal IP addresses (we do intend to have our own DNS solution in place) but only seem to be able to get the internal addresses for the instances running within the Cloud Service and not the Cloud Service itself (for which we can only get the public VIP address). Obviously making any calls to the instances directly means we lose out on the load balancing/scaling that Cloud Services offers for a Role deployment.
Can anyone tell me if finding out the internal IP address is even possible, or are we trying to do something that quite simply can't be done/is inadvisable?

Resources