Backup and restore Azure SQL databases
npm install azurin
Backup and restore an Azure SQL database.
- automatically uses blob/dbname/dbname-YYYY-MM-DD-HH-mm.bacpac
- automatically restores the latest blob to dbname-YYYY-MM-DD-HH-mm
- does not store passwords or access_key, use an azure certificate
- check a import/export request status, or wait for the request to finish
```
npm install -g azurin
Backup an Azure SQL database to a blob stored bacpac, as Start-AzureSqlDatabaseImport
Restore a bacpac as a new Azure SQL database, as Start-AzureSqlDatabaseExport
`
azurin
Options:
--help Output usage information
--certificate
--db-user
--db-password
--db-server
--db-name
--db-edition
--db-size
--blob-account
--blob-account-key
--blob-name
--blob-container
--request-id Request GUID
--wait Wait for the request to finish
Example:
$ command backup -u user -p password -s server -d dbname -a storage -k 12345
$ command restore --db-user user --db-password password --db-server server --db-name dbname --blob-account storage --blob-account-key 12345
`
`
azurin
Options:
--help Output usage information
--certificate
--db-user
--db-password
--db-server
--db-name
--request-id Request GUID
--wait Wait for the request to finish
Example:
$ command status --db-user user --db-password password --db-server server --db-name dbname --request-id 1234-5678-91011
`
Set the DEBUG environment variable to azurin to show every steps.
A test suite is available as npm test` and uses Mocha. It backups, restore, and delete a database.
This test assumes all AZURE_CERTIFICATE, AZURE_STORAGE_ACCOUNT, AZURIN_TEST_BLOBACCOUNT, AZURIN_TEST_DBUSER, AZURIN_TEST_DBPASSWORD, AZURIN_TEST_DBNAME and AZURIN_TEST_DBSERVER environment variables are set.