Project to backup CosmosDB to file and restore to another CosmosDB Server.
-
Clone this repo
-
Create venv and active
python3 -m venv env
source env/bin/activate- install dependencys
pip install -r requirements.txt- Use
RES_GROUP=<resource-group-name>
ACCT_NAME=<cosmos-db-account-name>
export ACCOUNT_URI=$(az cosmosdb show --resource-group $RES_GROUP --name $ACCT_NAME --query documentEndpoint --output tsv)
export ACCOUNT_KEY=$(az cosmosdb list-keys --resource-group $RES_GROUP --name $ACCT_NAME --query primaryMasterKey --output tsv)python3 -m main backup --container $COSMOSDB_CONTAINER --database $COSMOSDB_DB --host $ACCOUNT_URI --key ACCOUNT_KEYpython3 -m main restore --container $COSMOSDB_CONTAINER --database $COSMOSDB_DB --host $COSMOSDB_URI --key $COSMOSDB_KEYIf Container or database not exist, they will be created in restore process
- More easy cli
- Install instructions