Removing old SQL Backups in Azure Storage

rr-4098 2,051 Reputation points
2024-09-07T17:59:58.7733333+00:00

We used to use a maintenance plan to cleanup old SQL backups onprem. We are testing backing up to an Azure storage account. It does not appear the maintenance plan can access an URL location. Is this correct? If so, what is the best way to address this?

Azure Storage
Azure Storage
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
3,529 questions
SQL Server Other
{count} votes

Accepted answer
  1. Vinod Kumar Reddy Chilupuri 4,185 Reputation points Microsoft External Staff Moderator
    2024-09-10T06:44:41.0933333+00:00

    Hi rr-4098,
    Welcome to Microsoft Q&A, thanks for posting your query.

     

    Yes, you're right. SQL Server Maintenance Plans do not support accessing or interacting with URL-based locations like Azure Blob Storage. They are designed to work with local disk locations.

     

    To clean up old SQL backups stored in Azure Blob storage, you can use Azure Blob storage lifecycle management. Lifecycle management policies are supported for block blobs and append blobs in general-purpose v2, premium block blob, and Blob Storage accounts.

    A lifecycle management policy is composed of one or more rules that define a set of actions to take based on a condition being met. For a base blob, you can choose to check one of the following conditions:

    • The number of days since the blob was created.
    • The number of days since the blob was last modified.
    • The number of days since the blob was last accessed. To use this condition in an action, you should first optionally enable last access time tracking.

    To set up lifecycle management for your Azure Blob storage account, you can use the Azure portal, Azure CLI, or Azure PowerShell.

     

    Reference: Configure a lifecycle management policy - Azure Blob Storage | Microsoft Learn

    https://docs.microsoft.com/en-us/powershell/module/az.storage/set-azstorageaccountmanagementpolicy?view=azps-6.4.0

    These pages provide detailed information on how to set up and manage lifecycle management rules for Azure Blob storage using the Azure portal, Azure CLI, or Azure PowerShell.

     

    Azure Blob storage lifecycle management can be used to delete blobs based on their age or other criteria.

    If you want to delete files in a file share, you can use Azure File Sync to replicate the files to an Azure file share and then use Azure Blob storage lifecycle management to delete the blobs.

     

    Lifecycle management policy will not delete the current version of a blob until any previous versions or snapshots associated with that blob have been deleted. 

    If blobs in your storage account have previous versions or snapshots, then you must include previous versions and snapshots when you specify a delete action as part of the policy.

     

    Please let us know if you have any further queries. I’m happy to assist you further. 

     

    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.