在“CosmosDB”模块中找到了“New-CosmosDbDocument”命令,但无法加载该模块。有关更多信息,请运行“Import-Module CosmosDB” [英] The 'New-CosmosDbDocument' command was found in the module 'CosmosDB', but the module could not be loaded. For more information, run 'Import-Module CosmosDB'

查看:399
本文介绍了在“CosmosDB”模块中找到了“New-CosmosDbDocument”命令,但无法加载该模块。有关更多信息,请运行“Import-Module CosmosDB”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我正在尝试使用PowerShell在cosmosdb中创建文档。这是代码

I am trying to create document in cosmosdb using PowerShell. Here is the code

Import-Module CosmosDB





$ Guid = $([Guid] :: NewGuid()。ToString())



$ document = @"

{

#data

Import-Module CosmosDB


$Guid = $([Guid]::NewGuid().ToString())

$document = @"
{
#data

}¥b $ b" @





$ cosmosDbContext = New-CosmosDbContext -Account $ CosmosDbAccountName -Database $ DatabaseName -ResourceGroup $ ResourceGroupName    

}
"@


$cosmosDbContext = New-CosmosDbContext -Account $CosmosDbAccountName -Database $DatabaseName -ResourceGroup $ResourceGroupName    

New-CosmosDbDocument -Context $ cosmosDbContext -CollectionId $ CollectionId -DocumentBody $ document -PartitionKey" $ Guid"

New-CosmosDbDocument -Context $cosmosDbContext -CollectionId $CollectionId -DocumentBody $document -PartitionKey "$Guid"

我遇到了这个错误。该命令正在  Linux上的PSCore

I am running into this error. The command is being run on PSCore on Linux

New-CosmosDbDocument:'New-CosmosDbDocument'命令在模块'CosmosDB',但无法加载模块。有关更多信息,请运行'Import-Module CosmosDB'

请帮帮我

谢谢

推荐答案

您好anonymous12348,

Hello anonymous12348,

您能否查看已安装的CosmosDB模块的版本?

Could you please check the version of the CosmosDB module installed ?

请在PSCore shell中运行以下命令得到版本。

Please run the below commands in PSCore shell to get the version.

导入模块CosmosDB

Get-Module -Name CosmosDB

Import-Module CosmosDB
Get-Module -Name CosmosDB

输出应类似于以下

ModuleType版本   名称                                导出的命令

---------- -------    ----                                 ----------------
$
脚本     3.1.0.293  CosmosDB

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     3.1.0.293  CosmosDB

如果您没有使用最新版本,请运行以下命令更新到最新模块

If you are not on the latest version, please update to the latest module by running the below command

更新模块CosmosDb

如果有助于解决问题,请与我们联系。

Please let me know if that helps fix the issue.


这篇关于在“CosmosDB”模块中找到了“New-CosmosDbDocument”命令,但无法加载该模块。有关更多信息,请运行“Import-Module CosmosDB”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆