microsoft / microsoft/sql-server-samples
Database copy won't be deleted
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 11.2k
- Forks
- 9.1k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 14
Description
Hi,
I set up the ExportSqlDbToStorage job and ExportSqlDbBlobRetention job to be automatically run ever night. Sometime the copy of the database won't be deleted after the entire job was done.
It happens several times that 'ExportSqlDbToStorage' job just restarted by itself while copying or exporting and left the copied database in the storage, and then I have to manually delete the database copy by myself. This happens 3-5 time every month. If the job restart, the new created database copy will be deleted successfully after export, since the old copy wasn't in the array anymore, it won't get deleted.
I am not sure what cause the job to restart, sometime it will show an error saying 'unable to connect to the server', sometime there is no error or warning. Any ideas? Thanks.

--The ExportSqlDbToStorage job is azure-automation-automated-export/AutoExport.ps1
https://github.com/Microsoft/sql-server-samples/blob/master/samples/manage/azure-automation-automated-export/AutoExport.ps1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with azure-automation-automated-export/AutoExport.ps1, focusing on the ExportSqlDbToStorage and ExportSqlDbBlobRetention jobs and how copied databases are tracked across a restart. Reproduce or trace the reported restart and connection-error paths; done means an interrupted or restarted export does not leave an orphaned database copy in storage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, powershell, sql
- Domain
- cloud, databases, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100