3

During the free trial, I spent time fiddling and experimenting with azure. Now that we've moved to paid version, I need to delete all of the experimented things as we don't need all of them.

One of those is a Recovery services vault that somehow got something stuck in it's backup usage (see screenshot below)

The recovery vault as it is now, everything is empty apart from the GRS backup usage

I've looked in all the settings and can find nothing left to remove. Any storage account that may have been linked to the vault is long gone - it's really the only thing that is left in the resource group. I also can't remove the resource group because of this vault.

Any time I try to delete I get following error:

Vault deletion error

Vault 'TestRecoveryServiceVault' cannot be deleted as there are existing resources within the vault. Please delete any replicated items, registered servers, Hyper-V sites (Used for Site Recovery), policy associations for System Center VMM clouds (Used for Site Recovery) and then delete the vault.

I even tried the powershell commands

$vault = Get-AzureRmRecoveryServicesVault -Name "TestRecoveryServiceVault"
Remove-AzureRmRecoveryServicesVault -Vault $vault

(same error as above) and

Remove-AzureRmRecoveryServicesVault -Vault $vault -Force

(but this one throws an error that parameter -Force doesn't exist, I suspect outdated documentation)

I'm at my wits end and would really like this vault gone. Any help is appreciated.

Edit:

Clarification:

There are no tasks left in the vault; only 6MB of data that seems to have come from nowhere, as it didn't get deleted with the tasks. I did not opt to keep backup data when removing tasks.

  • have you use DPM server to backup data to azure? – Jason Ye Mar 16 '17 at 9:38
  • I have not used DPM server at all. – Victoria S. Mar 16 '17 at 9:46
  • I recommend you to create a technical support ticket.Here is the link docs.microsoft.com/en-in/azure/azure-supportability/… to create support case. – Jason Ye Mar 17 '17 at 8:27
  • Created a forum post in stead; bossman doesn't want to pay for support and thus we can't make an actual ticket. (three cheers for cheaping out... sigh) – Victoria S. Mar 17 '17 at 13:02
5

Finally was able to remove the vault, after clearing the sql backups from it through powershell. I'm really surprised NO ONE knew about this and it took so much digging to find it.

commands for anyone else having this problem:

These commands are to first see if anything is in the database backups, then remove it all.

$vault = Get-AzureRmRecoveryServicesVault -Name "VaultName"

Set-AzureRmRecoveryServicesVaultContext -Vault $vault

VIEW THE BACKUP ITEMS

$container = Get-AzureRmRecoveryServicesBackupContainer -ContainerType AzureSQL -FriendlyName $vault.Name

$item = Get-AzureRmRecoveryServicesBackupItem -Container $container -WorkloadType AzureSQLDatabase

$availableBackups = Get-AzureRmRecoveryServicesBackupRecoveryPoint -Item $item

$availableBackups      

REMOVE THE BACKUP ITEMS AND VAULT

$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

I hope I helped some other people out there who ran into this mess.

  • Can't believe that more people haven't encountered this issue and upvoted this answer. Thank you for the help. – Ian Nelson Aug 14 '17 at 14:27
  • I'm glad to have been of service. Hopefully saved you some time on it! – Victoria S. Aug 18 '17 at 12:31
0

You need to delete any of the backup tasks in the vault before you can delete it, easiest way is with this PowerShell:

$vaultName = "<vault name>"
$vault = Get-AzureRmRecoveryServicesVault -Name $vaultName
Set-AzureRmRecoveryServicesVaultContext -Vault $vault
$containers = Get-AzureRmRecoveryServicesBackupContainer -ContainerType AzureVM -Status Registered 
foreach ($container in $containers)
{
    $backupItems = Get-AzureRmRecoveryServicesBackupItem -Container $container -WorkloadType AzureVM
    foreach ($backupItem in $backupItems)
    {
        Disable-AzureRmRecoveryServicesBackupProtection -Item $backupItem -RemoveRecoveryPoints -Force -Confirm:$false
    }
}
  • Thanks for the help, but this didn't work. As I stated in my question, I have no tasks left in the vault, but somehow it got 6MB of data somewhere. I tried your answer anyway, and ended with the same error still. I need a way to clear the backup usage, not the tasks. – Victoria S. Mar 16 '17 at 6:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.