简体   繁体   中英

Issue with importing Azure Function App in Azure APIM using Swashbuckle

We are using Swashbuckle (v 3.2.2) to generate Swagger (OpenAPI) document for Azure Function Apps (v3). We are able to import Azure Function App in APIM using below PowerShell script:

 $specificationUrl="https://myfunctionapp.azurewebsites.net/api/swagger/json?code=tdkaksas8393dkkfkr04kfkkfkf9933kk9==" $apiContext = New-AzApiManagementContext -ResourceGroupName "MyResourceGroup" -ServiceName "MyServiceName" Import-AzApiManagementApi -Context $apiContext -SpecificationFormat "OpenApi" -SpecificationUrl $specificationUrl -Path apis

The issue is Azure function app is not getting imported with correct setting in APIM. Imported operation's Backend Target type should be "Azure Resource" but Target type getting set to "HTTP(s) endpoint". Apart from this we are even not getting "Azure Resource" as option instead it shows "Azure Logic App". When we do manually it shows correct Backend Target ie "Azure Resource". Pls refer screenshot here for details.

We are using Swashbuckle version 3.2.2 Swashbuckle and referred this link for implementation of Swagger(OpenAPI) for Azure Functions.

As per official document , below is the syntax for this operation:

$context = New-AzApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
Import-AzApiManagementApi -Context $context -SpecificationFormat OpenApi -SpecificationUrl https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml -Path "petstore30"

ApiId                         : af3f57bab399455aa875d7050654e9d1
Name                          : Swagger Petstore
Description                   :
ServiceUrl                    : http://petstore.swagger.io/v1
Path                          : petstore30
ApiType                       : http
Protocols                     : {Https}
AuthorizationServerId         :
AuthorizationScope            :
OpenidProviderId              :
BearerTokenSendingMethod      : {}
SubscriptionKeyHeaderName     : Ocp-Apim-Subscription-Key
SubscriptionKeyQueryParamName : subscription-key
ApiRevision                   : 1
ApiVersion                    :
IsCurrent                     : True
IsOnline                      : False
SubscriptionRequired          :
ApiRevisionDescription        :
ApiVersionSetDescription      :
ApiVersionSetId               :
Id                            : /subscriptions/subid/resourceGroups/Api-Default-West-US/providers/Microsoft.ApiManagement/service/contoso/apis/af3f57bab399455aa875d7050654e9d1     
ResourceGroupName             : Api-Default-West-US
ServiceName                   : contoso

Try following it. Also, make sure that Open API file is correctly configured.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM