gpt4 book ai didi

api - 如何使用 Azure 资源管理器在 Azure API 管理中对 API 进行版本控制

转载 作者:行者123 更新时间:2023-12-05 05:17:50 25 4
gpt4 key购买 nike

使用门户在 Azure API 管理服务中创建新 API 时,可以指定是否希望对 API 进行版本控制。但是,在使用 ARM 在管理服务中创建 API 时,我找不到复制此内容的方法。目前不支持此功能,还是我遗漏了某些内容?

我尝试在门户中创建版本化 API,并将创建的模板与非版本化 API 的模板进行比较,但看不到差异。

提前致谢。

最佳答案

要通过 ARM 脚本实现此目的,您需要首先创建 ApiVersionSet 资源:

{
"name": "[concat(variables('ManagementServiceName'), '/', variables('VersionSetName'))]",
"type": "Microsoft.ApiManagement/service/api-version-sets",
"apiVersion": "2017-03-01",
"properties": {
"description": "Api Description",
"displayName": "Api Name",
"versioningScheme": "Segment"
}
}

然后更新 Microsoft.ApiManagement/service/apis 资源上的 apiVersionSetId 属性:

{
"type": "Microsoft.ApiManagement/service/apis",
"name": "[concat(variables('ManagementServiceName'), '/', variables('ApiName'))]",
"apiVersion": "2017-03-01",
"dependsOn": [
"[resourceId('Microsoft.ApiManagement/service/api-version-sets', variables('ManagementServiceName'), variables('VersionSetName'))]"
],
"properties": {
"displayName": "string",
"apiRevision": "1",
"description": "",
"serviceUrl": "string",
"path": "string",
"protocols": [
"https"
],
"isCurrent": true,
"apiVersion": "v1",
"apiVersionName": "v1",
"apiVersionDescription": "string",
"apiVersionSetId": "[concat('/api-version-sets', variables('VersionSetName'))]"
}
}

关于api - 如何使用 Azure 资源管理器在 Azure API 管理中对 API 进行版本控制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48663522/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com