Search code examples
azure-sql-databaseazure-powershellazureportalazure-sql-serverazure-backup-vault

Cannot set Azure SQL Database Long-term backup retention


I'm trying to re-configure long term backup retention for my Azure SQL Database from a previously deleted recovery services vault (via Powershell) to a new recovery services vault

Now when I try to configure it gives me an error saying

TemplateBladeVirtualPart SQLAZUREEXTENSION

Here is the script I used to removed the old recovery services vault (if it matters?)

$vault = Get-AzureRmRecoveryServicesVault -Name "is-vault-prod"
Set-AzureRmRecoveryServicesVaultContext -Vault $vault
$container = Get-AzureRmRecoveryServicesBackupContainer -ContainerType AzureSQL -FriendlyName $vault.Name
$item = Get-AzureRmRecoveryServicesBackupItem -Container $container -WorkloadType AzureSQLDatabase
$availableBackups = Get-AzureRmRecoveryServicesBackupRecoveryPoint -Item $item
$containers = Get-AzureRmRecoveryServicesBackupContainer -ContainerType AzureSQL -FriendlyName $vault.Name
ForEach ($container in $containers)
{
    $items = Get-AzureRmRecoveryServicesBackupItem -container $container -WorkloadType AzureSQLDatabase
    ForEach ($item in $items)
    {
        Disable-AzureRmRecoveryServicesBackupProtection -item $item -RemoveRecoveryPoints -ea SilentlyContinue
    }
    Unregister-AzureRmRecoveryServicesBackupContainer -Container $container
}
Remove-AzureRmRecoveryServicesVault -Vault $vault

enter image description here enter image description here


Solution

  • Unfortunately, you just cannot choose another Recovery service vault once you had already used one.

    I did a test in my lab and tried to disable the long backup retention but still failed, and found that:

    enter image description here

    This screenshot means that once you configured a recovery service vault for a SQL Server, it will be locked , you cannot use another vault.

    I also found this in a FAQ:

    Can I register my server to store backups to more than one vault?

    No, you can currently store backups to only one vault at a time.

    I understand why you want to use another vault.

    However, We can just use this recovery service vault currently.If it was deleted, we cannot use long-term backup retention. It seems like a bad point of design. I will report this issue and I believe this feature would be better in future.

    You can also post your idea in this Feedback Forum.

    Hope this helps!