通过Powershell在CosmosDb中创建集合

时间:2018-02-05 10:01:11

标签: powershell azure azure-cosmosdb

有没有办法通过Azure模板或Powershell创建cosmosDb集合?

到目前为止我所拥有的只是Azure CLI的示例,但这些不符合我的要求。

我还想避免Rest Calls,因为与可能的Powershell解决方案相比,这会产生很多开销。

3 个答案:

答案 0 :(得分:4)

根据提供的信息here,您只能使用PowerShell执行与帐户相关的操作。截至目前,无法使用PowerShell管理帐户内的数据。

  

下表包含Azure PowerShell脚本示例的链接   对于Azure Cosmos DB。目前,您只能管理Azure Cosmos   通过PowerShell进行DB accountlayer; 其他资源,如数据库和   无法通过PowerShell 管理集合。

同时查看Azure反馈网站here,它仍然是无计划的,但有人已经在Github上启动了一个项目。请在这里查看该项目:https://github.com/secabstraction/PoshDocs

答案 1 :(得分:3)

您可以使用PowerShell Gallery上提供的Cosmos DB PowerShell模块。您可以在GitHub in the project repository上找到有关如何使用它的文档和示例。

答案 2 :(得分:0)

您可以尝试从powershell调用REST API来实现目标SEE REST API Dcumentation here