共用方式為


Microsoft.ApiManagement 服務/apis

Bicep 資源定義

服務/apis 資源類型可以使用目標作業來部署:

如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔

資源格式

若要建立 Microsoft.ApiManagement/service/apis 資源,請將下列 Bicep 新增至範本。

resource symbolicname 'Microsoft.ApiManagement/service/apis@2025-03-01-preview' = {
  parent: resourceSymbolicName
  name: 'string'
  properties: {
    apiRevision: 'string'
    apiRevisionDescription: 'string'
    apiType: 'string'
    apiVersion: 'string'
    apiVersionDescription: 'string'
    apiVersionSet: {
      description: 'string'
      id: 'string'
      name: 'string'
      versionHeaderName: 'string'
      versioningScheme: 'string'
      versionQueryName: 'string'
    }
    apiVersionSetId: 'string'
    authenticationSettings: {
      oAuth2: {
        authorizationServerId: 'string'
        scope: 'string'
      }
      oAuth2AuthenticationSettings: [
        {
          authorizationServerId: 'string'
          scope: 'string'
        }
      ]
      openid: {
        bearerTokenSendingMethods: [
          'string'
        ]
        openidProviderId: 'string'
      }
      openidAuthenticationSettings: [
        {
          bearerTokenSendingMethods: [
            'string'
          ]
          openidProviderId: 'string'
        }
      ]
    }
    contact: {
      email: 'string'
      name: 'string'
      url: 'string'
    }
    description: 'string'
    displayName: 'string'
    format: 'string'
    isCurrent: bool
    license: {
      name: 'string'
      url: 'string'
    }
    path: 'string'
    protocols: [
      'string'
    ]
    serviceUrl: 'string'
    sourceApiId: 'string'
    subscriptionKeyParameterNames: {
      header: 'string'
      query: 'string'
    }
    subscriptionRequired: bool
    termsOfServiceUrl: 'string'
    translateRequiredQueryParameters: 'string'
    type: 'string'
    value: 'string'
    wsdlSelector: {
      wsdlEndpointName: 'string'
      wsdlServiceName: 'string'
    }
  }
}

屬性值

Microsoft.ApiManagement/service/apis

名字 描述 價值
名字 資源名稱 字串

約束:
最小長度 = 1
最大長度 = 256
模式 = ^[^*#&+:<>?]+$ (必要)
父代 在 Bicep 中,您可以指定子資源的父資源。 只有在父資源外部宣告子資源時,才需要新增這個屬性。

如需詳細資訊,請參閱 父資源外部的子資源
類型的資源符號名稱:服務
性能 API 實體建立更新屬性。 ApiCreateOrUpdatePropertiesOrApiContractProperties

Api聯繫方式

名字 描述 價值
電子郵件 連絡人/組織的電子郵件位址。 必須是電子郵件位址的格式 字串
名字 聯繫人/組織的識別名稱 字串
URL 指向連絡資訊的 URL。 必須是 URL 的格式 字串

ApiCreateOrUpdatePropertiesOrApiContractProperties

名字 描述 價值
api修訂版 描述 API 的修訂。 如果未提供任何值,則會建立預設修訂 1 字串

約束:
最小長度 = 1
最大長度 = 100
apiRevision描述 API 修訂的描述。 字串

約束:
最大長度 = 256
api類型 要建立的 API 類型。
* http 建立 REST API
* soap 建立SOAP傳遞API
* websocket 建立 websocket API
* graphql 會建立 GraphQL API。
未來可以新增類型。
'GraphQL'
'gRPC 檔'
“http”
'OData'
'肥皂'
'websocket'
apiVersion 如果 API 已設定版本,則指出 API 的版本識別碼 字串

約束:
最大長度 = 100
apiVersion描述 API 版本的描述。 字串

約束:
最大長度 = 256
apiVersionSet 版本設定詳細數據 ApiVersionSetContractDetails
apiVersionSetId 相關 ApiVersionSet 的資源標識碼。 字串
authenticationSettings 此 API 中包含的驗證設定集合。 AuthenticationSettingsContract
聯繫 API 的連絡資訊。 Api聯繫方式
描述 API 的描述。 可能包含 HTML 格式標記。 字串
顯示名稱 API 名稱。 長度必須為 1 到 300 個字元。 字串

約束:
最小長度 = 1
最大長度 = 300
格式 匯入 API 的內容格式。 未來可以新增新格式 'graphql-連結'
'gRPC 檔'
“grpc-link”
'OData'
“odata-link”
'openapi'
'openapi+json'
'openapi+json-link'
'openapi-link'
'swagger-json'
'swagger-link-json'
'wadl-link-json'
“wadl-xml”
'wsdl'
'wsdl-link'
當前 指出 API 修訂是否為目前的 API 修訂。 布爾 (bool)
使用權 API 的授權資訊。 ApiLicenseInformation
路徑 相對 URL 會唯一識別此 API 及其 API 管理服務實例內的所有資源路徑。 它會附加至服務實例建立期間指定的 API 端點基底 URL,以形成此 API 的公用 URL。 字串

約束:
最大長度 = 400 (必要)
協定 描述可以叫用此 API 中作業的通訊協定。 包含任何的字串數組:
“http”
'https'
'WS'
'WSS'
服務網址 (serviceUrl) 實作此 API 之後端服務的絕對 URL。 長度不能超過 2000 個字元。 字串

約束:
最大長度 = 2000
源 ApiId 來源 API 的 API 識別碼。 字串
subscriptionKeyParameterNames API 可供使用之通訊協定。 SubscriptionKeyParameterNamesContract
subscriptionRequired 訂閱 指定存取 API 是否需要 API 或 Product 訂用帳戶。 布爾 (bool)
termsOfServiceUrl API 服務條款的 URL。 必須是 URL 的格式。 字串
translateRequiredQueryParameters 將所需的查詢參數轉譯為範本的策略。 根據預設,值為 'template'。 可能的值:'template'、'query' 'query' 查詢
'範本'
型別 API 的類型。 'GraphQL'
'gRPC 檔'
“http”
'OData'
'肥皂'
'websocket'
價值 匯入 API 時的內容值。 字串
wsdl選擇器 將 WSDL 匯入限制為檔的子集的準則。 ApiCreateOrUpdatePropertiesWsdlSelector

ApiCreateOrUpdatePropertiesWsdlSelector

名字 描述 價值
wsdlEndpointName (wsdl端點名稱) 要從 WSDL 匯入的 endpoint(port) 名稱 字串
wsdlService名稱 要從 WSDL 匯入的服務名稱 字串

ApiLicenseInformation

名字 描述 價值
名字 用於 API 的授權名稱 字串
URL 用於 API 之授權的 URL。 必須是 URL 的格式 字串

ApiVersionSetContractDetails

名字 描述 價值
描述 API 版本集的描述。 字串
識別碼 現有 API 版本集的識別碼。 省略此值以建立新的版本集。 字串
名字 API 版本集的顯示名稱。 字串
versionHeaderName (版本標頭名稱) 如果 versioningScheme 設定為 header,則為 HTTP 標頭參數的名稱,指出 API 版本。 字串
versioningScheme 版本 值,決定 API 版本識別碼在 HTTP 要求中的位置。 '標頭'
“查詢”
細分”
versionQueryName (版本查詢名稱) 如果 versioningScheme 設定為 query,則表示 API 版本的查詢參數名稱。 字串

AuthenticationSettingsContract

名字 描述 價值
o身份驗證 2 OAuth2 驗證設定 OAuth2AuthenticationSettingsContract
oAuth2AuthenticationSettings 此 API 中包含的 OAuth2 驗證設定集合。 OAuth2AuthenticationSettingsContract[]
openid OpenID Connect 驗證設定 OpenIdAuthenticationSettingsContract
openidAuthenticationSettings 此 API 中包含的 Open ID Connect 驗證設定集合。 OpenIdAuthenticationSettingsContract[]

OAuth2AuthenticationSettingsContract

名字 描述 價值
authorizationServerId OAuth 授權伺服器標識碼。 字串
範圍 作業範圍。 字串

OpenIdAuthenticationSettingsContract

名字 描述 價值
bearerTokenSending方法 如何將令牌傳送至伺服器。 包含任何的字串數組:
'authorizationHeader'
'query' 查詢
openidProviderId OAuth 授權伺服器標識碼。 字串

SubscriptionKeyParameterNamesContract

名字 描述 價值
標頭 訂用帳戶金鑰標頭名稱。 字串
查詢 訂用帳戶金鑰查詢字串參數名稱。 字串

ARM 樣本資源定義

服務/apis 資源類型可以使用目標作業來部署:

如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔

資源格式

若要建立 Microsoft.ApiManagement/service/apis 資源,請將下列 JSON 新增至範本。

{
  "type": "Microsoft.ApiManagement/service/apis",
  "apiVersion": "2025-03-01-preview",
  "name": "string",
  "properties": {
    "apiRevision": "string",
    "apiRevisionDescription": "string",
    "apiType": "string",
    "apiVersion": "string",
    "apiVersionDescription": "string",
    "apiVersionSet": {
      "description": "string",
      "id": "string",
      "name": "string",
      "versionHeaderName": "string",
      "versioningScheme": "string",
      "versionQueryName": "string"
    },
    "apiVersionSetId": "string",
    "authenticationSettings": {
      "oAuth2": {
        "authorizationServerId": "string",
        "scope": "string"
      },
      "oAuth2AuthenticationSettings": [
        {
          "authorizationServerId": "string",
          "scope": "string"
        }
      ],
      "openid": {
        "bearerTokenSendingMethods": [ "string" ],
        "openidProviderId": "string"
      },
      "openidAuthenticationSettings": [
        {
          "bearerTokenSendingMethods": [ "string" ],
          "openidProviderId": "string"
        }
      ]
    },
    "contact": {
      "email": "string",
      "name": "string",
      "url": "string"
    },
    "description": "string",
    "displayName": "string",
    "format": "string",
    "isCurrent": "bool",
    "license": {
      "name": "string",
      "url": "string"
    },
    "path": "string",
    "protocols": [ "string" ],
    "serviceUrl": "string",
    "sourceApiId": "string",
    "subscriptionKeyParameterNames": {
      "header": "string",
      "query": "string"
    },
    "subscriptionRequired": "bool",
    "termsOfServiceUrl": "string",
    "translateRequiredQueryParameters": "string",
    "type": "string",
    "value": "string",
    "wsdlSelector": {
      "wsdlEndpointName": "string",
      "wsdlServiceName": "string"
    }
  }
}

屬性值

Microsoft.ApiManagement/service/apis

名字 描述 價值
apiVersion API 版本 '2025-03-01-preview'
名字 資源名稱 字串

約束:
最小長度 = 1
最大長度 = 256
模式 = ^[^*#&+:<>?]+$ (必要)
性能 API 實體建立更新屬性。 ApiCreateOrUpdatePropertiesOrApiContractProperties
型別 資源類型 “Microsoft.ApiManagement/service/apis”

Api聯繫方式

名字 描述 價值
電子郵件 連絡人/組織的電子郵件位址。 必須是電子郵件位址的格式 字串
名字 聯繫人/組織的識別名稱 字串
URL 指向連絡資訊的 URL。 必須是 URL 的格式 字串

ApiCreateOrUpdatePropertiesOrApiContractProperties

名字 描述 價值
api修訂版 描述 API 的修訂。 如果未提供任何值,則會建立預設修訂 1 字串

約束:
最小長度 = 1
最大長度 = 100
apiRevision描述 API 修訂的描述。 字串

約束:
最大長度 = 256
api類型 要建立的 API 類型。
* http 建立 REST API
* soap 建立SOAP傳遞API
* websocket 建立 websocket API
* graphql 會建立 GraphQL API。
未來可以新增類型。
'GraphQL'
'gRPC 檔'
“http”
'OData'
'肥皂'
'websocket'
apiVersion 如果 API 已設定版本,則指出 API 的版本識別碼 字串

約束:
最大長度 = 100
apiVersion描述 API 版本的描述。 字串

約束:
最大長度 = 256
apiVersionSet 版本設定詳細數據 ApiVersionSetContractDetails
apiVersionSetId 相關 ApiVersionSet 的資源標識碼。 字串
authenticationSettings 此 API 中包含的驗證設定集合。 AuthenticationSettingsContract
聯繫 API 的連絡資訊。 Api聯繫方式
描述 API 的描述。 可能包含 HTML 格式標記。 字串
顯示名稱 API 名稱。 長度必須為 1 到 300 個字元。 字串

約束:
最小長度 = 1
最大長度 = 300
格式 匯入 API 的內容格式。 未來可以新增新格式 'graphql-連結'
'gRPC 檔'
“grpc-link”
'OData'
“odata-link”
'openapi'
'openapi+json'
'openapi+json-link'
'openapi-link'
'swagger-json'
'swagger-link-json'
'wadl-link-json'
“wadl-xml”
'wsdl'
'wsdl-link'
當前 指出 API 修訂是否為目前的 API 修訂。 布爾 (bool)
使用權 API 的授權資訊。 ApiLicenseInformation
路徑 相對 URL 會唯一識別此 API 及其 API 管理服務實例內的所有資源路徑。 它會附加至服務實例建立期間指定的 API 端點基底 URL,以形成此 API 的公用 URL。 字串

約束:
最大長度 = 400 (必要)
協定 描述可以叫用此 API 中作業的通訊協定。 包含任何的字串數組:
“http”
'https'
'WS'
'WSS'
服務網址 (serviceUrl) 實作此 API 之後端服務的絕對 URL。 長度不能超過 2000 個字元。 字串

約束:
最大長度 = 2000
源 ApiId 來源 API 的 API 識別碼。 字串
subscriptionKeyParameterNames API 可供使用之通訊協定。 SubscriptionKeyParameterNamesContract
subscriptionRequired 訂閱 指定存取 API 是否需要 API 或 Product 訂用帳戶。 布爾 (bool)
termsOfServiceUrl API 服務條款的 URL。 必須是 URL 的格式。 字串
translateRequiredQueryParameters 將所需的查詢參數轉譯為範本的策略。 根據預設,值為 'template'。 可能的值:'template'、'query' 'query' 查詢
'範本'
型別 API 的類型。 'GraphQL'
'gRPC 檔'
“http”
'OData'
'肥皂'
'websocket'
價值 匯入 API 時的內容值。 字串
wsdl選擇器 將 WSDL 匯入限制為檔的子集的準則。 ApiCreateOrUpdatePropertiesWsdlSelector

ApiCreateOrUpdatePropertiesWsdlSelector

名字 描述 價值
wsdlEndpointName (wsdl端點名稱) 要從 WSDL 匯入的 endpoint(port) 名稱 字串
wsdlService名稱 要從 WSDL 匯入的服務名稱 字串

ApiLicenseInformation

名字 描述 價值
名字 用於 API 的授權名稱 字串
URL 用於 API 之授權的 URL。 必須是 URL 的格式 字串

ApiVersionSetContractDetails

名字 描述 價值
描述 API 版本集的描述。 字串
識別碼 現有 API 版本集的識別碼。 省略此值以建立新的版本集。 字串
名字 API 版本集的顯示名稱。 字串
versionHeaderName (版本標頭名稱) 如果 versioningScheme 設定為 header,則為 HTTP 標頭參數的名稱,指出 API 版本。 字串
versioningScheme 版本 值,決定 API 版本識別碼在 HTTP 要求中的位置。 '標頭'
“查詢”
細分”
versionQueryName (版本查詢名稱) 如果 versioningScheme 設定為 query,則表示 API 版本的查詢參數名稱。 字串

AuthenticationSettingsContract

名字 描述 價值
o身份驗證 2 OAuth2 驗證設定 OAuth2AuthenticationSettingsContract
oAuth2AuthenticationSettings 此 API 中包含的 OAuth2 驗證設定集合。 OAuth2AuthenticationSettingsContract[]
openid OpenID Connect 驗證設定 OpenIdAuthenticationSettingsContract
openidAuthenticationSettings 此 API 中包含的 Open ID Connect 驗證設定集合。 OpenIdAuthenticationSettingsContract[]

OAuth2AuthenticationSettingsContract

名字 描述 價值
authorizationServerId OAuth 授權伺服器標識碼。 字串
範圍 作業範圍。 字串

OpenIdAuthenticationSettingsContract

名字 描述 價值
bearerTokenSending方法 如何將令牌傳送至伺服器。 包含任何的字串數組:
'authorizationHeader'
'query' 查詢
openidProviderId OAuth 授權伺服器標識碼。 字串

SubscriptionKeyParameterNamesContract

名字 描述 價值
標頭 訂用帳戶金鑰標頭名稱。 字串
查詢 訂用帳戶金鑰查詢字串參數名稱。 字串

使用範例

Terraform (AzAPI 提供者) 資源定義

服務/apis 資源類型可以使用目標作業來部署:

如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔

資源格式

若要建立 Microsoft.ApiManagement/service/apis 資源,請將下列 Terraform 新增至您的範本。

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.ApiManagement/service/apis@2025-03-01-preview"
  name = "string"
  parent_id = "string"
  body = {
    properties = {
      apiRevision = "string"
      apiRevisionDescription = "string"
      apiType = "string"
      apiVersion = "string"
      apiVersionDescription = "string"
      apiVersionSet = {
        description = "string"
        id = "string"
        name = "string"
        versionHeaderName = "string"
        versioningScheme = "string"
        versionQueryName = "string"
      }
      apiVersionSetId = "string"
      authenticationSettings = {
        oAuth2 = {
          authorizationServerId = "string"
          scope = "string"
        }
        oAuth2AuthenticationSettings = [
          {
            authorizationServerId = "string"
            scope = "string"
          }
        ]
        openid = {
          bearerTokenSendingMethods = [
            "string"
          ]
          openidProviderId = "string"
        }
        openidAuthenticationSettings = [
          {
            bearerTokenSendingMethods = [
              "string"
            ]
            openidProviderId = "string"
          }
        ]
      }
      contact = {
        email = "string"
        name = "string"
        url = "string"
      }
      description = "string"
      displayName = "string"
      format = "string"
      isCurrent = bool
      license = {
        name = "string"
        url = "string"
      }
      path = "string"
      protocols = [
        "string"
      ]
      serviceUrl = "string"
      sourceApiId = "string"
      subscriptionKeyParameterNames = {
        header = "string"
        query = "string"
      }
      subscriptionRequired = bool
      termsOfServiceUrl = "string"
      translateRequiredQueryParameters = "string"
      type = "string"
      value = "string"
      wsdlSelector = {
        wsdlEndpointName = "string"
        wsdlServiceName = "string"
      }
    }
  }
}

屬性值

Microsoft.ApiManagement/service/apis

名字 描述 價值
名字 資源名稱 字串

約束:
最小長度 = 1
最大長度 = 256
模式 = ^[^*#&+:<>?]+$ (必要)
父項識別碼 此資源為父系之資源的標識碼。 類型的資源標識碼:服務
性能 API 實體建立更新屬性。 ApiCreateOrUpdatePropertiesOrApiContractProperties
型別 資源類型 “Microsoft.ApiManagement/service/apis@2025-03-01-preview”

Api聯繫方式

名字 描述 價值
電子郵件 連絡人/組織的電子郵件位址。 必須是電子郵件位址的格式 字串
名字 聯繫人/組織的識別名稱 字串
URL 指向連絡資訊的 URL。 必須是 URL 的格式 字串

ApiCreateOrUpdatePropertiesOrApiContractProperties

名字 描述 價值
api修訂版 描述 API 的修訂。 如果未提供任何值,則會建立預設修訂 1 字串

約束:
最小長度 = 1
最大長度 = 100
apiRevision描述 API 修訂的描述。 字串

約束:
最大長度 = 256
api類型 要建立的 API 類型。
* http 建立 REST API
* soap 建立SOAP傳遞API
* websocket 建立 websocket API
* graphql 會建立 GraphQL API。
未來可以新增類型。
'GraphQL'
'gRPC 檔'
“http”
'OData'
'肥皂'
'websocket'
apiVersion 如果 API 已設定版本,則指出 API 的版本識別碼 字串

約束:
最大長度 = 100
apiVersion描述 API 版本的描述。 字串

約束:
最大長度 = 256
apiVersionSet 版本設定詳細數據 ApiVersionSetContractDetails
apiVersionSetId 相關 ApiVersionSet 的資源標識碼。 字串
authenticationSettings 此 API 中包含的驗證設定集合。 AuthenticationSettingsContract
聯繫 API 的連絡資訊。 Api聯繫方式
描述 API 的描述。 可能包含 HTML 格式標記。 字串
顯示名稱 API 名稱。 長度必須為 1 到 300 個字元。 字串

約束:
最小長度 = 1
最大長度 = 300
格式 匯入 API 的內容格式。 未來可以新增新格式 'graphql-連結'
'gRPC 檔'
“grpc-link”
'OData'
“odata-link”
'openapi'
'openapi+json'
'openapi+json-link'
'openapi-link'
'swagger-json'
'swagger-link-json'
'wadl-link-json'
“wadl-xml”
'wsdl'
'wsdl-link'
當前 指出 API 修訂是否為目前的 API 修訂。 布爾 (bool)
使用權 API 的授權資訊。 ApiLicenseInformation
路徑 相對 URL 會唯一識別此 API 及其 API 管理服務實例內的所有資源路徑。 它會附加至服務實例建立期間指定的 API 端點基底 URL,以形成此 API 的公用 URL。 字串

約束:
最大長度 = 400 (必要)
協定 描述可以叫用此 API 中作業的通訊協定。 包含任何的字串數組:
“http”
'https'
'WS'
'WSS'
服務網址 (serviceUrl) 實作此 API 之後端服務的絕對 URL。 長度不能超過 2000 個字元。 字串

約束:
最大長度 = 2000
源 ApiId 來源 API 的 API 識別碼。 字串
subscriptionKeyParameterNames API 可供使用之通訊協定。 SubscriptionKeyParameterNamesContract
subscriptionRequired 訂閱 指定存取 API 是否需要 API 或 Product 訂用帳戶。 布爾 (bool)
termsOfServiceUrl API 服務條款的 URL。 必須是 URL 的格式。 字串
translateRequiredQueryParameters 將所需的查詢參數轉譯為範本的策略。 根據預設,值為 'template'。 可能的值:'template'、'query' 'query' 查詢
'範本'
型別 API 的類型。 'GraphQL'
'gRPC 檔'
“http”
'OData'
'肥皂'
'websocket'
價值 匯入 API 時的內容值。 字串
wsdl選擇器 將 WSDL 匯入限制為檔的子集的準則。 ApiCreateOrUpdatePropertiesWsdlSelector

ApiCreateOrUpdatePropertiesWsdlSelector

名字 描述 價值
wsdlEndpointName (wsdl端點名稱) 要從 WSDL 匯入的 endpoint(port) 名稱 字串
wsdlService名稱 要從 WSDL 匯入的服務名稱 字串

ApiLicenseInformation

名字 描述 價值
名字 用於 API 的授權名稱 字串
URL 用於 API 之授權的 URL。 必須是 URL 的格式 字串

ApiVersionSetContractDetails

名字 描述 價值
描述 API 版本集的描述。 字串
識別碼 現有 API 版本集的識別碼。 省略此值以建立新的版本集。 字串
名字 API 版本集的顯示名稱。 字串
versionHeaderName (版本標頭名稱) 如果 versioningScheme 設定為 header,則為 HTTP 標頭參數的名稱,指出 API 版本。 字串
versioningScheme 版本 值,決定 API 版本識別碼在 HTTP 要求中的位置。 '標頭'
“查詢”
細分”
versionQueryName (版本查詢名稱) 如果 versioningScheme 設定為 query,則表示 API 版本的查詢參數名稱。 字串

AuthenticationSettingsContract

名字 描述 價值
o身份驗證 2 OAuth2 驗證設定 OAuth2AuthenticationSettingsContract
oAuth2AuthenticationSettings 此 API 中包含的 OAuth2 驗證設定集合。 OAuth2AuthenticationSettingsContract[]
openid OpenID Connect 驗證設定 OpenIdAuthenticationSettingsContract
openidAuthenticationSettings 此 API 中包含的 Open ID Connect 驗證設定集合。 OpenIdAuthenticationSettingsContract[]

OAuth2AuthenticationSettingsContract

名字 描述 價值
authorizationServerId OAuth 授權伺服器標識碼。 字串
範圍 作業範圍。 字串

OpenIdAuthenticationSettingsContract

名字 描述 價值
bearerTokenSending方法 如何將令牌傳送至伺服器。 包含任何的字串數組:
'authorizationHeader'
'query' 查詢
openidProviderId OAuth 授權伺服器標識碼。 字串

SubscriptionKeyParameterNamesContract

名字 描述 價值
標頭 訂用帳戶金鑰標頭名稱。 字串
查詢 訂用帳戶金鑰查詢字串參數名稱。 字串

使用範例

Terraform 範例

在 API 管理 服務內部署 API 的基本範例。

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" "api" {
  type      = "Microsoft.ApiManagement/service/apis@2021-08-01"
  parent_id = azapi_resource.service.id
  name      = "${var.resource_name};rev=1"
  body = {
    properties = {
      apiRevisionDescription = ""
      apiType                = "http"
      apiVersion             = ""
      apiVersionDescription  = ""
      authenticationSettings = {
      }
      description = ""
      displayName = "api1"
      path        = "api1"
      protocols = [
        "https",
      ]
      serviceUrl           = ""
      subscriptionRequired = true
      type                 = "http"
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}