My question is, Is there any other way I can add data from json file to cosmos DB through devops like powershell/api?
The answer is yes.
We could try to use the Azure powershell task to execute the following powershell scripts:
param([string]$cosmosDbName
,[string]$resourceGroup
,[string]$databaseName
,[string[]]$collectionNames
,[string]$principalUser
,[string]$principalPassword
,[string]$principalTennant)
Write-Output "Loggin in with Service Principal $servicePrincipal"
az login --service-principal -u $principalUser -p $principalPassword -t $principalTennant
Write-Output "Check if database exists: $databaseName"
if ((az cosmosdb database exists -d $databaseName -n $cosmosDbName -g $resourceGroup) -ne "true")
{
Write-Output "Creating database: $databaseName"
az cosmosdb database create -d $databaseName -n $cosmosDbName -g $resourceGroup
}
foreach ($collectionName in $collectionNames)
{
Write-Output "Check if collection exists: $collectionName"
if ((az cosmosdb collection exists -c $collectionName -d $databaseName -n $cosmosDbName -g $resourceGroup) -ne "true")
{
Write-Output "Creating collection: $collectionName"
az cosmosdb collection create -c $collectionName -d $databaseName -n $cosmosDbName -g $resourceGroup
}
}
Write-Output "List Collections"
az cosmosdb collection list -d $databaseName -n $cosmosDbName -g $resourceGroup
Then press the three dots after Script Arguments and add the parameters defined in the PowerShell script (put all parameters in Variables):

You could check this great document for some more details.