Issue In Azure BackUp – Enable-AzRecoveryServicesBackupProtection : ‘containerName’ cannot be null
Good Morning !!! Hope you all good !
In one of our previous articles we have discussed How To Restore Azure File Share From BackUp Using PowerShell. Today in this article we will discuss How To Address One issue Raised During Register Recovery Service Vault.
Tool Installation Articles :
- Configure Azure Command Line Interface ( Azure CLI) On Windows
- Configure PowerShell For Microsoft Azure Az Module On Windows
Previous Azure series :
- Learn Basics Of Azure Networking In 60 Hours
- Learn Basic Of Azure Active Directory And Azure Identity And Access Management
- Azure DevOps – Learn at one place
If you have missed our previous articles on Azure Storage and Database Series, please check it in following links.
In one of our previous lab exercise, I was taking backup of Azure File Share using PowerShell. After configuring backup policy, when I was trying to Enable the Backup and register my selected Storage Account with my new Vault, I got one error on my PowerShell window that says ‘Enable-AzRecoveryServicesBackupProtection : ‘containerName’ cannot be null null. We can see the error details in the following figure.
I have move around through the Google for some time and one Storage Account Can Be Register With Only One Vault At A Time. Then I remember that, the storage account I am using in my script now has already register with a different Vault during one of my previous lab exercise. So I went to my previous vault to check if it is still registered and as we can see in the following figure it is already registered. So I thought, I could delete my old Vault as my old Service Vault is not required any more.
Then I tried to delete my old Recovery Service Vault but as we can see in the following figure, it doesn’t allow me to do so because, it found existing resource within the vault and it asked to first unregister the resource and then try to delete.
Unregister A Storage Account
As per Microsoft recommendation to protect our file shares in a particular storage account by using a different Recovery Services vault, first stop protection for all file shares in that storage account. Then unregister the account from the current Recovery Services vault used for protection.
Let’s go through the following steps to unregister the storage account.
Step 1- Open the Recovery Services vault where our storage account is registered and where we want to unregister our storage account.
Step 2 – On the Overview pane of selected recovery service vault, click the Backup Infrastructure option under the Manage section as showing in the following figure.
Step 3 – It will open the Backup Infrastructure pane as showing in the following figure.
Step 4 – Click Storage Accounts under the Azure Storage Accounts section, it will list all registered storage accounts s showing in the following figure.
Step 5 – Then Select the storage account we want to unregister and Right-click the storage account and click Unregister as showing in the following figure.
Step 6 – Then provide storage account name and region why we want to delete it and click Delete button to complete the unregister process.
In the above figures it shows that, we have successfully unregister the storage account. After unregister the storage account, I tried to execute the following script to Enable back up protection.
Enable-AzRecoveryServicesBackupProtection -StorageAccountName "kjstorageaccount1" -Name "manas-ps-file-share" -Policy $ManasafsPol
As we can see in the above figure the issue is fixed and the command executed successfully.
I hope this is informative to you. Please let me know if I missed anything important or if my understanding is not up to the mark. Keep reading, share your thoughts, experiences. Feel free to contact us to discuss more.
If you have any suggestion / feedback / doubt, you are most welcome. Stay tuned on Knowledge-Junction, will come up with more such articles.
Thanks for reading 🙂 .