Azure API Management Policy

This page shows how to write Terraform and Azure Resource Manager for API Management Policy and write them securely.

azurerm_api_management_policy (Terraform)

The Policy in API Management can be configured in Terraform with the resource name azurerm_api_management_policy. The following sections describe 1 example of how to use the resource and its parameters.

Example Usage from GitHub

apim-policy.tf#L2
resource "azurerm_api_management_policy" "policy" {
  count = var.apim_default_policy_path==""?0:1
  api_management_id = azurerm_api_management.apim.id
  xml_content       = file(var.apim_default_policy_path)

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 API Management service Policy.

NOTE: This resource will, upon creation, overwrite any existing policy in the API Management service, as there is no feasible way to test whether the policy has been modified from the default. Similarly, when this resource is destroyed, the API Management service will revert to its default policy.

Microsoft.ApiManagement/service/policies (Azure Resource Manager)

The service/policies in Microsoft.ApiManagement can be configured in Azure Resource Manager with the resource name Microsoft.ApiManagement/service/policies. 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

    The identifier of the Policy.

  • properties required
      • format optional - string

        Format of the policyContent.

      • value required - string

        Contents of the Policy as defined by the format.

  • type required - string

Frequently asked questions

What is Azure API Management Policy?

Azure API Management Policy 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 Policy?

For Terraform, the bee-a-learner/terraform source code example is useful. See the Terraform Example section for further details.