通过- Azure Devops Pipeline将Swagger JSON导入Azure现有API管理



我可以手动将swagger Json上传到Azure API管理,它按预期工作。但是我需要通过azure DevOps CICD自动化这个过程。

我需要下载或从运行pod获取swagger Json。然后我需要在Azure API管理中上传和更新它。

我对这个过程很陌生,谁能告诉我步骤/任务吗?

参考

https://learn.microsoft.com/en-us/azure/api-management/import-and-publish

如何在Azure API Management中导入swagger

https://marketplace.visualstudio.com/items?itemName=stephane-eyskens.apim

https://github.com/Azure/azure-api-management-devops-resource-kit

我们可以添加任务PowerShellazure PowerShell导入Swagger JSON到Azure API管理。这一步指的是swagger函数的宿主函数app URL。可以使用PowerShell命令Import-AzApiManagementApi。下面是命令的示例:

Import-AzApiManagementApi -Context $ApiMgmtContext -SpecificationFormat "Swagger" -SpecificationPath "C:contosospecificationsechoapi.swagger" -Path "apis"

我们也可以参考这个博客了解更多细节。

相关内容

最新更新