Azure API Management Backend
This page shows how to write Terraform and Azure Resource Manager for API Management Backend and write them securely.
azurerm_api_management_backend (Terraform)
The Backend in API Management can be configured in Terraform with the resource name azurerm_api_management_backend
. The following sections describe 9 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "azurerm_api_management_backend" "backend1" {
name = "backend2"
resource_group_name = azurerm_resource_group.rg.name
api_management_name = azurerm_api_management.apim.name
protocol = "http"
url = "https://backend1"
resource "azurerm_api_management_backend" "dadjoke" {
name = "ICanHazDadJoke"
resource_group_name = local.resource_group_name
api_management_name = data.azurerm_api_management.apim.name
protocol = "http"
url = "https://icanhazdadjoke.com/"
resource "azurerm_api_management_backend" "example_backend" {
name = var.res_api_backend_name
resource_group_name = var.res_rg_name
api_management_name = var.res_api_name
protocol = var.res_protocol
url = var.res_url
resource "azurerm_api_management_backend" "backend" {
for_each = var.api_backends
name = each.value.name
url = each.value.url
resource_group_name = var.resource_group_name
api_management_name = azurerm_api_management.api.name
resource "azurerm_api_management_backend" "apim_demo_backend_publish" {
name = "publish-api"
resource_group_name = azurerm_resource_group.apim_demo_rg.name
api_management_name = azurerm_api_management.apim_demo_r.name
protocol = "http"
url = "https://tm7do0vu9j.execute-api.eu-west-1.amazonaws.com"
resource "azurerm_api_management_backend" "prod-ferm-vm-00" {
name = "prod-ferm-vm-00"
resource_group_name = azurerm_resource_group.rg.name
api_management_name = azurerm_api_management.apim.name
protocol = "http"
url = "http://prod-ferm-vm-00.noclab.com.au:80/"
resource "azurerm_api_management_backend" "backend" {
count = length(var.backend)
api_management_name = element(var.api_management_name, lookup(var.backend[count.index], "api_management_id"))
name = lookup(var.backend[count.index], "name")
protocol = lookup(var.backend[count.index], "protocol")
resource_group_name = var.resource_group_name
resource "azurerm_api_management_backend" "this" {
api_management_name = var.api_management_name
description = var.description
name = var.name
protocol = var.protocol
resource_group_name = var.resource_group_name
resource "azurerm_api_management_backend" "this" {
api_management_name = var.api_management_name
description = var.description
name = var.name
protocol = var.protocol
resource_group_name = var.resource_group_name
Parameters
-
api_management_name
required - string -
description
optional - string -
id
optional computed - string -
name
required - string -
protocol
required - string -
resource_group_name
required - string -
resource_id
optional - string -
title
optional - string -
url
required - string -
credentials
list block-
certificate
optional - list of string -
header
optional - map from string to string -
query
optional - map from string to string -
authorization
list block
-
-
proxy
list block -
service_fabric_cluster
list block-
client_certificate_thumbprint
required - string -
management_endpoints
required - set of string -
max_partition_resolution_retries
required - number -
server_certificate_thumbprints
optional - set of string -
server_x509_name
set block-
issuer_certificate_thumbprint
required - string -
name
required - string
-
-
-
timeouts
single block -
tls
list block-
validate_certificate_chain
optional - bool -
validate_certificate_name
optional - bool
-
Explanation in Terraform Registry
Manages a backend within an API Management Service.
Microsoft.ApiManagement/service/backends (Azure Resource Manager)
The service/backends in Microsoft.ApiManagement can be configured in Azure Resource Manager with the resource name Microsoft.ApiManagement/service/backends
. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
An example could not be found in GitHub.
Parameters
apiVersion
required - stringname
required - stringIdentifier of the Backend entity. Must be unique in the current API Management service instance.
properties
requiredcredentials
optionalauthorization
optionalparameter
required - stringAuthentication Parameter value.
scheme
required - stringAuthentication Scheme name.
certificate
optional - arrayList of Client Certificate Thumbprints. Will be ignored if certificatesIds are provided.
certificateIds
optional - arrayList of Client Certificate Ids.
header
optional - arrayHeader Parameter description.
query
optional - arrayQuery Parameter description.
description
optional - stringBackend Description.
properties
optionalserviceFabricCluster
optionalclientCertificateId
optional - stringThe client certificate id for the management endpoint.
clientCertificatethumbprint
optional - stringThe client certificate thumbprint for the management endpoint. Will be ignored if certificatesIds are provided
managementEndpoints
required - arrayThe cluster management endpoint.
maxPartitionResolutionRetries
optional - integerMaximum number of retries while attempting resolve the partition.
serverCertificateThumbprints
optional - arrayThumbprints of certificates cluster management service uses for tls communication
serverX509Names
optional arrayissuerCertificateThumbprint
optional - stringThumbprint for the Issuer of the Certificate.
name
optional - stringCommon Name of the Certificate.
protocol
required - stringBackend communication protocol.
proxy
optionalpassword
optional - stringPassword to connect to the WebProxy Server
url
required - stringWebProxy Server AbsoluteUri property which includes the entire URI stored in the Uri instance, including all fragments and query strings.
username
optional - stringUsername to connect to the WebProxy server
resourceId
optional - stringManagement Uri of the Resource in External System. This url can be the Arm Resource Id of Logic Apps, Function Apps or API Apps.
title
optional - stringBackend Title.
tls
optionalvalidateCertificateChain
optional - booleanFlag indicating whether SSL certificate chain validation should be done when using self-signed certificates for this backend host.
validateCertificateName
optional - booleanFlag indicating whether SSL certificate name validation should be done when using self-signed certificates for this backend host.
url
required - stringRuntime Url of the Backend.
type
required - string
Frequently asked questions
What is Azure API Management Backend?
Azure API Management Backend is a resource for API Management of Microsoft Azure. Settings can be wrote in Terraform.
Where can I find the example code for the Azure API Management Backend?
For Terraform, the feranto/terraform-samples, fortunkam/apim-devops-demos and avishekansible/AzureLandingZone source code examples are useful. See the Terraform Example section for further details.