我在我的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。
答案 0 :(得分:1)
这里缺少的部分是我无法解决将子资源放在属性下的简单事实。当这一点得到纠正后,一切都很好:
{
"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"
}
}
]
}
]
}