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
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.