通过Powershell将功能应用导入API管理中

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

作为CI / CD管道的一部分,我希望使用PowerShell在Azure API管理中注册Azure Function应用。通过查看文档,似乎Import-AzApiManagementApi cmdlet应该支持此功能,但-SpecificationFormat参数中似乎没有该选项可以从现有的Function App导入。

我确实看到了this feedback article在问类似的问题,但目前看来这不可能。

我确实尝试通过API定义刀片公开Function App OpenAPI文档,但是由于Function App托管在隔离层私有应用程序服务环境中,因此似乎无法正常工作。

任何人是否有其他选择将功能应用程序以编程方式导入APIM的想法?

更新:

[我已经查看了Github上的AlienCube Function Extensions库,它确实启用了Swagger API定义的发布,我可以在Import-AzApiManagementApi cmdlet中使用它,但如果可能的话,仍然需要Azure本机解决方案。

azure powershell azure-api-management azure-function-app
1个回答
0
投票

目前似乎不支持此功能,如对theis GitHub issue.的响应中所述

我已就此问题在内部与APIM团队联系 并收到没有后端端点的确认 目前可用于此操作(Portal与 前端有JavaScript,因此有22个调用)。

下一步,请考虑在 APIM的Azure UserVoice(如果存在,则升级) 小组审查其产品路线图的优先级。

可以通过Import-AzApiManagementApi注册新的API来实现这一点>

Import-AzApiManagementApi -Context $apiMgmtContext -SpecificationFormat OpenApiJson -SpecificationPath [PATH-TO-LOCAL-FILE]' -Path "api" -Protocol Https -ServiceUrl [PATH-TO-FUNCTION-APP-EDNPOINT] | Out-Null

或使用公开OpenAPI定义的URL

Import-AzApiManagementApi -Context $ApiMgmtContext -SpecificationFormat "OpenApi" -SpecificationUrl [URL-TO-OPENAPI-DEFINITION] -Path "api"

不是一个干净的实现,但它似乎可以工作。

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