如何在 Powershell 中表示 DocumentClient 的实例化

How to represent instantiation of DocumentClient in Powershell

很难弄清楚如何在 powershell 中执行与以下几行相同的操作:

(在命名空间 Microsoft.Azure.Documents 中)

DocumentClient client = new DocumentClient(new Uri("endpoint"), "authKey")

数据库database = client.CreateDatabaseQuery().Where(d => d.Id == "collectionName").AsEnumerable().FirstOrDefault()

有人能帮忙吗? 发送

看这里:https://alexandrebrisebois.wordpress.com/2014/08/23/using-powershell-to-seed-azure-documentdb-from-blob-storage/

它向您展示了如何在原始 REST 请求中使用 authKey 端点 uri。

另外,在此处研究 DocumentDB 的 REST API:https://msdn.microsoft.com/en-us/library/azure/dn781481.aspx?f=255&MSPPError=-2147217396

它将允许您查找如何按照 Alexandre 的示例进行更多操作。

还有这个 powershell commandlet DLL 可以简化许多操作:https://github.com/savjani/Azure-DocumentDB-Powershell-Cmdlets