通过 Azure Devops 管道将 Swagger JSON 导入到 Azure 现有 API 管理

Import Swagger JSON to Azure existing API Management via - Azure Devops Pipeline

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

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

我对这个过程很陌生,任何人都请告诉我steps/tasks。

参考

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

how to import swagger in Azure API Management

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函数的托管函数appURL。您可以使用 PowerShell 命令 Import-AzApiManagementApi。以下是命令示例。

Import-AzApiManagementApi -Context $ApiMgmtContext -SpecificationFormat "Swagger" -SpecificationPath "C:\contoso\specifications\echoapi.swagger" -Path "apis"

我们也可以参考这篇blog了解更多详情。