2017-06-01 64 views
-1

我试图通过提供ARM下列API管理,用下面的模板(注意具体的2016年7月7日的apiVersion日期)。这将导致错误:Azure的API管理ARM模板:skuproperties不能为空

Invalid parameter: Value cannot be null.\r\nParameter name: skuproperties

{ 
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", 
"contentVersion": "1.0.0.0", 
"parameters": { 
    "apimSettings": { 
     "type": "object", 
     "defaultValue": { 
      "sku": "Developer", 
      "skuCount": "1", 
      "publisherName": "", 
      "publisherEmail": "" 
     } 
    } 
}, 
"variables": { 
    "apiManagementServiceName": "[concat('apim', uniqueString(resourceGroup().id))]" 
}, 
"resources": [{ 
    "apiVersion": "2016-07-07", 
    "name": "[variables('apiManagementServiceName')]", 
    "type": "Microsoft.ApiManagement/service", 
    "location": "[resourceGroup().location]", 
    "properties": { 
     "sku": { 
      "name": "[parameters('apimSettings').sku]", 
      "capacity": "[parameters('apimSettings').skuCount]" 
     }, 
     "publisherEmail": "[parameters('apimSettings').publisherEmail]", 
     "publisherName": "[parameters('apimSettings').publisherName]" 
    } 
}], 
"outputs": { 
    "apimUri" : { 
     "type": "object", 
     "value": "[reference(variables('apiManagementServiceName'))]" 
    } 
} 

}

schema for that version of API Management没有显示 'skuProperties'。请注意,如果我使用旧版本2014-02-14,则部署工作。我还注意到deployment template schema引用了较新的API管理模式。

显然,要“skuproperties”但我怎么会知道提供什么呢?

回答

0

这是你如何使用它:

{ 
     "type": "Microsoft.ApiManagement/service", 
     "sku": { 
      "name": "Developer", 
      "capacity": 1 
     }, 
     "name": "[parameters('name')]", 
     "apiVersion": "2016-10-10", 
     "location": "[parameters('location')]", 
     "properties": { 
      "publisherEmail": "[parameters('adminEmail')]", 
      "publisherName": "[parameters('orgName')]" 
     } 
    } 

这是description of the API Management API model。正如你可以看到它使用2016-10-10和对象类似于我所描述的。这就是为什么它的工作方式。

+0

是的,这确实可行,但问题是关于2016年7月7日版本里面,大概有许多额外的功能。试着用apiVersion来运行上面的代码。 –

+0

也,http://schema.management.azure.com/schemas/2016-10-10/Microsoft.ApiManagement.json是404;那为什么apiVersion有效? –

+0

我不是微软员工,我不熟悉,他们有后端代码\逻辑。我已经告诉过你它是如何完成的,我不知道为什么这样做。不要使用2017-07-07 api版本,就是这样。 – 4c74356b41