PowerShell Module for working with Azure Cosmos DB databases, collections, documents, attachments, offers, users, permissions, triggers, stored procedures and user defined functions.
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
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:
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
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