为什么设置CosmosDBthroughputSettings会导致“系统中不存在具有指定ID的实体”?

亚历山大·法伯

尝试部署具有2个集合(“ MyCollection1”,“ MyCollection2”)的CosmosDB实例时,我不断收到错误消息:

NotFound:系统中不存在具有指定ID的实体

因此,我继续在自定义ARM模板中搜索“ resourceId”(请参见下文),但找不到erorr原因。

我不明白,为什么管道至少不为我打印行号?

管道截图

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "accountName": {
            "defaultValue": "my-cosmosdb",
            "type": "String"
        }
    },
    "variables": {
        "resourceName": "[concat(resourceGroup().name, '-', parameters('accountName'))]",
        "resourceId": "[resourceId('Microsoft.DocumentDB/databaseAccounts', variables('resourceName'))]",
        "apiVersion": "[providers('Microsoft.DocumentDB', 'databaseAccounts').apiVersions[0]]"
    },
    "outputs": {
        "CosmosDbConnectionString": {
            "type": "string",
            "value": "[concat('AccountEndpoint=https://', variables('resourceName'), '.documents.azure.com:443/;AccountKey=', listKeys(variables('resourceId'), variables('apiVersion')).primaryMasterKey, ';')]"
        },
        "DatabaseName": {
            "type": "string",
            "value": "MyDB"
        },
        "CollectionName1": {
            "type": "string",
            "value": "MyCollection1"
        },
        "CollectionName2": {
            "type": "string",
            "value": "MyCollection2"
        }
    },
    "resources": [
        {
            "type": "Microsoft.DocumentDB/databaseAccounts",
            "apiVersion": "2020-03-01",
            "name": "[variables('resourceName')]",
            "location": "[resourceGroup().location]",
            "tags": {
                "defaultExperience": "DocumentDB"
            },
            "kind": "GlobalDocumentDB",
            "properties": {
                "publicNetworkAccess": "Enabled",
                "enableAutomaticFailover": false,
                "enableMultipleWriteLocations": false,
                "isVirtualNetworkFilterEnabled": false,
                "virtualNetworkRules": [],
                "disableKeyBasedMetadataWriteAccess": false,
                "databaseAccountOfferType": "Standard",
                "consistencyPolicy": {
                    "defaultConsistencyLevel": "Session",
                    "maxIntervalInSeconds": 5,
                    "maxStalenessPrefix": 100
                },
                "locations": [
                    {
                        "locationName": "[resourceGroup().location]",
                        "provisioningState": "Succeeded",
                        "failoverPriority": 0,
                        "isZoneRedundant": false
                    }
                ],
                "capabilities": []
            }
        },
        {
            "type": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases",
            "apiVersion": "2020-03-01",
            "name": "[concat(variables('resourceName'), '/MyDB')]",
            "dependsOn": [
                "[resourceId('Microsoft.DocumentDB/databaseAccounts', variables('resourceName'))]"
            ],
            "properties": {
                "resource": {
                    "id": "MyDB"
                },
                "options": {}
            }
        },
        {
            "type": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers",
            "apiVersion": "2020-03-01",
            "name": "[concat(variables('resourceName'), '/MyDB/MyCollection1')]",
            "dependsOn": [
                "[resourceId('Microsoft.DocumentDB/databaseAccounts/sqlDatabases', variables('resourceName'), 'MyDB')]",
                "[resourceId('Microsoft.DocumentDB/databaseAccounts', variables('resourceName'))]"
            ],
            "properties": {
                "resource": {
                    "id": "MyCollection1",
                    "indexingPolicy": {
                        "indexingMode": "consistent",
                        "automatic": true,
                        "includedPaths": [
                            {
                                "path": "/*"
                            }
                        ],
                        "excludedPaths": [
                            {
                                "path": "/\"_etag\"/?"
                            }
                        ]
                    },
                    "partitionKey": {
                        "paths": [
                            "/partitionKey"
                        ],
                        "kind": "Hash"
                    },
                    "uniqueKeyPolicy": {
                        "uniqueKeys": []
                    },
                    "conflictResolutionPolicy": {
                        "mode": "LastWriterWins",
                        "conflictResolutionPath": "/_ts"
                    }
                },
                "options": {}
            }
        },
        {
            "type": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers",
            "apiVersion": "2020-03-01",
            "name": "[concat(variables('resourceName'), '/MyDB/MyCollection2')]",
            "dependsOn": [
                "[resourceId('Microsoft.DocumentDB/databaseAccounts/sqlDatabases', variables('resourceName'), 'MyDB')]",
                "[resourceId('Microsoft.DocumentDB/databaseAccounts', variables('resourceName'))]"
            ],
            "properties": {
                "resource": {
                    "id": "MyCollection2",
                    "indexingPolicy": {
                        "indexingMode": "consistent",
                        "automatic": true,
                        "includedPaths": [
                            {
                                "path": "/*"
                            }
                        ],
                        "excludedPaths": [
                            {
                                "path": "/\"_etag\"/?"
                            }
                        ]
                    },
                    "partitionKey": {
                        "paths": [
                            "/partitionKey"
                        ],
                        "kind": "Hash"
                    },
                    "uniqueKeyPolicy": {
                        "uniqueKeys": []
                    },
                    "conflictResolutionPolicy": {
                        "mode": "LastWriterWins",
                        "conflictResolutionPath": "/_ts"
                    }
                },
                "options": {}
            }
        },
        {
            "type": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/throughputSettings",
            "apiVersion": "2020-03-01",
            "name": "[concat(variables('resourceName'), '/MyDB/default')]",
            "dependsOn": [
                "[resourceId('Microsoft.DocumentDB/databaseAccounts/sqlDatabases', variables('resourceName'), 'MyDB')]",
                "[resourceId('Microsoft.DocumentDB/databaseAccounts', variables('resourceName'))]"
            ],
            "properties": {
                "resource": {
                    "throughput": 400
                }
            }
        }
    ]
}

更新:

我已经删除了创建集合的部分,并且错误仍然存​​在。

更新2:

以下部分看似引起错误,但是为什么呢?

{
    "type": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/throughputSettings",
    "apiVersion": "2020-03-01",
    "name": "[concat(variables('resourceName'), '/MyDB/default')]",
    "dependsOn": [
        "[resourceId('Microsoft.DocumentDB/databaseAccounts/sqlDatabases', variables('resourceName'), 'MyDB')]",
        "[resourceId('Microsoft.DocumentDB/databaseAccounts', variables('resourceName'))]"
    ],
    "properties": {
        "resource": {
            "throughput": 400
        }
    }
}

什么是错的dependsOn进入"[resourceId('Microsoft.DocumentDB/databaseAccounts/sqlDatabases', variables('resourceName'), 'MyDB')]

更新3:

尝试手动部署上面列出的完整ARM模板会导致:

屏幕截图吞吐量错误

屏幕截图错误

亚历山大·法伯

以下对我有用,我不得不用“ sqlDatabases / containers / throughputSettings”替换“ sqlDatabases / throughputSettings”:

{
    "type": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/throughputSettings",
    "apiVersion": "2020-03-01",
    "name": "[concat(variables('resourceName'), '/', variables('DatabaseName'), '/', variables('CollectionName1'), '/default')]",
    "dependsOn": [
        "[resourceId('Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers', variables('resourceName'), variables('databaseName'), variables('CollectionName1'))]",
        "[resourceId('Microsoft.DocumentDB/databaseAccounts/sqlDatabases', variables('resourceName'), variables('databaseName'))]",
        "[resourceId('Microsoft.DocumentDB/databaseAccounts', variables('resourceName'))]"
    ],
    "properties": {
        "resource": {
            "throughput": 400
        }
    }
}

然后是CollectionName2的类似条目

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

为什么保存数据会导致不存在的字段“ ERROR_CODE”的值无效?

来自分类Dev

具有可能存在或不存在的列的实体框架

来自分类Dev

为什么在源脚本中,“ exec不存在的文件”会退出外壳?

来自分类Dev

为什么在Amazon SDK中请求不存在的文件的预签名URL会返回URL?

来自分类Dev

JPA实体不具有表中的列,但基于实体中不存在的列进行查询

来自分类Dev

为什么IOrganizationService.Update()返回“ Microsoft Dynamics CRM中不存在指定的记录类型”?

来自分类Dev

.NET Core 3 EF中不存在没有联合实体的MN关系,也没有关于为什么的文档

来自分类Dev

如何纠正实体ID不存在?

来自分类Dev

为什么现有文件不存在?

来自分类Dev

为什么C ++中不存在引用成员的功能?

来自分类Dev

为什么C#中不存在吊装?

来自分类Dev

为什么[分支“开发”]在.git / config中不存在?

来自分类Dev

为什么JavaScript中不存在clientRight或clientBottom?

来自分类Dev

为什么C ++中不存在引用成员的功能?

来自分类Dev

为什么systemd等待`fstab`中不存在的磁盘?

来自分类Dev

为什么在输出路径中不存在dll

来自分类Dev

为什么脚本中不存在Camera?

来自分类Dev

为什么POST请求中不存在该属性?

来自分类Dev

为什么我在Spring Data JPA本机SQL查询中获得此异常?IllegalArgumentException:具有该位置[2]的参数不存在

来自分类Dev

为什么已安装的操作系统存在挂起问题,但其 Live Disk 不存在?

来自分类Dev

为什么对于具有非恒定值的数组定义不存在编译错误?

来自分类Dev

为什么在Web api中返回具有一对多关系的实体会导致错误?

来自分类Dev

在 ES6 模块中扩展对象原型会导致“对象”类型不存在属性

来自分类Dev

为什么实体框架试图查找这些不存在的列?

来自分类Dev

为什么实体框架试图查找这些不存在的列?

来自分类Dev

为什么CopyOnWriteLinkedList不存在?

来自分类Dev

为什么XMLHttpRequest responseText不存在?

来自分类Dev

为什么WKWebView委托不存在?

来自分类Dev

为什么此PhantomJS进程导致“目录<x>不存在”。错误?

Related 相关文章

  1. 1

    为什么保存数据会导致不存在的字段“ ERROR_CODE”的值无效?

  2. 2

    具有可能存在或不存在的列的实体框架

  3. 3

    为什么在源脚本中,“ exec不存在的文件”会退出外壳?

  4. 4

    为什么在Amazon SDK中请求不存在的文件的预签名URL会返回URL?

  5. 5

    JPA实体不具有表中的列,但基于实体中不存在的列进行查询

  6. 6

    为什么IOrganizationService.Update()返回“ Microsoft Dynamics CRM中不存在指定的记录类型”?

  7. 7

    .NET Core 3 EF中不存在没有联合实体的MN关系,也没有关于为什么的文档

  8. 8

    如何纠正实体ID不存在?

  9. 9

    为什么现有文件不存在?

  10. 10

    为什么C ++中不存在引用成员的功能?

  11. 11

    为什么C#中不存在吊装?

  12. 12

    为什么[分支“开发”]在.git / config中不存在?

  13. 13

    为什么JavaScript中不存在clientRight或clientBottom?

  14. 14

    为什么C ++中不存在引用成员的功能?

  15. 15

    为什么systemd等待`fstab`中不存在的磁盘?

  16. 16

    为什么在输出路径中不存在dll

  17. 17

    为什么脚本中不存在Camera?

  18. 18

    为什么POST请求中不存在该属性?

  19. 19

    为什么我在Spring Data JPA本机SQL查询中获得此异常?IllegalArgumentException:具有该位置[2]的参数不存在

  20. 20

    为什么已安装的操作系统存在挂起问题,但其 Live Disk 不存在?

  21. 21

    为什么对于具有非恒定值的数组定义不存在编译错误?

  22. 22

    为什么在Web api中返回具有一对多关系的实体会导致错误?

  23. 23

    在 ES6 模块中扩展对象原型会导致“对象”类型不存在属性

  24. 24

    为什么实体框架试图查找这些不存在的列?

  25. 25

    为什么实体框架试图查找这些不存在的列?

  26. 26

    为什么CopyOnWriteLinkedList不存在?

  27. 27

    为什么XMLHttpRequest responseText不存在?

  28. 28

    为什么WKWebView委托不存在?

  29. 29

    为什么此PhantomJS进程导致“目录<x>不存在”。错误?

热门标签

归档