API 管理。设置后端时二头肌出错

问题描述 投票:0回答:1

我正在二头肌中设置 Azure APIM。有一个部分用于设置后端,如下所示:


resource backend_test 'Microsoft.ApiManagement/service/backends@2023-05-01-preview' = {
  name: 'backend_test'
  parent: apimservice 
  properties: {
      url: api_url
      protocol: 'http'
      // credentials: {
      //     authorization: {
      //         parameter: 'query'
      //         scheme: 'basic'
      //     }
      // }
  }
}

在设置协议

protocol: 'http'
时的行中,如果我将其设置为
https
,则会失败并出现不支持的协议错误。
Protocol is not supported (Code: ValidationError, Target: protocol)
,如果我将其保留为
http
,它就可以工作。文档说这个字段可以同时支持http和https。

我不知道该怎么做。

谢谢

azure azure-api-management bicep
1个回答
0
投票

如果您检查

Microsoft.ApiManagement/service/backends
服务后端 properties,字段
protocol
仅支持
http
soap
类型,感谢@Markus Meyer 推荐类似的。 。最新版本不支持
https
协议。 (例如:
2023-05-01-preview
)。

param apiManagementName string = 'apiservice${uniqueString(resourceGroup().id)}'
param publisherEmail string = "[email protected]"
param publisherName string = "newpublisher"
param sku string = 'Developer'
param skuCount int = 1
param location string = resourceGroup().location

resource apiManagementService 'Microsoft.ApiManagement/service@2023-05-01-preview' = {
  name: apiManagementName
  location: location
  sku: {
    name: sku
    capacity: skuCount
  }
  properties: {
    publisherEmail: publisherEmail
    publisherName: publisherName
  }
}
resource backend_test 'Microsoft.ApiManagement/service/backends@2023-05-01-preview' = {
  name: 'backend_test'
  parent: apiManagementService 
  properties: {
    url: 'https://xxx.contoso.com'
      protocol: 'http'
       credentials: {
          authorization: {
              parameter: 'query'
              scheme: 'basic'
          }
       }
  }
}

部署成功:

enter image description here

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.