Azure API Management Product

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

azurerm_api_management_product (Terraform)

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

Example Usage from GitHub

main.tf#L27
resource "azurerm_api_management_product" "apim_product_std" {
    product_id              = "training-people-product-std"
    api_management_name     = data.azurerm_api_management.apim.name
    resource_group_name     = data.azurerm_resource_group.rg.name

    display_name            = "PeopleStd"
main.tf#L1
resource "azurerm_api_management_product" "product" {

  resource_group_name   = var.context.resource_group_name

  product_id            = var.service_settings.product_id
  api_management_name   = var.service_settings.endpoint_name
main.tf#L1
resource "azurerm_api_management_product" "product" {

  resource_group_name   = var.context.resource_group_name

  product_id            = var.service_settings.product_id
  api_management_name   = var.service_settings.endpoint_name
main.tf#L2
resource "azurerm_api_management_product" "product" {

  product_id            = var.product_id
  api_management_name   = var.apim_name
  resource_group_name   = var.resource_group_name
  display_name          = var.description
r-products-groups.tf#L9
resource "azurerm_api_management_product" "product" {
  for_each              = toset(var.products)
  product_id            = each.key
  resource_group_name   = var.resource_group_name
  api_management_name   = azurerm_api_management.apim.name
  display_name          = each.key
products.tf#L1
resource "azurerm_api_management_product" "dadjoke" {
  product_id            = "DadJokeProduct"
  resource_group_name = local.resource_group_name
  api_management_name = data.azurerm_api_management.apim.name
  display_name          = "DadJokeProduct"
  subscription_required = true
products.tf#L1
resource "azurerm_api_management_product" "product" {
  for_each = { for apim_product in var.apim_product : apim_product.product_id => apim_product }
  api_management_name   = var.apim_name
  resource_group_name   = var.apim_resource_group
  product_id            = each.value.product_id
  description           = each.value.description
products.tf#L1
resource "azurerm_api_management_product" "freemium" {
  product_id            = "freemium"
  api_management_name   = azurerm_api_management.apim.name
  resource_group_name   = azurerm_resource_group.rg.name
  display_name          = "Freemium"
  subscription_required = true
main.tf#L7
resource "azurerm_api_management_product" "this" {
  api_management_name   = var.api_management_name
  approval_required     = var.approval_required
  description           = var.description
  display_name          = var.display_name
  product_id            = var.product_id
main.tf#L13
resource "azurerm_api_management_product" "api_management_product" {
  product_id            = var.product_id
  resource_group_name   = var.resource_group_name
  api_management_name   = var.api_management_name
  display_name          = var.display_name
  description           = var.description

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.

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

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

    Product identifier. Must be unique in the current API Management service instance.

  • properties required
      • approvalRequired optional - boolean

        whether subscription approval is required. If false, new subscriptions will be approved automatically enabling developers to call the product’s APIs immediately after subscribing. If true, administrators must manually approve the subscription before the developer can any of the product’s APIs. Can be present only if subscriptionRequired property is present and has a value of false.

      • description optional - string

        Product description. May include HTML formatting tags.

      • displayName required - string

        Product name.

      • state optional - string

        whether product is published or not. Published products are discoverable by users of developer portal. Non published products are visible only to administrators. Default state of Product is notPublished.

      • subscriptionRequired optional - boolean

        Whether a product subscription is required for accessing APIs included in this product. If true, the product is referred to as "protected" and a valid subscription key is required for a request to an API included in the product to succeed. If false, the product is referred to as "open" and requests to an API included in the product can be made without a subscription key. If property is omitted when creating a new product it's value is assumed to be true.

      • subscriptionsLimit optional - integer

        Whether the number of subscriptions a user can have to this product at the same time. Set to null or omit to allow unlimited per user subscriptions. Can be present only if subscriptionRequired property is present and has a value of false.

      • terms optional - string

        Product terms of use. Developers trying to subscribe to the product will be presented and required to accept these terms before they can complete the subscription process.

  • type required - string

Frequently asked questions

What is Azure API Management Product?

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

For Terraform, the NewSignature/apim-training, aadi555/azurerm and persistentsystems/terraform-azurerm source code examples are useful. See the Terraform Example section for further details.