How to create single azure application gateway for multisites. Both applications are under different resource groups and VNET. Need single application gateway for test.example.com and test1.example.com.
-
1What have you tried already? Can you add the code you are currently using to the question? – Marko E May 26 '22 at 12:58
1 Answers
• Since you have included the tag of ‘terraform’ in your question, I am assuming that you want to create an application gateway for your purpose using the terraform IAC. Thus, you can surely create an application gateway for multiple sites across different tenants/subscriptions and across different virtual networks if the app services hosted are reachable over the internet, have IP connectivity and are accessible
. Kindly refer to the official Microsoft documentation link below for your query regarding communication outside instances of the application gateway’s virtual network: -
Thus, to create an application gateway as required by you through terraform, kindly follow the steps as below: -
a) Install the ‘Azure Terraform’ extension in Visual Studio code as given in the below documentation: -
b) Once done as stated in the above documentation link, then edit the ‘main.tf’ file with the code given in the below link and modify the ‘variables.tf’ file with the required values of the parameters
related to the application gateway deployment in Azure: -
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/application_gateway
c) Once the above has been done, initialize the terraform with the code ‘terraform init’, then create the execution plan with the command ‘terraform plan -out main.tfplan’
d) Then apply the terraform code specified in the above plan with the command ‘terraform apply main.tfplan’
Thus, in this way, the application gateway will be deployed using terraform IAC.

- 4,550
- 2
- 4
- 9
-
Hi @JINUJANAN, if the provided answer resolved your issue, you may mark it as answer or upvote it so that others who encounter the similar issue, it may be useful for them or community members. – Kartik Bhiwapurkar May 27 '22 at 05:29
-
What if the app services hosted are not reachable over the internet ? – JINU JANAN May 27 '22 at 05:45
-
Then, those app services might be accessible over the intranet, i.e., within the selected or allowed networks to the app services. Then, if the app services are in different resource groups but in Azure, then also you can map them based on their Azure internal endpoint name. – Kartik Bhiwapurkar May 27 '22 at 05:59
-
I have two appservices created in two differnet resource groups and vnet. I am planning to create single application gateway for both. Can i create an application gateway in different resource group and vnet (same azure account and subscription).? – JINU JANAN May 27 '22 at 07:53
-
Yes, you can create a single application gateway for the two app services provided they have public IP addresses and FQDNs. If they are configured with private IP addresses, then they cannot communicate through the same application gateway between different resource groups. – Kartik Bhiwapurkar Jul 06 '22 at 12:03