Azure / Azure/azure-cli

az backup protection enable-for-azurewl do have server parameter instead of vmname and resourcegroup

Open
#28,186 2 comments 0 reactions 0 assignees View on GitHub
act-observability-squad Auto-Assign bug customer-reported Recovery Services Backup Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

I am not fully sure if this is an issue from the Azure CLI or from the Recovery Service Backup.

In the 'az backup protection enable-for-azurewl' command you cannot specify the VM Resource Group for SQLDatabase, just the server.

If you have two VMs (or you had and they were registered with the Recovery Service Vault) with the same name in two different resource groups. You cannot decide which VM is going to configure because the protectable-item-name for SQLDatabases (sqldatabase;mssqlserver;msdb) does not contain the VM name and Resource Group like in the case of SQLInstance (vmappcontainer;compute;**rgname**;vmname), and you just can supply the server name.

Using 'az backup protectable-item list' you can check in the **id** that the protectable-item of type SQLDatabase contains the relation with a specific resource group and vm.

I think the api should retrieve this information and not just keep it in the id. The only solution that, I think can be achieved from the Az CLI is the support to supply the --protectable-item-id.

### Related command

az backup protection enable-for-azurewl

### Errors

{
"endTime": "2024-01-12T09:54:53.834358+00:00",
"error": {
"code": "UserErrorRegisteredVMNotFound",
"message": "Azure Backup service is unable to find the virtual machine registered for workload backup."
},
"id": "01f53968-bf10-402d-86de-e8f5648ec11b",
"name": "01f53968-bf10-402d-86de-e8f5648ec11b",
"properties": null,
"startTime": "2024-01-12T09:54:53.834358+00:00",
"status": "Failed"
}

### Issue script & Debug output

I will add it later, without private information

### Expected behavior

It should work because there is a new vm with the same name and in another resource group with a datasabe named msdb.

### Environment Summary

azure-cli 2.56.0

core 2.56.0
telemetry 1.1.0

Extensions:
azure-devops 0.26.0

Dependencies:
msal 1.24.0b2
azure-mgmt-resource 23.1.0b2

Python location '/opt/homebrew/Cellar/azure-cli/2.56.0/libexec/bin/python'
Extensions directory '/Users/f.palomino/.azure/cliextensions'

Python (Darwin) 3.11.7 (main, Dec 4 2023, 18:10:11) [Clang 15.0.0 (clang-1500.1.0.2.5)]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.