Issue In Azure BackUp – Enable-AzRecoveryServicesBackupProtection : ‘containerName’ cannot be null

Hello Everybody,
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.
Part 1 – Overview Of Azure Storage and Database
Part 2 – Azure Storage Account
Part 4 – Work With Azure Blob Storage
Part 5 – Storage Explorer For Azure Storage
Part 6 – Azure Blob Storage – Snapshot Using Storage Explorer
Part 7 – Azure Blob Storage – Shared Access Signature (SAS)
Part 8 – Secure Azure Storage Using Stored Access Policy
Part 9 – Secure Azure Storage Using RBAC
Part 10 – Configure Stored Access Policy Using PowerShell
Part 11 – Get Shared Access Signature (SAS) Using PowerShell
Part 12 – Azure Blob Storage – Host Static Website In Azure Storage Account
Part 13 – Azure Blob Storage – Work With AzCopy Tool
Part 14 – Azure File Service – Overview
Part 15 – Azure File Service – Mount File Share On Window Server Using PowerShell
Part 16 – Azure File Service – Mount File Share On Window Server Using File Share URL
Part 17 – Azure File Service – Create File Share Using Power Shell
Part 18 – Azure File Service – Upload And Copy Files In File Share Using Power Shell
Part 19 – Azure File Service – BackUp And Restore Azure Files From Recovery Services Vault
Part 20 – Azure File Service – BackUp And Restore Azure Files From The File Share Pane
Part 21 – Azure File Service – Create And Manage File Share Snapshots Using PowerShell
Part 23 – Azure File Service – Restore Azure Files From Back Up Using PowerShell
Part 24 – Azure File Service – Storage Sync Service
Part 25 – Azure File Service – Storage Sync Service – Configure Azure File Sync – 1
Part 26 – Azure File Service – Storage Sync Service – Configure Azure File Sync – 2
Part 27 – Difference Between Azure Blog Storage And Azure File Storage
Part 28 – Azure Queue Storage – Overview
Part 29 – Azure Queue Storage – Store And Process Messages In Azure Queue
Issue Details
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 🙂 .
1 Response
[…] our previous articles we have discussed How To Address One Issue We Faced During Enabling The BackUp . Today in this article we will talk about another issue we come across during restore file share […]
You must log in to post a comment.