Dnirmania


Technical Article

Powershell Script - Azure cosmos DB(SQL API)

Scripts contains 4 following functions. Users can create 3 different script from this for inserting, fetching and deleting a document.
1. Function Generate-MasterKeyAuthorizationSignature - This function is used to create connection to Azure cosmos DB. This function codes were taken from Technet.
2. Function Post-CosmosDb - Insert single document in azure cosmos DB. Same function can be used to perform bulkinsert. This function code was taken from following article. To make it useful i made some modification in it.
(https://www.systemcenterautomation.com/2018/06/cosmos-db-rest-api-powershell/)
3. Function Get-CosmosDocument - Fetch single document from azure cosmos DB. Same function can be used to fetch all documents from Cosmos DB.
4. Function Delete-CosmosDbDocument - Delete single document from cosmos DB. Same function can be used to delete more than one document with some additional codes.

To use any of the function like Post,Get, Delete. you have to comment the other 2 function call. If you are using all 3 functions(Post,Get, Delete), Be cautious while using them.

You rated this post out of 5. Change rating

2020-05-11 (first published: )

3,476 reads

Blogs

A New Word: Proluctance

By

proluctance – n. the paradoxical urge to avoid doing something you’ve been looking forward...

Know Thy Platform

By

IT and data professionals, I implore you – know thy platform. All of it....

Adding Git LFS Support – #SQLNewBlogger

By

I got this message recently while committing some changes: This post shows my work...

Read the latest Blogs

Forums

import json file

By smattiko83

Any idea on how to import a json file into sql server? I've never...

Downside to running a query in parallel

By water490

I am a SS rookie.  To me it seems like running a query in...

What Every DBA Should Know about Always On Readable Secondaries

By SQLSACT

Comments posted to this topic are about the item What Every DBA Should Know...

Visit the forum

Question of the Day

Filestream on Linux

I want to implement a Filestream table on SQL Server 2022 running on Linux. Can I do this?

See possible answers