0

I am working on a process to automatically remove and add databases to Azure. When the database isn't in use, it can be removed from Azure and placed in cheaper S3 storage as a .bacpac.

I am using SqlPackage.exe from Microsoft as a PowerShell script to export and import these databases from and to Azure respectively in either direction. I invoke it via a Python script to use boto3.

The issue I have is with the down direction at step 3. The sequence would be:

  1. Download the Azure SQL DB to a .bacpac (can be achieved with SqlPackage.exe)
  2. Upload this .bacpac to cheaper S3 storage (using boto3 Python SDK)
  3. Delete the Azure SQL Database (It appears the Azure Blob Python SDK can't help me, and it appears SQLPackage.exe does not have a delete function)

Is step 3 impossible to automate with a script? Could a workaround be to SqlPackage.exe import a small dummy .bacpac with the same name to overwrite the old bigger DB? Thanks.

2
  • Are you looking for a PowerShell Cmdlet to delete SQL database? Commented Mar 3, 2022 at 18:08
  • Yes, a Microsoft SQL Azure database, PowerShell or Python would be preferred to easily integrate into this script. Commented Mar 3, 2022 at 18:09

1 Answer 1

1

To remove an Azure SQL Database using PowerShell, you will need to use Remove-AzSqlDatabase Cmdlet.

To remove an Azure SQL Database using Azure CLI, you will need to us az sql db delete.

If you want to write code in Python to delete the database, you will need to use Azure SDK for Python.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.