Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New-CosmosDbDocument - PowerShell is returning error "Cannot convert 'System.Collections.ArrayList' to the type 'System.String' required by parameter 'Message'. Specified method is not supported." #468

Open
takis-kapas opened this issue Feb 9, 2023 · 0 comments

Comments

@takis-kapas
Copy link

Issue

I am getting the CosmosDB noSQL context using a Service Principal that has the "Contributor" role in the CosmosDB account.
I am building a JSON document, based on your instruction in the "New-CosmosDbDocument" module
When I am trying to execute the command "New-CosmosDbDocument -Context $cosmosDbContext -CollectionId $collectionName -DocumentBody $document" I am getting the following error from PowerShell:

$document = @"
{
"id": "$([Guid]::NewGuid().ToString())",
"content": "Some string",
"more": "Some other string"
}
"@

New-CosmosDbDocument -Context $cosmosDbContext -CollectionId $collectionName -DocumentBody $document

Write-Error : Cannot convert 'System.Collections.ArrayList' to the type 'System.String' required by parameter 'Message'. Specified method is not supported.
At line:4 char:17
Write-Error $Error
CategoryInfo : InvalidArgument: (:) [Write-Error], ParameterBindingException
FullyQualifiedErrorId : CannotConvertArgument,Microsoft.PowerShell.Commands.WriteErrorCommand

System Information

  • PS Version: 5.1.19041.2364
  • Client: PowerShell ISE, VS Code
  • OS: Windows 10
  • Module Version: CosmosDB 4.7.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant