0

Hi I have a simple web app created with terraform, configured with vnet regional integration:

resource "azurerm_app_service" "app-indigo" {
  name                = "app-${var.environment}-${var.app_name}"
  location            = data.azurerm_resource_group.rg.location
  resource_group_name = data.azurerm_resource_group.rg.name
  app_service_plan_id = azurerm_app_service_plan.app-plan.id
  

  site_config {
    dotnet_framework_version = "v4.0"
  } 

resource "azurerm_app_service_virtual_network_swift_connection" "app-indigo-swift" {
  app_service_id = azurerm_app_service.app-app.id
  subnet_id      = data.azurerm_subnet.subnet["integration"].id
}

no matter how I try to access the web app, from internal network or an application gateway, I get the following

You do not have permission to view this directory or page.

and this is the default web-app, no code deployed yet, I'd really appreciate any help here

enter image description here

Renm
  • 717
  • 3
  • 10
  • 20
  • Does this answer your question? [Azure website message "You do not have permission to view this directory or page.". What to do?](https://stackoverflow.com/questions/48853599/azure-website-message-you-do-not-have-permission-to-view-this-directory-or-page) – Sajeetharan Sep 22 '20 at 13:42
  • I read it before posting, unfortunately it didn't help – Renm Sep 22 '20 at 14:00

1 Answers1

1

This error could happen there is a lack of Web.config file in your wwwroot folder. If you leave out the site_config, Terraform will invoke the Azure API to create a default website. This error will disappear.

So you can use code like this:

resource "azurerm_app_service" "app-indigo" {
      name                = "app-${var.environment}-${var.app_name}"
      location            = data.azurerm_resource_group.rg.location
      resource_group_name = data.azurerm_resource_group.rg.name
      app_service_plan_id = azurerm_app_service_plan.app-plan.id         
} 

Alternatively, you could deploy your website including web content. For example, you could create an ASP.NET Framework web app in Azure.

The example provisions a Windows App Service. Other examples of the azurerm_app_service resource can be found in the ./examples/app-service directory within the Github Repository.

Nancy
  • 26,865
  • 3
  • 18
  • 34
  • Thanks Nancy, that's a great tip, i thought the hostingstart.html is always created ! :) donno if you can answer, I have one more question please, i need to use site_config to restric/allow ip_addresses and i did add GatewaySubnet (the vpn P2S) to the allowed, however, i can't access the web app, even after allowing it – Renm Sep 23 '20 at 10:05
  • It's a default page when web apps deployed in Azure, see the [old document](https://www.vembu.com/blog/how-to-use-azure-web-apps/). If you only allow P2S VPN client to access your web app, you should add the address pool(CIDR block) from Point-to-site configuration instead of GatewaySubnet in your virtual network gateway. – Nancy Sep 24 '20 at 07:23