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: )

3,054 reads

Blogs

Using SQL Alerts to Spot Suspicious Activity in SQL

By

SQL doesn’t really give us too many tools out of the box to allow...

How to Change the Browser Used by SSMS for AAD Auth

By

Did you know that you can change the browser used by SQL Server Management...

Typing with Your Tongue Part 2: Voice Access

By

A few months ago, I wrote a post on how I use voice technology...

Read the latest Blogs

Forums

DC migration SQL DB suggestion

By Raja mssql

Hi All, Our server team is planning to move  secondary data centre from one...

SSDT import into a table from .csv corruption

By atzvei

Hello everyone, I am importing from a csv file into a table. Everything works...

Login failures while connecting from Linux to SQL on windows

By ramana3327

Hi all, The app server is running on Linux. SQL server is running on...

Visit the forum

Ask SSC Logo Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers