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

标签 .net azure azure-devops swagger azure-api-management

我可以手动将 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

最佳答案

我们可以添加任务 PowerShellazure 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/

相关文章:

c# - 如何在没有 Process 类的情况下在 Windows 8 文件资源管理器中打开应用程序文件夹?

c# - 从并行运行的每个任务中获取完成通知

azure - nuget 命令在 azure devops 中 IncludeReferencedProjects

typescript - Angular2 在 Visual Studio Team Services 中构建(原为 Visual Studio Online)

c# - 运行时自定义属性泛型

c# - 通过使用 "object"文件并稍后合并来加快 C# 编译速度?

database - 跟踪 S0 Azure SQL 数据库资源使用情况的单位有哪些?

Azure SDK for .NET (VS2013) 2.5 需要 Visual Studio 2013 更新 3 或更高版本

c# - 如何在 C# 中重现 powershell > az login 的结果?

azure - 让 Azure DevOps 审查 GitHub 拉取请求