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.

2020-05-11 (first published: )

2,716 reads

Blogs

Daily Coping 30 Sep 2022

By

Today’s coping tip is to find a new way to use one of your...

Why You Need Presentation Skills

By

And no, the answer is not because you want to be a Microsoft MVP....

Daily Coping 29 Sep 2022

By

Today’s coping tip is to avoid saying “I should” and make time to do...

Read the latest Blogs

Forums

Save Query Results to Excel and Automatically run it

By anonymous

Hello,   I have a very simple query Select * from Employees where company...

TCP Provider: A connection attempt failed for target server

By SQL Galaxy

Hi. In source SQL Instance target linked server has been created and connection tested...

Get Part number and display in Header

By Siten0308

Hello, so I have a part number, and I want to display it in...

Visit the forum

Ask SSC Logo Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers