Azure API Management Product Policy

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

azurerm_api_management_product_policy (Terraform)

The Product Policy in API Management can be configured in Terraform with the resource name azurerm_api_management_product_policy. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L7
resource "azurerm_api_management_product_policy" "this" {
  api_management_name = var.api_management_name
  product_id          = var.product_id
  resource_group_name = var.resource_group_name
  xml_content         = var.xml_content
  xml_link            = var.xml_link
main.tf#L7
resource "azurerm_api_management_product_policy" "this" {
  api_management_name = var.api_management_name
  product_id          = var.product_id
  resource_group_name = var.resource_group_name
  xml_content         = var.xml_content
  xml_link            = var.xml_link
main.tf#L24
resource "azurerm_api_management_product_policy" "api_management_product_policy" {
  count = var.policy_xml == null ? 0 : 1

  product_id          = azurerm_api_management_product.api_management_product.product_id
  api_management_name = var.api_management_name
  resource_group_name = var.resource_group_name
main.tf#L13
resource "azurerm_api_management_product_policy" "this" {
  count = var.policy_xml == null ? 0 : 1

  product_id          = azurerm_api_management_product.this.product_id
  api_management_name = var.api_management_name
  resource_group_name = var.resource_group_name
product.tf#L20
resource "azurerm_api_management_product_policy" "apim_product_policy" {
  count               = var.product_policy != "" ? 1 : 0
  product_id          = azurerm_api_management_product.product.product_id
  api_management_name = azurerm_api_management_product.product.api_management_name
  resource_group_name = azurerm_api_management_product.product.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 an API Management Product Policy

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

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

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

For Terraform, the kevinhead/azurerm, niveklabs/azurerm and pagopa/io-infrastructure-modules-new source code examples are useful. See the Terraform Example section for further details.