Azure API Management API

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

azurerm_api_management_api (Terraform)

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

Example Usage from GitHub

apim.tf#L13
resource "azurerm_api_management_api" "rivers" {
    name = "rivers"
    display_name = "rivers"
    path = "rivers"
    resource_group_name = var.rg_name
    api_management_name =azurerm_api_management.apim.name
apim_nodo_services.tf#L51
resource "azurerm_api_management_api" "apim_nodo_pagamenti_api_psp_svr" {
  # source = "git::https://github.com/pagopa/azurerm.git//api_management_api?ref=v1.0.16"

  name                = format("%s-nodo-pagamenti-psp-svr-api", var.env_short)
  api_management_name = module.apim.name
  resource_group_name = azurerm_resource_group.rg_api.name
apis.tf#L2
resource "azurerm_api_management_api" "example" {
  name                = "example-api"
  resource_group_name = azurerm_resource_group.rg.name
  api_management_name = azurerm_api_management.apim.name
  revision            = "1"
  display_name        = "Example API"
main.tf#L31
resource "azurerm_api_management_api" "VodafDev" {
  name                = "example-api"
  resource_group_name = azurerm_resource_group.VodafDev.name
  api_management_name = azurerm_api_management.VodafDev.name
  revision            = "1"
  display_name        = "POI API"
AzureAPIM.tf#L19
resource "azurerm_api_management_api" "CloudQuickPOCAPIMAPI" {
  name                = "cloudquickpocsapim-api"
  resource_group_name = azurerm_resource_group.CloudQuickPOCAPIMRG.name
  api_management_name = azurerm_api_management.CloudQuickPOCAPIM.name
  revision            = "1"
  display_name        = "CloudQuickPOCsFirstAPI"
api.tf#L1
resource "azurerm_api_management_api" "composite-api" {
  name                = "composite-api"
  resource_group_name = azurerm_resource_group.rg.name
  api_management_name = azurerm_api_management.apim.name
  revision            = "1"
  display_name        = "Composite API"
main.tf#L1
resource "azurerm_api_management_api" "module" {
  name                = var.api_name
  resource_group_name = var.rg_name
  api_management_name = var.apim_name
  revision            = var.api_revision
  display_name        = var.api_display_name
main.tf#L21
resource "azurerm_api_management_api" "attdemo" {
  for_each            = var.apimgmtdemo
  name                = each.value["name"]
  api_management_name = azurerm_api_management.att-apim[each.value.apim_key].name
  resource_group_name = var.apimresourcegroup
  revision            = each.value["revision"]
AzureAPIM.tf#L19
resource "azurerm_api_management_api" "CloudQuickPOCAPIMAPI" {
  name                = "cloudquickpocsapim-api"
  resource_group_name = azurerm_resource_group.CloudQuickPOCAPIMRG.name
  api_management_name = azurerm_api_management.CloudQuickPOCAPIM.name
  revision            = "1"
  display_name        = "CloudQuickPOCsFirstAPI"
main.tf#L3
resource "azurerm_api_management_api" "api" {

  resource_group_name = var.context.resource_group_name

  api_management_name = var.service_settings.endpoint_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 within an API Management Service.

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

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

    API revision identifier. Must be unique in the current API Management service instance. Non-current revision has ;rev=n as a suffix where n is the revision number.

  • properties required
      • apiRevision optional - string

        Describes the revision of the API. If no value is provided, default revision 1 is created

      • apiRevisionDescription optional - string

        Description of the API Revision.

      • apiType optional - string

        Type of API to create.

        • http creates a REST API
        • soap creates a SOAP pass-through API
        • websocket creates websocket API
        • graphql creates GraphQL API.
      • apiVersion optional - string

        Indicates the version identifier of the API if the API is versioned

      • apiVersionDescription optional - string

        Description of the API Version.

      • apiVersionSet optional
          • description optional - string

            Description of API Version Set.

          • id optional - string

            Identifier for existing API Version Set. Omit this value to create a new Version Set.

          • name optional - string

            The display Name of the API Version Set.

          • versionHeaderName optional - string

            Name of HTTP header parameter that indicates the API Version if versioningScheme is set to header.

          • versioningScheme optional - string

            An value that determines where the API Version identifier will be located in a HTTP request.

          • versionQueryName optional - string

            Name of query parameter that indicates the API Version if versioningScheme is set to query.

      • apiVersionSetId optional - string

        A resource identifier for the related ApiVersionSet.

      • authenticationSettings optional
          • oAuth2 optional
              • authorizationServerId optional - string

                OAuth authorization server identifier.

              • scope optional - string

                operations scope.

          • openid optional
              • bearerTokenSendingMethods optional - array

                How to send token to the server.

              • openidProviderId optional - string

                OAuth authorization server identifier.

      • contact optional
          • email optional - string

            The email address of the contact person/organization. MUST be in the format of an email address

          • name optional - string

            The identifying name of the contact person/organization

          • url optional - string

            The URL pointing to the contact information. MUST be in the format of a URL

      • description optional - string

        Description of the API. May include HTML formatting tags.

      • displayName optional - string

        API name. Must be 1 to 300 characters long.

      • format optional - string

        Format of the Content in which the API is getting imported.

      • isCurrent optional - boolean

        Indicates if API revision is current api revision.

      • license optional
          • name optional - string

            The license name used for the API

          • url optional - string

            A URL to the license used for the API. MUST be in the format of a URL

      • path required - string

        Relative URL uniquely identifying this API and all of its resource paths within the API Management service instance. It is appended to the API endpoint base URL specified during the service instance creation to form a public URL for this API.

      • protocols optional - array

        Describes on which protocols the operations in this API can be invoked.

      • serviceUrl optional - string

        Absolute URL of the backend service implementing this API. Cannot be more than 2000 characters long.

      • sourceApiId optional - string

        API identifier of the source API.

      • subscriptionKeyParameterNames optional
          • header optional - string

            Subscription key header name.

          • query optional - string

            Subscription key query string parameter name.

      • subscriptionRequired optional - boolean

        Specifies whether an API or Product subscription is required for accessing the API.

      • termsOfServiceUrl optional - string

        A URL to the Terms of Service for the API. MUST be in the format of a URL.

      • type optional - string

        Type of API.

      • value optional - string

        Content value when Importing an API.

      • wsdlSelector optional
          • wsdlEndpointName optional - string

            Name of endpoint(port) to import from WSDL

          • wsdlServiceName optional - string

            Name of service to import from WSDL

  • type required - string

Frequently asked questions

What is Azure API Management API?

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

For Terraform, the badgerowluke/whitewaterfinder, pagopa/pagopa-infra and 0GiS0/az-api-management-devops source code examples are useful. See the Terraform Example section for further details.