我可以手动将 swagger Json 上传到 Azure API 管理,它按预期工作。但我需要通过 azure DevOps CICD 自动化此过程。
我需要从正在运行的 pod 下载或获取 swagger Json。然后我需要在Azure API管理中上传并更新它。
我对这个过程很陌生,任何人请告诉我相同的步骤/任务。
引用
https://learn.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
最佳答案
我们可以添加任务 PowerShell
或 azure PowerShell
以将 Swagger JSON 导入到 Azure API 管理。此步骤指的是 swagger 函数的托管函数应用 URL。您可以使用PowerShell命令Import-AzApiManagementApi 。以下是命令示例。
Import-AzApiManagementApi -Context $ApiMgmtContext -SpecificationFormat "Swagger" -SpecificationPath "C:\contoso\specifications\echoapi.swagger" -Path "apis"
我们也可以引用这个blog了解更多详情。
关于.net - 通过 Azure Devops Pipeline 将 Swagger JSON 导入到 Azure 现有 API 管理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66149652/