我的模板是这样的:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"cosmosdbname": {
"type": "string"
},
"allowedIps": {
"type": "string"
},
"vnetName": {
"type": "string"
},
"subnetName": {
"type": "string"
}
},
"variables": {
"subnetIdA": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetName'))]",
"location": "[resourcegroup().location]"
},
"resources": [
{
"type": "Microsoft.DocumentDB/databaseAccounts",
"apiVersion": "2015-04-08",
"name": "[parameters('cosmosdbname')]",
"location": "[variables('location')]",
"kind": "GlobalDocumentDB",
"properties": {
"ipRangeFilter": "[parameters('allowedIps')]",
"enableAutomaticFailover": false,
"enableMultipleWriteLocations": false,
"isVirtualNetworkFilterEnabled": true,
"virtualNetworkRules": [
{
"id": "[variables('subnetIdA')]"
}
],
"databaseAccountOfferType": "Standard",
"consistencyPolicy": {
"defaultConsistencyLevel": "Session",
"maxIntervalInSeconds": 5,
"maxStalenessPrefix": 100
},
"locations": [
{
"locationName": "[variables('location')]",
"failoverPriority": 0
}
],
"capabilities": []
}
}
]
}
我从Azure导出并进行了一些修改。但是,我只是得到了“资源操作已完成,终端配置状态'失败'。”在尝试部署它时无法弄清楚模板有什么问题。
我完全从我的json中删除了virtualnetworkrules,现在它可以工作了。