Receiving an Error when deleting an Azure Recovery Services Vault - azure

I have an old Azure Recovery Services vault for an on-premise Windows Desktop that I am trying to remove after decommissioning said desktop. Azure is responding with this error message:
Vault cannot be deleted as there are existing resources within the vault. Please ensure there are no backup items, protected servers or backup management servers associated with this vault. Unregister the following containers associated with this vault before proceeding for deletion : VAULT-NAME. Unregister all containers from the vault and then retry to delete vault
Where VAULT-NAME is the name of my vault.
I followed the steps referenced in this answer but could not get past this step due to the fact that there is not a corresponding "Windows" or "WindowsServer" option for the WorkloadType parameter.
$item = Get-AzureRmRecoveryServicesBackupItem -Container $container -WorkloadType AzureSQLDatabase
Skipping the item retrieval and disable steps and instead trying to unregister the container and remove the vault with the following commands was of no use on account of still having backups associated with the container.
Unregister-AzureRmRecoveryServicesBackupContainer -Container $container
Remove-AzureRmRecoveryServicesVault -Vault $vault

I have not mapped this answer to the corresponding Azure commands, but I was able to find my way to a solution via the Azure Portal. The steps were as follows:
Selected my Recovery Service resource
Under the Manage section, clicked Backup Infrastructure
Under Management Servers, clicked Protected Servers
In the list that followed, clicked on the row where my Protected Server Count was greater than 0, in my case, Azure Backup Agent (because the backup agent was installed on my Windows Desktop)
Clicked on my server name in the Protected Server list
Clicked Delete in the card for my protected server
After that completed, I was able to delete the entire vault. These steps may be helpful if you have other Backup Infrastructure resources and possibly even Site Recovery Infrastructure resources associated with a vault.
Update: It seems like there's an open issue for Get-AzureRmRecoveryServicesBackupItem not having any capacity to return MARS backup items which is ultimately what the issue here was.

Related

AZURE Restoring backup from resource that changed resource group

Scenario:
I had the need to move resources from one vault to another, without deleting the backups. This was due to cost, as the vault was created and everything protected in GRS, instead of LRS. I stopped all the backups in the GRS vault, moved everything from resource group (workaround that I found) and then I was able to protect everything in the new Vault. As I moved from resource group, the VM's changed their ID, and now I need to restore a backup that was in the old vault, but the restore fails because it's not able to find the VM.
Is there any way to do it?

Resume backup of a azure VM, Powershell command

I just disabled the backup of my Azure VM and moved it to another subscriptions with all dependencies. Now I want to resume the backup using Powershell command. But I find that there is only some command for enable or disable backup, is there anything to resume a backup ?
If you want to resume ? Just Re-enable vm backup?
Reference: Enable backup for an Azure VM and Back up a virtual machine in Azure with PowerShell
You enable backup for an Azure VM, and specify a backup policy.
The policy defines when backups run, and how long recovery points created by the backups should be retained.
The default protection policy runs a backup once a day for the VM, and retains the created recovery points for 30 days. You can use this default policy to quickly protect your VM.
Enable backup as follows:
First, set the default policy with Get-AzRecoveryServicesBackupProtectionPolicy:
$policy = Get-AzRecoveryServicesBackupProtectionPolicy -Name "DefaultPolicy"
Enable VM backup with Enable-AzRecoveryServicesBackupProtection. Specify the policy, the resource group and the VM name.
Enable-AzRecoveryServicesBackupProtection `
-ResourceGroupName "myResourceGroup" `
-Name "myVM" `
-Policy $policy
As you know there is enable or disable operation for Azure VM backup. I think there is no such resume backup operation. Per my understanding, I suppose what you want is to continue backups the Azure VM in the existing recovery service vault after you move the Azure VM to another subscription. If so, please note that
Recovery Services vault doesn't support cross subscription backups. If
you move a vault with virtual machine backup data across
subscriptions, you must move your virtual machines to the same
subscription, and use the same target resource group to continue
backups.
To move a virtual machine to a new subscription without moving the Recovery Services vault:
Temporarily stop backup
Delete the restore point. This operation deletes only the instant recovery points, not the backed-up data in the vault.
Move the virtual machines to the new subscription
Reprotect it under a new vault in that subscription
In this case, you have to create a new vault for Azure VM backup after you move the VM to another subscription, so you will use Enable-AzRecoveryServicesBackupProtection to enable backup for an Azure VM then start a backup job with Backup-AzRecoveryServicesBackupItem.
Otherwise, you can move a Recovery Services vault and its associated resources to another subscription. Currently, you can move one Recovery Services vault, per region, at a time. You can't move vaults that back up Azure Files, Azure File Sync, or SQL in IaaS virtual machines. To move a Recovery Services vault, you must enroll in a limited public preview.
You also could get more details from the recovery service limitation.

Azure Resoure Manager, Failed to delete resource group error

While deleting a resource group am getting the below mentioned error.
Failed to delete resource group backupone: Deletion of resource group
'backupone' failed as resources with identifiers
'Microsoft.RecoveryServices/vaults/backupone' could not be deleted.
The provisioning state of the resource group will be rolled back. The
tracking Id is 'ee14d432-edf4-48e3-ba7f-016757125909'. Please check
audit logs for more details. (Code: ResourceGroupDeletionBlocked)
Vault cannot be deleted as there are existing resources within the
vault. Please ensure there are no backup items, protected servers or
backup management servers associated with this vault. Unregister the
following containers associated with this vault before proceeding for
deletion : backuponestg Unregister all containers from the vault and
then retry to delete vault (Code:
ServiceResourceNotEmptyWithContainerDetails)
Can someone please help me understand what is wrong?
As I commented above, the error message
Vault cannot be deleted as there are existing resources within the vault
hints to me there might be a Azure Site Recovery Vault in the resource group.
Here's some more information.
If you got a Azure Site Recovery Vault inside of a resource group, and it contains some data from backed up virtual machines, then this can block the deletion of the vault.
You need to, manually, first to clean up the vault before you can delete the ASR vault. This is a mechanism set in place to prevent accidental deletion of backed up data.
Check out this link for a more detailed guide on what steps you need to take to unassociate workloads with your vault.

TFS 2015 and Azure VMs File Copy

In TFS I selected Azure VMs File Copy:
My machine is classic and I created classic storage account. I set up the connection using username and password, not management certificate.
The storage account and cloud service I had to populate myself, because they did not appear in the drop-down menu (so possibly something is wrong already at this stage).
In the Cloud Service I entered MyMachine.cloudapp.net.
The task starts, it seems to login successfully, but throws:
Unable to find type [Hyak.Common.CloudException]
Log:
2017-11-24T14:21:28.80333Z Add-AzureAccount -Credential $psCredential
2017-11-24T14:21:35.866333Z Select-AzureSubscription -SubscriptionId -Default
2017-11-24T14:21:35.882333Z Set-AzureSubscription -SubscriptionId yy -CurrentStorageAccountName yyy
2017-11-24T14:21:35.898333Z ##[debug]Starting Azure File Copy Task
2017-11-24T14:21:35.898333Z ##[debug]connectedServiceNameSelector = ConnectedServiceName
2017-11-24T14:21:35.898333Z [debug]connectedServiceName = yyyyyy
(..)
2017-11-24T14:21:35.991333Z ##[debug]Loading AzureUtilityLTE9.8.ps1
2017-11-24T14:21:36.007333Z ##[debug]Connection type used is
UsernamePassword
2017-11-24T14:21:36.022333Z ##[debug]Azure
CallRetrieving storage key for the storage account:
mystorageaccount
2017-11-24T14:21:38.924333Z ##[error]Unable to find type
[Hyak.Common.CloudException].
Please help.
Actually you don't need to manually type the storage account, it will auto appear in the drop list. You just need to specify a pre-existing classic storage account. It is also used as an intermediary for copying files to Azure VMs.
Classic Storage Account
Required if you select Azure Classic for the Azure Connection Type
parameter. The name of an existing storage account within the Azure
subscription.
According to your log, the issue may related to the storage account setting. Double check this configuration under your Azure subscription.
Also suggest you go through this documentation to get more info of the Azure File Copy task. Such as make sure the machine should configured to allow WinRM connections.

Change Azure Backup Vault Redundancy

We use Azure Backup and set our backup vaults to use GRS. We want to use LRS instead. It is understood that this cannot be changed once machines have been added to the vault, and we need to start from scratch. Two questions:
Do I need to remove the current vault first before I set up a new vault for that same server?
Can the current backups be transferred to the new vault?
Changing a Recovery Service Vault's storage replication type can be achieved via the Portal or PowerShell. Unfortunately, this option is greyed-out in the Portal, and whilst the cmdlet successfully executes, it doesn't change the underlying value: if there is one or more Protected Instances already contained in the vault.
Because of this, and because the default value is GeoRedundant, this must be set before any items have been protected.
To set the storage to Locally Redundant via the Portal:
Create/Open the Recovery Services Vault
Scroll-down and select Backup Infrastructure
Select Backup Configuration
Set Storage replication type to Locally-redundant
To achieve the same via PowerShell:
$RG = 'testResourceGroup'
$VaultName = 'testVault'
$Location = 'Central US'
$vault = Get-AzureRmRecoveryServicesVault -ResourceGroupName $RG -Name $VaultName
If (-not $vault) {
$vault = New-AzureRmRecoveryServicesVault -ResourceGroupName $RG -Location $Location -Name $VaultName
}
Set-AzureRmRecoveryServicesBackupProperties -Vault $vault -BackupStorageRedundancy LocallyRedundant
With regards removing existing vaults and transferring existing backup points:
The existing vault does not need to be deleted, however any protected items will need to be removed from the vault before they can be added to a new vault. It is not sufficient to simply stop backup on the protected item - all the restore points must also be deleted before the item can be added to the new vault
I cannot find any documentation, facility in the Portal or PowerShell which would allow the migration of existing protected items and/or restore points
The only way I've been able to change from Geo-Redundant Storage (GRS) to Locally Redundant Storage (LRS) is to create a new empty vault in the old portal (https://manage.windowsazure.com).
In the old portal you can change storage type in "Configuration".
I expect you will also be able to do it with PowerShell, but haven't tried it though.
You can register your server with 1 vault. In order to register your server with the new vault, you need to use the new vault credentials downloaded from manage.windowsazure.com
You can have multiple vaults. If you do not use your current vault in the future, it will stay there. You have to pay for each vault. So, if you don't need it in the future, it may be better to remove it completely.
There is a comprehensive documentation here:
https://azure.microsoft.com/en-us/documentation/services/backup/

Resources