Azure API Management Named Value

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

azurerm_api_management_named_value (Terraform)

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

Example Usage from GitHub

apim_named_value.tf#L1
resource "azurerm_api_management_named_value" "keyvault_baseurl" {
  name                = "keyvault-baseurl"
  resource_group_name = var.resource_group_name
  api_management_name = module.apim.name
  display_name        = "keyvault-baseurl"
  value               = module.key_vault.private_uri
named-values.tf#L1
resource "azurerm_api_management_named_value" "basic-auth-password" {
  name                = "basic-auth-password"
  resource_group_name = local.shared-rg
  api_management_name = local.apim_name
  display_name        = "basic-auth-password"
  value               = var.basic_auth_password
namedvalues.tf#L1
resource "azurerm_api_management_named_value" "dadjoke_pagelimit" {
  name                = "DadJokePageLimit"
  resource_group_name = local.resource_group_name
  api_management_name = data.azurerm_api_management.apim.name
  display_name        = "DadJokePageLimit"
  value               = "10"
main.tf#L20
resource "azurerm_api_management_named_value" "environment" {
  name                = "environment"
  resource_group_name = var.vnet_rg
  api_management_name = module.api-mgmt.name
  display_name        = "environment"
  value               = var.env
r-named-values.tf#L1
resource "azurerm_api_management_named_value" "named_values" {
  for_each            = { for named_value in var.named_values : named_value["name"] => named_value }
  api_management_name = azurerm_api_management.apim.name
  display_name        = lookup(each.value, "display_name", lookup(each.value, "name"))
  name                = lookup(each.value, "name")
  resource_group_name = var.resource_group_name
resource.tf#L1
resource "azurerm_api_management_named_value" "apim-nv" {
  count               = length(var.res_apim_nv_info)
  name                = var.res_apim_nv_info[count.index].name
  display_name        = var.res_apim_nv_info[count.index].display_name
  value               = var.res_apim_nv_info[count.index].value
  resource_group_name = var.res_rg_name
main.tf#L21
resource "azurerm_api_management_named_value" "environment" {
  name                = "environment"
  resource_group_name = local.vnet_rg
  api_management_name = module.api-mgmt.name
  display_name        = "environment"
  value               = var.env
main.tf#L29
resource "azurerm_api_management_named_value" "api_mngmt_named_value" {
  name                = "value0"
  resource_group_name = azurerm_resource_group.group.name
  api_management_name = azurerm_api_management.api_mngmt.name
  display_name        = "name"
  value               = "value"
main.tf#L7
resource "azurerm_api_management_named_value" "this" {
  api_management_name = var.api_management_name
  display_name        = var.display_name
  name                = var.name
  resource_group_name = var.resource_group_name
  secret              = var.secret
main.terratag.tf#L31
resource "azurerm_api_management_named_value" "api_mngmt_named_value" {
  name                = "value0"
  resource_group_name = azurerm_resource_group.group.name
  api_management_name = azurerm_api_management.api_mngmt.name
  display_name        = "name"
  value               = "value"

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 Named Value.

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

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

  • properties required
      • displayName required - string

        Unique name of NamedValue. It may contain only letters, digits, period, dash, and underscore characters.

      • keyVault optional
          • identityClientId optional - string

            SystemAssignedIdentity or UserAssignedIdentity Client Id which will be used to access key vault secret.

          • secretIdentifier optional - string

            Key vault secret identifier for fetching secret. Providing a versioned secret will prevent auto-refresh. This requires API Management service to be configured with aka.ms/apimmsi

      • secret optional - boolean

        Determines whether the value is a secret and should be encrypted or not. Default value is false.

      • tags optional - array

        Optional tags that when provided can be used to filter the NamedValue list.

      • value optional - string

        Value of the NamedValue. Can contain policy expressions. It may not be empty or consist only of whitespace. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value.

  • type required - string

Frequently asked questions

What is Azure API Management Named Value?

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

For Terraform, the kjsenthil/kjsenthil, MohdmM01/terraform-azure-demo and fortunkam/apim-devops-demos source code examples are useful. See the Terraform Example section for further details.