gpt4 book ai didi

azure - API管理ARM模板创建

转载 作者:行者123 更新时间:2023-12-03 02:59:44 25 4
gpt4 key购买 nike

我在 ARM 模板中定义了此资源,使用单个 API、单个操作,但是当我部署模板时,它不包含该 API。我错过了什么?

   {
"apiVersion": "2017-03-01",
"name": "[variables('am-apimanagement-service-name')]",
"type": "Microsoft.ApiManagement/service",
"location": "North Europe",
"tags": {},
"sku": {
"name": "[parameters('am-sku')]",
"capacity": "[parameters('am-skuCount')]"
},
"properties": {
"publisherEmail": "[parameters('am-publisher-email-p')]",
"publisherName": "[parameters('am-publisher-name-p')]",
"resources": [
{
"type": "Microsoft.ApiManagement/service/apis",
"apiVersion": "2017-03-01",
"name": "testapi",
"dependsOn": [
"[concat('Microsoft.ApiManagement/service',variables('am-apimanagement-service-name'))]"
],
"properties": {
"displayName": "TestApi",
"description": "",
"serviceUrl": "https://testdevsite.azurewebsites.net",
"path": "testpath",
"protocols": [
"https"
],
"authenticationSettings": null,
"subscriptionKeyParameterNames": null,
"isCurrent": true,
"apiVersion": null,
"resources": [
{
"apiVersion": "2017-03-01",
"type": "operations",
"name": "GetOperation",
"dependsOn": [
"[concat('Microsoft.ApiManagement/service/', variables('am-apimanagement-service-name'), '/apis/testapi')]"
],
"properties": {
"displayName": "GET",
"method": "GET",
"urlTemplate": "/resource",
"description": "Get"
}
}
]
}
}
]
}
}

它很好地创建了 API 管理资源,但它不包括我的 API。

我一定配置有问题,我只是看不到它。

基本上我想要的是一个调用位于同一资源组中的 Web API 的 API。

最佳答案

这里缺少的部分是我无法理解子资源被放置在属性下这个简单的事实。当这个问题被纠正后,一切都很好:

   {
"apiVersion": "2017-03-01",
"name": "[variables('am-apimanagement-service-name')]",
"type": "Microsoft.ApiManagement/service",
"location": "North Europe",
"sku": {
"name": "[parameters('am-sku')]",
"capacity": "[parameters('am-skuCount')]"
},
"properties": {
"publisherEmail": "[parameters('am-publisher-email-p')]",
"publisherName": "[parameters('am-publisher-name-p')]"
},
"resources": [
{
"type": "apis",
"apiVersion": "2017-03-01",
"name": "test",
"dependsOn": [
"[concat('Microsoft.ApiManagement/service/',variables('am-apimanagement-service-name'))]"
],
"properties": {
"displayName": "test",
"description": "",
"serviceUrl": "[concat('https://test-webapi-',parameters('environment'),'.azurewebsites.net')]",
"path": "test",
"protocols": [
"https"
],
"isCurrent": true
},
"resources": [
{
"apiVersion": "2017-03-01",
"type": "operations",
"name": "Get",
"dependsOn": [
"[concat('Microsoft.ApiManagement/service/', variables('am-apimanagement-service-name'), '/apis/test')]"
],
"properties": {
"displayName": "GET",
"method": "GET",
"urlTemplate": "/api/sites",
"description": "Get"
}
}
]

}
]
}

关于azure - API管理ARM模板创建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50152209/

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