How to delete Old database backup files from Azure blob container through Using T-SQL script without using any Azure CLI and PowerShell commands.

Srinivas Naraipeddi 40 Reputation points
2025-06-03T10:07:37.5933333+00:00

Here is the corrected version of your sentence:

We are facing an issue with deleting old backup files from the Azure Blob container. Our company is not willing to spend money on this deletion activity. Please let me know how to delete old database backup files from the Azure Blob container using only a T-SQL script, without using Azure CLI or PowerShell commands.
Server Details : Azure Managed Instance Tier : General

Developer technologies Transact-SQL
{count} votes

1 answer

Sort by: Most helpful
  1. Erland Sommarskog 121.4K Reputation points MVP Volunteer Moderator
    2025-06-03T21:05:15.9966667+00:00

    "I'm in London and I want to go New York. I don't want to fly or take a boat. Please let me know how I can go to New York by car".

    As Olaf says, T-SQL is not for managing Azure Blob store. You could write a CLR procedure that you call for the task, but that's more complicated than using CLI or Powershell (and neither of them would cost anything particularly.)

    The alternative would be to go use something like Azure Storage Explorer and delete the files manually. That's free software as I recall.

    1 person found this answer helpful.
    0 comments No comments

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.