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

backends.tf#L1
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"
backends.tf#L1
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.tf#L1
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
apim.tf#L24
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
main.tf#L43
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"
apim.tf#L52
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/"
main.tf#L1
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
main.tf#L7
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
main.tf#L7
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

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 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 - string
  • name required - string

    Identifier of the Backend entity. Must be unique in the current API Management service instance.

  • properties required
      • credentials optional
          • authorization optional
              • parameter required - string

                Authentication Parameter value.

              • scheme required - string

                Authentication Scheme name.

          • certificate optional - array

            List of Client Certificate Thumbprints. Will be ignored if certificatesIds are provided.

          • certificateIds optional - array

            List of Client Certificate Ids.

          • header optional - array

            Header Parameter description.

          • query optional - array

            Query Parameter description.

      • description optional - string

        Backend Description.

      • properties optional
          • serviceFabricCluster optional
              • clientCertificateId optional - string

                The client certificate id for the management endpoint.

              • clientCertificatethumbprint optional - string

                The client certificate thumbprint for the management endpoint. Will be ignored if certificatesIds are provided

              • managementEndpoints required - array

                The cluster management endpoint.

              • maxPartitionResolutionRetries optional - integer

                Maximum number of retries while attempting resolve the partition.

              • serverCertificateThumbprints optional - array

                Thumbprints of certificates cluster management service uses for tls communication

              • serverX509Names optional array
                  • issuerCertificateThumbprint optional - string

                    Thumbprint for the Issuer of the Certificate.

                  • name optional - string

                    Common Name of the Certificate.

      • protocol required - string

        Backend communication protocol.

      • proxy optional
          • password optional - string

            Password to connect to the WebProxy Server

          • url required - string

            WebProxy Server AbsoluteUri property which includes the entire URI stored in the Uri instance, including all fragments and query strings.

          • username optional - string

            Username to connect to the WebProxy server

      • resourceId optional - string

        Management 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 - string

        Backend Title.

      • tls optional
          • validateCertificateChain optional - boolean

            Flag indicating whether SSL certificate chain validation should be done when using self-signed certificates for this backend host.

          • validateCertificateName optional - boolean

            Flag indicating whether SSL certificate name validation should be done when using self-signed certificates for this backend host.

      • url required - string

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