Change automated backup settings for Azure SQL Managed Instance

Applies to: Azure SQL Managed Instance

This article provides examples to modify automated backup settings for Azure SQL Managed Instance, such as the short-term retention policy and the backup storage redundancy option that's used for backups. For Azure SQL Database, see Change automated backup settings for Azure SQL Database.

Note

This article provides steps about how to delete personal data from the device or service and can be used to support your obligations under the GDPR. For general information about GDPR, see the GDPR section of the Microsoft Trust Center and the GDPR section of the Service Trust portal.

Change short-term retention policy

You can change the default point-in-time recovery (PITR) backup retention period by using the Azure portal, PowerShell, or the REST API. The following examples illustrate how to change the PITR retention to 28 days.

Warning

If you reduce the current retention period, you lose the ability to restore to points in time older than the new retention period. Backups that are no longer needed to provide PITR within the new retention period are deleted.

If you increase the current retention period, you don't immediately gain the ability to restore to older points in time within the new retention period. You gain that ability over time, as the system starts to retain backups for longer periods.

Note

These APIs will affect only the PITR retention period. If you configured long-term retention (LTR) for your database, it won't be affected. For information about how to change long-term retention periods, see Long-term retention.

Prepare your environment for the Azure CLI:

If you prefer to run CLI reference commands locally, install the Azure CLI. If you're running on Windows or macOS, consider running Azure CLI in a Docker container. For more information, see How to run the Azure CLI in a Docker container.

  • If you're using a local installation, sign in to the Azure CLI by using the az login command. To finish the authentication process, follow the steps displayed in your terminal. For other sign-in options, see Sign in with the Azure CLI.

  • When you're prompted, install the Azure CLI extension on first use. For more information about extensions, see Use extensions with the Azure CLI.

  • Run az version to find the version and dependent libraries that are installed. To upgrade to the latest version, run az upgrade.

Use the following example to change the PITR backup retention of a single active database in a managed instance:

# Set a new PITR backup retention period on an active individual database
# Valid backup retention must be 1 to 35 days
az sql midb short-term-retention-policy set \
    --resource-group myresourcegroup \
    --managed-instance myinstance \
    --name mymanageddb \
    --retention-days 1 \

Use the following example to change the PITR backup retention for all active databases in a managed instance:

# Set a new PITR backup retention period for all active databases
# Valid backup retention must be 1 to 35 days
az sql midb short-term-retention-policy set \
    --resource-group myresourcegroup \
    --managed-instance myinstance \
    --retention-days 1 \

Configure backup storage redundancy

Configure backup storage redundancy for SQL Managed Instance by using the Azure portal, the Azure CLI, and Azure PowerShell.

To change the backup storage redundancy after you create a managed instance by using the Azure CLI, specify the -BackupStorageRedundancy parameter with the az sql mi update cmdlet. View the update mi backup storage redundancy example.

Possible values for -BackupStorageRedundancy are Geo for geo-redundant, Zone for zone-redundant, Local for locally redundant, and GeoZone for geo-zone redundant backup storage.

Next steps