Below are the configuration values you need to specify for the backup application.
The following settings are standard Azure Functions v2 configuration settings.
AzureWebJobsStorage
FUNCTIONS_EXTENSION_VERSION
FUNCTIONS_WORKER_RUNTIME
The settings below are to configure the backup application.
-
CosmosBackup:FullBackupSchedule
: A CRON expression that specifies when to trigger a full backup. To run the backup every day at 3 AM, use the schedule0 0 3 */1 * *
. -
CosmosBackup:BackupStorage
: The storage account (connection string to it) to use for storage. If not specified, the storage account inAzureWebJobsStorage
is used. -
CosmosBackup:ContainerName
: The name of the container where to store the backups. If not specified, the defaultcosmos-backup
is used. -
CosmosBackup:DefaultConnectionString
: The default connection string to the Cosmos DB account to back up. If not specified, then the connection string must be specified for each account specified in theCosmosBackup:Accounts
array described below.
The following settings are added for each database and / or collection you want to include in the backup. If none are specified, then all databases and all collections found by using the default connection string are backed up.
-
CosmosBackup:Accounts:0:ConnectionString
: The connection string to the Cosmos DB account to back up. If not specified,CosmosBackup:DefaultConnectionString
is used. -
CosmosBackup:Accounts:0:DatabaseId
: The ID of the database to back up. If not specified, then all databases are backed up, andCosmosBackup:Accounts:0:CollectionId
is ignored. -
CosmosBackup:Accounts:0:CollectionId
: The ID of the collection to back up. If not specified, then all collections are backed up.
Please note that you need to increment the index count for each database/collection you want backed up.
You probably know this, but it is always worth mentioning. You should not store your sensitive configuration data directly as configuration values on the Azure portal, but use services like Azure Key Vault that can help you protect your sensitive configuration, so that only your application can read it.
Might sound very hard, but it is actually pretty easy. This 2-part instrunction article is a good place to start.