我正在二头肌中设置 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。
我不知道该怎么做。
谢谢
如果您检查
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'
}
}
}
}
部署成功: