Azure App Service (Web Apps) Slot Virtual Network Swift Connection

This page shows how to write Terraform and Azure Resource Manager for App Service (Web Apps) Slot Virtual Network Swift Connection and write them securely.

azurerm_app_service_slot_virtual_network_swift_connection (Terraform)

The Slot Virtual Network Swift Connection in App Service (Web Apps) can be configured in Terraform with the resource name azurerm_app_service_slot_virtual_network_swift_connection. The following sections describe 6 examples of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L1
resource "azurerm_app_service_slot_virtual_network_swift_connection" "example" {
  slot_name      = module.service_plan.azurerm_app_service_plan.example.name
  app_service_id = module.app_service.azurerm_app_service.example.id
  subnet_id      = module.subnet.azurerm_subnet.example.id
}
main.tf#L144
resource "azurerm_app_service_slot_virtual_network_swift_connection" "app-staging" {
  slot_name      = azurerm_app_service_slot.app-staging.name
  app_service_id = azurerm_app_service.app.id
  subnet_id      = azurerm_subnet.vnet.id
}
main.tf#L119
resource "azurerm_app_service_slot_virtual_network_swift_connection" "app_service_slot_virtual_network_swift_connection" {
  count = var.subnet_id == null ? 0 : 1

  slot_name      = azurerm_app_service_slot.app_service_slot.name
  app_service_id = var.app_service_id
  subnet_id      = var.subnet_id
main.tf#L248
resource "azurerm_app_service_slot_virtual_network_swift_connection" "slot" {
  count          = var.slot_vnet_integration ? 1 : 0
  slot_name      = azurerm_app_service_slot.staging.name
  app_service_id = azurerm_app_service.main.id
  subnet_id      = var.vnet_subnet_id
  lifecycle {
main.tf#L248
resource "azurerm_app_service_slot_virtual_network_swift_connection" "slot" {
  count          = var.slot_vnet_integration ? 1 : 0
  slot_name      = azurerm_app_service_slot.staging.name
  app_service_id = azurerm_app_service.main.id
  subnet_id      = var.vnet_subnet_id
  lifecycle {
r-appservice.tf#L238
resource "azurerm_app_service_slot_virtual_network_swift_connection" "app_service_slot_vnet_integration" {
  count          = var.staging_slot_enabled && var.app_service_vnet_integration_subnet_id != null ? 1 : 0
  slot_name      = azurerm_app_service_slot.app_service_slot[0].name
  app_service_id = azurerm_app_service.app_service.id
  subnet_id      = var.app_service_vnet_integration_subnet_id
}

Review your Terraform file for Azure best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Manages an App Service Slot's Virtual Network Association (this is for the Regional VNet Integration which is still in preview).

Tips: Best Practices for The Other Azure App Service (Web Apps) Resources

In addition to the azurerm_app_service, Azure App Service (Web Apps) has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.

risk-label

azurerm_app_service

Ensure your App Service is accessible via HTTPS only

It is better to configure the App Service to be accessible via HTTPS only. By default, both HTTP and HTTPS are available.

risk-label

azurerm_function_app

Ensure to enable authentication to prevent anonymous request being accepted

It is better to enable authentication to prevent anonymous requests and ensure all communications in the application are authenticated.

Review your Azure App Service (Web Apps) settings

In addition to the above, there are other security points you should be aware of making sure that your .tf files are protected in Shisho Cloud.

Microsoft.Web/sites/slots/virtualNetworkConnections (Azure Resource Manager)

The sites/slots/virtualNetworkConnections in Microsoft.Web can be configured in Azure Resource Manager with the resource name Microsoft.Web/sites/slots/virtualNetworkConnections. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

virtualnetworkconnections.json#L3
  "type": "Microsoft.Web/sites/slots/virtualNetworkConnections",
  "apiVersion": "2018-11-01",
  "kind": "string",
  "properties": {
    "vnetResourceId": "string",
    "certBlob": "string",
Microsoft.Web.tests.json#L472
        "type": "Microsoft.Web/sites/slots/virtualNetworkConnections",
        "properties": {
          "vnetResourceId": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/virtualNetworkName",
          "dnsServers": "a.dns.com,b.dns.com.c.dns.com",
          "certBlob": "SDSD@%#^#$SDSDS"
        }

Parameters

  • apiVersion required - string
  • kind optional - string

    Kind of resource.

  • name required - string

    Name of an existing Virtual Network.

  • properties required
      • certBlob optional - string

        A certificate file (.cer) blob containing the public key of the private key used to authenticate a Point-To-Site VPN connection.

      • dnsServers optional - string

        DNS servers to be used by this Virtual Network. This should be a comma-separated list of IP addresses.

      • isSwift optional - boolean

        Flag that is used to denote if this is VNET injection

      • vnetResourceId optional - string

        The Virtual Network's resource ID.

  • type required - string

Frequently asked questions

What is Azure App Service (Web Apps) Slot Virtual Network Swift Connection?

Azure App Service (Web Apps) Slot Virtual Network Swift Connection is a resource for App Service (Web Apps) of Microsoft Azure. Settings can be wrote in Terraform.

Where can I find the example code for the Azure App Service (Web Apps) Slot Virtual Network Swift Connection?

For Terraform, the VentsislavDinev/en_sample, tarwn/example-lob-app and pagopa/io-infrastructure-modules-new source code examples are useful. See the Terraform Example section for further details.

For Azure Resource Manager, the da-edra/scraping-azure and chironconsulting/ARM-Schema-Templates source code examples are useful. See the Azure Resource Manager Example section for further details.