How to access elasticsearch 2 VM from Website in Azure - azure

I followed this tutorial (Elasticsearch 2.X on Microsoft Azure) and now I got the following question: How do I access elasticsearch 2.3.4 running on the VM from my Asp.Net MVC 5 website?
The VM is not reachable from the internet. So the only solution would be to access the Virtual Network from the WebApp?! But I don't know how to configure the Ubuntu VM to allow access to elasticsearch (I used iptables to allow port 9200 and in the elasticsearch.yml I added network.host: 0.0.0.0) and how to access the Virtual Network from my WebApp.
In the guideline (the link above) stood, that the WebApp and the VM have to be in the same Virtual Network - but I can't add my WebApp to the Virtual Network...
Thanks for any help or ideas! Azure is driving me crazy :|
EDIT: Okay, I found another tutorial (secure communications between azure web-apps and virtual machines), but that did not work either. Right now I can access the elasticsearch VM via an url from everywhere in the internet. When I try to access the VM from the Web-App via the private IP of the VM, it does not work :( Maybe because the Azure team changed something? Some screenshots look different to mine.

Related

Configure Windows VM created by VMSS through Bastion Host

I have created my infrastructure through Terraform, the relevant (Azure) resources are
Application Gateway
VMSS (Virtual Machine Scale Set)
Windows VMs => Created/Destroyed by VMSS (Windows VM are in private
subnet, and HTTPS access is through Application Gateway)
Ubuntu based Bastion Host (for RDP and ansible configuration)
So far I am able to configure one of my windows VM through Ansible using psrp protocol, but that was only possible because I knew the private IPV4 of my VM (added the private IP to host file of bastion vm). How can I do it without knowing the IP address(es)?
My other question is how will the Ansible know a new VM has been created and it needs to be configured?
Edit
If you think this is not the best approach, please guide me on how to do it properly? Should I use Packer with custom image? OR is there any other option? The main configuration I want to do is enable IIS and install a few programs like GIT.
Thank you.
The best way IMO is to use a dynamic inventory. Although the doc examples are detailed for clobber and EC2, you will find more info on the included scripts with examples for Azure.
Once you have your dynamic inventory in place, you can refresh it with meta: refresh_inventory whenever you need to.

Azure ARM Linux VM Public IP and Docker

I've a simple problem that I provisioned a Ubuntu 16.04 LTS VM with all of its default components. I ssh into the machine, installed Docker and expose a web app container at the port 80 where a simple static web app is running. But the problem is I can't access the application from the public ip address in the browser that has been created as a separate resource with ARM model. I also assigned a named DNS but could not work :(. I have a stand alone VM.
I previously tried Docker on Ubuntu Server Azure service where I need to configure VM's endpoints in the classical way and the same application was up and running. But how do I do that in a stand alone Ubuntu VM using ARM?
For ARM you need to configure Network Security Groups, instead of Endpoints.
You would want to allow traffic on port 80 to the VM. Here's the link to the documentation. And link to a guide on how to do that with Portal.

How to access virtual machine (Windows Server 2008) from browser?

I am trying out the Free Trial Microsoft Azure.
Basically I created an VM running Windows Server 2008 SP1.
There, I am running GeoServer, being able to access the geoserver from the local browser (eg: http://localhost:8080/geoserver/web)
Now, how to access this from a public browser? It has a public IP 13.93.154.109
which I can't even ping it, not to say to access it.
What did I miss out?
Note: I tried both classic/non-classic VM, result is the same.
Also, I am aware that there is an OpenGeo Suite out there for Azure. But it costs a lot. What I am trying to do is, to share the VM with the other existing product.
Thanks in advance.
localhost-from-vm
P.S: I am able to ping 13.93.154.109:3389 using PsPing instead of normal Ping.
You need to open the port 8080 to allow traffic on your VM.
Depending on how you have created the VM, it can be done in different ways:
If you have used the Classic workflow, you need to add an endpoint to your cloud service: https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-windows-classic-setup-endpoints/
If you have used the Azure Resource Manager workflow, you need to create an inbound rule in the network security group: https://azure.microsoft.com/en-us/documentation/articles/virtual-networks-create-nsg-arm-pportal/#create-rules-in-an-existing-nsg

Using same domain controller for multiple virtual networks in azure

In a azure virtual network(say vnet1) I have 2 virtual machines(say VM1 & VM2).I have windows server active directory installed in VM1. In vnet setting in azure I have mentioned VM1 as my DNS server.So I can use user credentials in AD(from VM1) to login to VM2.Now I want another virtual network(vnet2) to use same AD(in vnet1) so that I could login to the virtual machines in vnet2 using user credentials in AD in vnet1.I tried putting in public IP of VM1 as a DNS setting in vnet2 but that did not work.I would like to know if this is possible? or I have to use another windows server active directory which would be part of my vnet2?
I would also like to know if there are any network limitations on AD?
Thanks in advance.
You net to do a Site to Site between the Vnets.
Depending on if you are using ASM (Azure Service Manager) or ARM (Azure Resource Manager) the solution might have a different setup and there are many blog posts on how to do a Vnet to Vnet connection but i always try to use the official documentation since it always has the latest supported information.
Here is the guide you are looking for.
https://azure.microsoft.com/en-us/documentation/articles/virtual-networks-configure-vnet-to-vnet-connection/

How do I add a website to a virtual network in Windows Azure?

Scenario:
I have a website on Windows Azure. That website needs to connect to a (new) Azure VM.
I have done the following:
Created new Virtual Network on Azure
Added the VM to the Virtual Network, and it does get an IP in the virtual network.
I have configured the appropiate Endpoint for the VM (Public/Private port).
Now, how do I "connect" the Azure website to the same virtual network, such that my .NET code in the website can create a TCP connection to the VM on it's IP on the Virtual Network ?
This is now possible. Be sure to use the NEW Azure Portal. For details, check out:
http://azure.microsoft.com/blog/2014/09/15/azure-websites-virtual-network-integration/
Currently you cannot connect/add Azure Web Site to a Virtual Network. You can only add VMs and Cloud Services to a Virtual Network. However this is a demanded feature and I believe we will see it in the future releases of the Web Sites service (my speculation).
The key here is to create the Virtual Network before the Virtual Machine and then place the VM in the VN during it's creation. The article here gives instructions moving a VM into a VN.
http://blogs.msdn.com/b/walterm/archive/2013/05/29/moving-a-virtual-machine-from-one-virtual-network-to-another.aspx

Resources