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,543 reads

Blogs

I like KQL and I like managing my test data – are they mates?

By

Test Data Management (TDM) is essential in software development to ensure your application runs...

Reading JSON Data with Python

By

Recently I’ve been looking at archiving some data at SQL Saturday. As a start,...

5 Advanced Online SQL DBA Training Courses to Learn in 2024 and Beyond

By

Buckle up, database wranglers! Nowadays, SQL DBAs hold the keys to a company's most...

Read the latest Blogs

Forums

Subscription to Oracle DB not working after upgrading subscriber to Oracle 19c

By rpalani65sql

Hi Replication and publisher configured on the same sql server 2022 version. Subscription to...

Script to Merger duplicate indexes

By EM2

Hello, I am trying to firgure out how to merge duplicate indexes using a...

using Openrowset to access delta files in ADLG2

By river1

Dears, I was told that I cannot access delta files in SQL Server Managed...

Visit the forum