How to add external jar to spark in HDInsight?
You can add extra dependencies starting you spark-shell with:
spark-shell --packages maven-coordinates of the package
In you case:
spark-shell --packages com.microsoft.azure:azure-cosmosdb-spark_2.1.0_2.11:jar:1.1.2
A good practice is to package your app with all its dependencies:
This should work on livy as well.