azure-cli
azure-cli copied to clipboard
backup-now 'item not found'
This is autogenerated. Please review and update as needed.
Describe the bug
When running az backup protection backup-now
for sql in azure vm, the backup item cannot be found, despite the container existing with protectable items listed.
This did work in the past, with almost identical code. Trying this code again, yields the same result.
Command Name
az backup protection backup-now
Errors: Azure CLI
(BMSUserErrorDataSourceObjectNotFound) Item not found. Selected item might have been deleted. Please check if item is registered to the vault.
Code: BMSUserErrorDataSourceObjectNotFound
Message: Item not found. Selected item might have been deleted. Please check if item is registered to the vault.
Finding the error in the GUI, it shows this:
Error Code
CloudInternalError
Error Code
Microsoft Azure Backup encountered an internal error.
Recommended action
Wait for a few minutes and then try the operation again. If the issue persists, please contact Microsoft support.
To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
- Put any pre-requisite steps here...
-
az backup protection backup-now --container-name {} --item-name {} --resource-group {} --vault-name {} --backup-management-type {} --backup-type {}
Expected Behavior
The SQL database in the Azure VM, in the backup container's protectable item list, is backed up once.
Environment Summary
Windows-10-10.0.22000-SP0
Python 3.10.5
Installer: MSI
azure-cli 2.38.0
Additional Context
This seemed to stop working around the time we started deploying similar environments in the same subscription, though they each have their own resource group and recovery vault. I don't think this is related, but it's all I can think of.
Thank you for your feedback. This has been routed to the support team for assistance.
route to CXP team
@kiweezi I am not able to reproduce this in my environment and backup-now
works fine. Can you please make sure that you are passing the correct backup item name? Also, validate the item name on Azure portal > Backup items.
@kiweezi I am not able to reproduce this in my environment and
backup-now
works fine. Can you please make sure that you are passing the correct backup item name? Also, validate the item name on Azure portal > Backup items.
@SaurabhSharma-MSFT Thanks for the response!
The items are not currently backed up yet, as they are SQLDataBase type. Therefore I cannot see them in the portal.
I have created a backup container of the SQL in Azure VM and run protectable-item list
to obtain the item name:
az backup protectable-item list
"name": "sqldatabase;mssqlserver;temp",
I've tried many variations of this name; mssqlserver;temp
, temp
, sqldatabase;temp
, sqldatabase;mssqlserver
.
All fail with Item not found. Please provide a valid item_name.
except the output from above, which fails with the error provided in the issue:
--item-name 'sqldatabase;mssqlserver;temp'
Message: Item not found. Selected item might have been deleted. Please check if item is registered to the vault.
I'll be honest and say I'm not sure what the item name is meant to be, when reading the docs, it doesn't explain where to get it. I just assumed it was that output from the protectable item list command above. I will say though that I'm 99% sure this command has worked for me before in the past, only now it is failing.
Does this make sense? Happy to provide any more in info :).
@kiweezi Thanks for sharing details. You need to use "Friendly Name" instead of "Name" attribute retrieved by using az backup protectable-item list
cmdlet.
@kiweezi Thanks for sharing details. You need to use "Friendly Name" instead of "Name" attribute retrieved by using
az backup protectable-item list
cmdlet.
Hey @SaurabhSharma-MSFT, I appreciate the help :). I tried 'friendlyName' as you said and got a similar error message, but not quite the same.
Running protectable-item list
I get the following info:
az backup protectable-item list
"name": "sqldatabase;mssqlserver;temp",
"properties": {
"friendlyName": "Temp",
}
Taking the 'friendlyName' property as an item name for backup-now
:
az backup protection backup-now --item-name 'Temp'
Item not found. Please provide a valid item_name.
I remember this leading to my initial confusion! If I can't gather the item name from the protectable item list, how am I supposed to script this process?
@kiweezi I do not see any issues using name as "sqldatabase;mssqlserver;model". I believe, you are getting this error you have not enable backup for the required resource.
Instead of using
protectable-item list
, please use az backup item list
to get the list of backup items already protected or backed up to an Azure Recovery Services vault. protectable-item list
gives you the list of items which are registered but yet to be protected.
Hey @SaurabhSharma-MSFT. My apologies for the late reply!
Before I attempted the backup-now
I used az backup protection auto-enable-for-azurewl
.
As I understand, this enables a backup policy for all databases on the SQL instance. Is there something else I have to do before I can use backup-now
?
What commands did you use to prepare your environment for the backup-now
command?
Hey @SaurabhSharma-MSFT.
Would you be able to share anymore about how you prepared your environment before you ran the backup-now
command?
@kiweezi Sorry for the delay. Can you please check this documentation - Back up SQL databases in Azure VM using Azure CLI.
@kiweezi Sorry for the delay. Can you please check this documentation - Back up SQL databases in Azure VM using Azure CLI.
Thanks @SaurabhSharma-MSFT! I believe this guide wasn't available before I created this issue. I can already spot something different that I'm not doing from the guide. I will have a look at this in the next few days and see if I can replicate what you did to get this working.
@kiweezi Please let me know if you have any other questions, else we are proceeding with the closure of this issue.
@kiweezi We will now proceed to close this thread. If there are further questions regarding this matter, please reopen it and we will gladly continue the discussion.