Tjänst/produkter/principer för Microsoft.ApiManagement 2024-06-01-preview

Bicep-resursdefinition

Resurstypen tjänst/produkter/principer kan distribueras med åtgärder som mål:

En lista över ändrade egenskaper i varje API-version finns i ändringsloggen.

Användningsexempel

Bicep-exempel

Ett grundläggande exempel på distribution av produktprinciper för API-hanteringstjänsten.

param resourceName string = 'acctest0001'
param location string = 'westeurope'

resource service 'Microsoft.ApiManagement/service@2021-08-01' = {
  name: resourceName
  location: location
  sku: {
    capacity: 0
    name: 'Consumption'
  }
  properties: {
    certificates: []
    customProperties: {
      'Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30': 'false'
      'Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10': 'false'
      'Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11': 'false'
      'Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10': 'false'
      'Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11': 'false'
    }
    disableGateway: false
    publicNetworkAccess: 'Enabled'
    publisherEmail: 'pub1@email.com'
    publisherName: 'pub1'
    virtualNetworkType: 'None'
  }
}

resource product 'Microsoft.ApiManagement/service/products@2021-08-01' = {
  name: resourceName
  parent: service
  properties: {
    description: ''
    displayName: 'Test Product'
    state: 'notPublished'
    subscriptionRequired: false
    terms: ''
  }
}

resource policy2 'Microsoft.ApiManagement/service/products/policies@2021-08-01' = {
  name: 'policy'
  parent: product
  properties: {
    format: 'rawxml-link'
    value: 'https://gist.githubusercontent.com/riordanp/ca22f8113afae0eb38cc12d718fd048d/raw/d6ac89a2f35a6881a7729f8cb4883179dc88eea1/example.xml'
  }
}

Azure-verifierade moduler

Följande Azure-verifierade moduler kan användas för att distribuera den här resurstypen.

Module Beskrivning
API-hanteringstjänst - Produkt - Policy AVM-barnmodul för API-hanteringstjänst - Produkt - Policy

Resursformat

Om du vill skapa en Microsoft.ApiManagement/service/products/policies-resurs lägger du till följande Bicep i mallen.

resource symbolicname 'Microsoft.ApiManagement/service/products/policies@2024-06-01-preview' = {
  parent: resourceSymbolicName
  name: 'string'
  properties: {
    format: 'string'
    value: 'string'
  }
}

Egenskapsvärden

Microsoft.ApiManagement/service/products/policies

Namn Beskrivning Värde
Namn Resursnamnet "policy" (krävs)
förälder I Bicep kan du ange den överordnade resursen för en underordnad resurs. Du behöver bara lägga till den här egenskapen när den underordnade resursen deklareras utanför den överordnade resursen.

Mer information finns i Underordnad resurs utanför den överordnade resursen.
Symboliskt namn för resurs av typen: tjänst/produkter
Egenskaper Egenskaper för principen. PolicyContractProperties

PolicyContractProperties

Namn Beskrivning Värde
format Format för policyContent. "rawxml"
"rawxml-link"
'xml'
"xml-link"
värde Innehållet i principen enligt formatet. sträng (krävs)

Resursdefinition för ARM-mall

Resurstypen tjänst/produkter/principer kan distribueras med åtgärder som mål:

Användningsexempel

Resursformat

Om du vill skapa en Resurs för Microsoft.ApiManagement/service/products/policies lägger du till följande JSON i mallen.

{
  "type": "Microsoft.ApiManagement/service/products/policies",
  "apiVersion": "2024-06-01-preview",
  "name": "string",
  "properties": {
    "format": "string",
    "value": "string"
  }
}

Egenskapsvärden

Microsoft.ApiManagement/service/products/policies

Namn Beskrivning Värde
apiVersion API-versionen "2024-06-01-preview"
Namn Resursnamnet "policy" (krävs)
Egenskaper Egenskaper för principen. PolicyContractProperties
typ Resurstypen "Microsoft.ApiManagement/service/products/policies"

PolicyContractProperties

Namn Beskrivning Värde
format Format för policyContent. "rawxml"
"rawxml-link"
'xml'
"xml-link"
värde Innehållet i principen enligt formatet. sträng (krävs)

Resursdefinition för Terraform (AzAPI-provider)

Resurstypen tjänst/produkter/principer kan distribueras med åtgärder som mål:

  • Resursgrupper För en lista över ändrade egenskaper i varje API-version, se ändringslogg.

Användningsexempel

Terraform-exempel

Ett grundläggande exempel på distribution av produktprinciper för API-hanteringstjänsten.

terraform {
  required_providers {
    azapi = {
      source = "Azure/azapi"
    }
  }
}

provider "azapi" {
  skip_provider_registration = false
}

variable "resource_name" {
  type    = string
  default = "acctest0001"
}

variable "location" {
  type    = string
  default = "westeurope"
}

resource "azapi_resource" "resourceGroup" {
  type     = "Microsoft.Resources/resourceGroups@2020-06-01"
  name     = var.resource_name
  location = var.location
}

resource "azapi_resource" "service" {
  type      = "Microsoft.ApiManagement/service@2021-08-01"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = var.location
  body = {
    properties = {
      certificates = [
      ]
      customProperties = {
        "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30" = "false"
        "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10" = "false"
        "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11" = "false"
        "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10"         = "false"
        "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11"         = "false"
      }
      disableGateway      = false
      publicNetworkAccess = "Enabled"
      publisherEmail      = "pub1@email.com"
      publisherName       = "pub1"
      virtualNetworkType  = "None"
    }
    sku = {
      capacity = 0
      name     = "Consumption"
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azapi_resource" "product" {
  type      = "Microsoft.ApiManagement/service/products@2021-08-01"
  parent_id = azapi_resource.service.id
  name      = var.resource_name
  body = {
    properties = {
      description          = ""
      displayName          = "Test Product"
      state                = "notPublished"
      subscriptionRequired = false
      terms                = ""
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azapi_resource" "policy2" {
  type      = "Microsoft.ApiManagement/service/products/policies@2021-08-01"
  parent_id = azapi_resource.product.id
  name      = "policy"
  body = {
    properties = {
      format = "rawxml-link"
      value  = "https://gist.githubusercontent.com/riordanp/ca22f8113afae0eb38cc12d718fd048d/raw/d6ac89a2f35a6881a7729f8cb4883179dc88eea1/example.xml"
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

Resursformat

Om du vill skapa en Resurs för Microsoft.ApiManagement/service/products/policies lägger du till följande Terraform i mallen.

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.ApiManagement/service/products/policies@2024-06-01-preview"
  name = "string"
  parent_id = "string"
  body = {
    properties = {
      format = "string"
      value = "string"
    }
  }
}

Egenskapsvärden

Microsoft.ApiManagement/service/products/policies

Namn Beskrivning Värde
Namn Resursnamnet "policy" (krävs)
parent_id ID för resursen som är överordnad för den här resursen. ID för resurs av typen: tjänst/produkter
Egenskaper Egenskaper för principen. PolicyContractProperties
typ Resurstypen "Microsoft.ApiManagement/service/products/policies@2024-06-01-preview"

PolicyContractProperties

Namn Beskrivning Värde
format Format för policyContent. "rawxml"
"rawxml-link"
'xml'
"xml-link"
värde Innehållet i principen enligt formatet. sträng (krävs)