How can I configure my Azure App Service to have multiple outbound public IP addresses?

266 Views Asked by At

I want my app service to be able to send requests to "someexternalwebsite.com" from a public IP address "A" whenever the request is linked to an account on the external site "Account A", and from a different IP address "B" for another account on that site, "Account B", and so on... (up to around 3 or 4 account/IP address instances)

I thought about setting up separate service instances that my main service can call into, where each instance is dedicated to an account and would have it's own IP address. However my guess is that there is a simpler option out there...

1

There are 1 best solutions below

0
Imran On

Created App service and associated with virtual network to send a request with Externalwebsite with public IP.

In your virtual machine -> Networking -> network interface -> Ip config -> change Ip address from dynamic to static to all VM's like below:

enter image description here

enter image description here

Create load balancer to multiple frontend IP addresses, backend pool, and inbound load balancing rule:

Frontend IP address:

enter image description here

In backend pool, make sure backend pool can only contain resources from one virtual network.

enter image description here

In load balancing rule select frontend Ip and backend pool and create a healthy probe like below:

enter image description here

enter image description here

You can create a separate NAT rule, or you can add in a load balancer like below:

enter image description here

Based on the account connected with the request, configure your app service to use the appropriate backend pool. You can do this by setting up routing rules in the load balancer. create a routing rule that routes requests from Account A to Backend Pool A and one that routes requests from Account B to Backend Pool address.

Now, when you test the Ip into browser it redirects successfully. Ensure that account associated with the request, requests are being directed to the appropriate backend pool.

Reference:

Load balance multiple IP configurations - Azure portal - Azure Load Balancer | Microsoft Learn