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
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
}
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
}
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
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 {
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 {
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
}
Parameters
-
app_service_id
required - string -
id
optional computed - string -
slot_name
required - string -
subnet_id
required - string -
timeouts
single block
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.
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.
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.
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
"type": "Microsoft.Web/sites/slots/virtualNetworkConnections",
"apiVersion": "2018-11-01",
"kind": "string",
"properties": {
"vnetResourceId": "string",
"certBlob": "string",
"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 - stringkind
optional - stringKind of resource.
name
required - stringName of an existing Virtual Network.
properties
requiredcertBlob
optional - stringA certificate file (.cer) blob containing the public key of the private key used to authenticate a Point-To-Site VPN connection.
dnsServers
optional - stringDNS servers to be used by this Virtual Network. This should be a comma-separated list of IP addresses.
isSwift
optional - booleanFlag that is used to denote if this is VNET injection
vnetResourceId
optional - stringThe 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.