CosmosDB Table API - 此 API 不支持 CORS 规则

CosmosDB Table API - CORS rules are not supported for this API

我们的订阅中有一些 Azure Table 存储 table,由于性能原因,我们想将它们迁移到 CosmosDB table API。为此,我开始通过选择 Table API 创建 cosmos db 帐户,但我的部署失败并出现以下错误。当我尝试使用 SQL API 时,它起作用了。

{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. "详情":[{"code":"BadRequest","message":"{\r\n \"code\": \"BadRequest\",\r\n \"message\": \"CORS 规则不支持此 API\rMicrosoft.Azure.Documents.Common/2.1.0.0\"\r\n}"}]}

有人可以告诉我这可能是什么原因吗?

@AngiSen,可能与 Azure Cosmos DB 资源提供程序 (Microsoft.DocumentDb/databaseAccounts) 的最新(重大)更新有关,正如我今天(2018 年 11 月 28 日)刚刚注意到的那样,之前 运行 Cosmos DB Table API 的部署(截至 2018 年 11 月 23 日)现在失败并出现同样的错误:

9:16:23 AM - Resource Microsoft.DocumentDb/databaseAccounts 'xxx-xxx-xxx' failed with message '{ "code": "BadRequest", "message": "CORS rules are not supported for this API\r\nActivityId: xxx, Microsoft.Azure.Documents.Common/2.1.0.0" }'

在我的例子中,我使用 2015-04-08 版本 Table API 但我没有明确配置 CORS 部分和反正资源提供者中没有这样的配置选项。

使用 https://resources.azure.com 深入研究现有的 Cosmos DB 实例表明确实有一个 CORS 成员是定义的一部分:

{ "id": "/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.DocumentDB/databaseAccounts/xxx", "name": "xxx", "location": "North Europe", "type": "Microsoft.DocumentDB/databaseAccounts", "kind": "GlobalDocumentDB", "tags": {}, "properties": { "provisioningState": "Succeeded", "documentEndpoint": "https://xxx.documents.azure.com:443/", "tableEndpoint": "https://xxx.table.cosmosdb.azure.com:443/", "ipRangeFilter": "", "enableAutomaticFailover": false, "enableMultipleWriteLocations": false, "isVirtualNetworkFilterEnabled": false, "virtualNetworkRules": [], "EnabledApiTypes": "Table, Sql", "databaseAccountOfferType": "Standard", "consistencyPolicy": { "defaultConsistencyLevel": "BoundedStaleness", "maxIntervalInSeconds": 86400, "maxStalenessPrefix": 1000000 }, "configurationOverrides": {}, "writeLocations": [ { "id": "xxx-northeurope", "locationName": "North Europe", "documentEndpoint": "https://xxx-northeurope.documents.azure.com:443/", "provisioningState": "Succeeded", "failoverPriority": 0 } ], "readLocations": [ { "id": "xxx-northeurope", "locationName": "North Europe", "documentEndpoint": "https://xxx-northeurope.documents.azure.com:443/", "provisioningState": "Succeeded", "failoverPriority": 0 } ], "locations": [ { "id": "xxx-northeurope", "locationName": "North Europe", "documentEndpoint": "https://xxx-northeurope.documents.azure.com:443/", "provisioningState": "Succeeded", "failoverPriority": 0 } ], "failoverPolicies": [ { "id": "xxx-northeurope", "locationName": "North Europe", "failoverPriority": 0 } ], "cors": [], "capabilities": [ { "name": "EnableTable" } ] } }

如果它确实是一个重大变化,希望它能尽快得到修复...

想在这里发表正式声明。我已经与 Cosmos DB 团队谈过,他们已经准备好修复程序,应该会在今晚部署。如果您有任何问题,请告诉我。感谢您发布问题。