How can I get IP addresses of Azure web app instances - azure

I have my web app running on Azure with scale out to have multiple instances.
I can get the list instances name using the Management API of Azure as below
https://management.azure.com/subscriptions/"SubscriptionID"/resourceGroups/"ResournceGroupName"/providers/Microsoft.Web/sites/"sitename"/instances?api-version=2018-02-01
This API provides me the below information
"value": [
{
"id": "/subscriptions/subscriptionid/resourceGroups/websitename/providers/Microsoft.Web/sites/websitename/instances/instancename",
"name": "68e9f48782245c3a112318 INSTANCE NAME ac97aa9f0b55a4b0eb7a0",
"type": "Microsoft.Web/sites/instances",
"location": "UK West",
"properties": {
"name": "68e9f48782245c3a112318 INSTANCE NAME ac97aa9f0b55a4b0eb7a0",
"siteInstanceName": "68e9f48782245c3a112318 INSTANCE NAME ac97aa9f0b55a4b0eb7a0"
}
I wanted to know the IP address of each instance. Can any one please help me how can i get that.

You can't know beforehand which IP address a given app instance will
use to make the outbound connection
So, unfortunately, you just can know the possible outbound IP addresses and not the exact IP address. The inbound IP address may also change when you perform some actions. But you can get a static inbound IP address if you configure an IP-based SSL binding. See Get static inbound IP.

You can retrieve the possible IP list of the scaled instances in Azure Portal. Find the possibilities of retrieving the IP of scaled instances here.

Related

DHCP server on Azure portal

I’m working on Azure portal to create virtual machines with bastion and I was wondering, can I use DHCP server for internal IP addresses? I’m not sure it is possible because when I create a machine it already has an internal IP.
DHCP by default does not exist in Microsoft Azure.
Or you may call it as vNet.
Just like you create a "Scope" of IP addresses in DHCP in an on-premesis environment, similarly, in Azure, you create "Subnet" in "vNet" and then when you create a VM and attach a vNet to it then the IP address is assigned from that subnet.
In simpler terms (not exact terms), you can say that:
vNet -> DHCP
Subnet -> Scope
I just wrote above relation in simpler terms so that you are able to understand it easily.
That's what Azure Virtual Networks is for. Take a look at their documentation here: https://learn.microsoft.com/en-us/azure/virtual-network/virtual-networks-overview

How to get DNS Name in azure Virtual Machines - List All api?

I want to get the DNS Name in azure Virtual Machines - List All api in nodejs.
Please help me.
I checked this url Virtual Machines - List All
But DNS Name not availble in the response.
If you want to get the FQDN for Azure VMs in the Azure portal. When you create a virtual machine (VM) in the Azure portal, a public IP resource for the virtual machine is automatically created. The FQDN actually is attached to the public IP resource for external accessing. So you will look for the public IP for the DNS name.
You can look up the API Public IP Addresses - List All
"dnsSettings": {
"domainNameLabel": "testlbl",
"fqdn": "testlbl.westus.cloudapp.azure.com"
},

Keeping my out bound IPs on App Service

I have a website on Azure App service and I've asked a service provider to open up for my outbound IP addresses. How can I make sure that those IPs won't change?
If there is a new IP assigned to my app service, all calls from that IP will be blocked by the service provider.
The outbound IP addresses are per stamp/scale unit that the apps are on. It is not specific to a certain webspace or resource group.
You can find the stamp/scale unit in the Properties blade under the FTP Hostname endpoint. It should list out something like "waws-prod--". All of the apps in the same stamp/scale unit number in that region will have the same outbound IP addresses, as they are per stamp/scale unit.
The list of outbound IP addresses is not completely static but normally it does not change. Check out the reasons for the IP change in the thread outlined by Ruslan.
If you need both incoming and outgoing to be static, you will need an App Service Environment. This will give you dedicated IP addresses.
For more information see: https://learn.microsoft.com/en-us/azure/app-service/environment/app-service-app-service-environment-intro and https://msdn.microsoft.com/en-us/magazine/mt793270.aspx.

How to route traffic from my Azure App Service to specific external IP address

I'm trying to follow along with the guide found here: https://learn.microsoft.com/en-us/azure/app-service-web/web-sites-integrate-with-vnet
I have tried both connecting to an existing VNET and setting up a new VNET, but the results are the same.
I have an existing VNET that connects to an external partner service. When I connect a VM to the VNET, I am able to telnet into the external partner's IP:port. When I connect the azure app service to that same VNET, I am unable to get the traffic to route to that external partner service.
From the guide, it looks like I should be able to just add IP address range to the App Service Plan's Networking configuration as seen in this image from the linked article.
When I go into my App Service Plan's Networking configuration, I have no option to add more IP addresses.
When I look at the App Service directly (not the plan), I see that there are some default routes (not sure where those come from).
I tried adding a User Defined Route to the route table associated with the subnet, but that did not appear in the IP Addresses Routed To VNET.
The address range listed in the Site-to-Site address space is the range that I need forwarded.
So, while the article shows that you can add routes via the portal seen in the first image of the question, that functionality does not exist. To add a route, you have to use the resource explorer and edit the service plan.
From here, it will open the explorer to the app service plan selected. Find the virtualNetworkConnections node and open it. Inside you'll see a Routes node. Pick routes.
Enable Read/Write capability in the top bar.
Copy an existing route from the list if there is one to pick up the default values, then pick create option to add a new route.
Paste the existing route and update appropriate fields or fill in from scratch. Here is an example...
{
"id": "/subscriptions/<subid>/resourceGroups/<RG name>/providers/Microsoft.Web/serverFarms/<service plan name>/virtualNetworkConnections/<vnet name>/routes/<route name>",
"name": "<route name>",
"type": "Microsoft.Web/serverfarms/virtualNetworkConnections/routes",
"location": "<location, eg East US 2>",
"properties": {
"name": "<route name>",
"startAddress": "<start address>",
"endAddress": "<end address>",
"routeType": "DEFAULT",
"denyRoute": false
}
}
If you had an existing route, you should only need to change the <route name>, <start address>, and <end address>.
The {Resource Name} field should be populated with same value as in the template. After filled in, select PUT. The new route will now be available.
To add a route. It needs to be done at the App Service Plan level.
"The only operation you can take in the app view of your VNet Integration is to disconnect your app from the VNet it is currently connected to. To disconnect your app from a VNet, select Disconnect. Your app will be restarted when you disconnect from a VNet. Disconnecting doesn't change your VNet. The VNet and its configuration including the gateways remains unchanged. If you then want to delete your VNet, you need to first delete the resources in it including the gateways.
To reach the ASP VNet Integration UI, open your ASP UI and select Networking. Under VNet Integration, select Click here to configure to open the Network Feature Status UI."
"The ASP VNet Integration UI will show you all of the VNets that are used by the apps in your ASP. You can have up to 5 VNets connected to by any number of apps in your App Service plan. Each app can have only one integration configured. To see details on each VNet, click on the VNet you are interested in. There are two actions you can perform here.
Sync network. The sync network operation makes sure that your certificates and network information are in sync. If you add or change the DNS of your VNet, you need to perform a Sync network operation. This operation will restart any apps using this VNet.
Add routes Adding routes will drive outbound traffic into your VNet.
Routing The routes that are defined in your VNet are used to direct traffic into your VNet from your app. If you need to send additional outbound traffic into the VNet, then you can add those address blocks here."

How to configure an alternate remote desktop public port for an Azure Resource Manager virtual machine

I am trying to configure an alternate remote desktop port (other than the default 3389) for an Azure Resource Manager Virtual Machine (the new kind, not the legacy Classic one).
I know how to do it for the Classic kind (via Endpoints), but I can not find an option like that for the new Resource Manager one.
The furthest I got was discovering that I can manipulate the rules for the Network Security Group associated to the VM, but I don't see an option there to map a specific public port to the 3389 private port for that given VM.
Any ideas?
Many thanks!
I think below sample template is what you are looking for
https://github.com/Azure/azure-quickstart-templates/blob/master/101-vm-with-rdp-port
Quote from above sample
"rdpPort": {
"type": "int",
"defaultValue": 50001,
"metadata": {
"description": "Public port number for RDP"
}
}

Resources