Azure / Azure/azure-cli

[Backup] Issues with `backup policy set`

Open
#4,503 0 comments 0 reactions 1 assignee Assigned to @pvrk View on GitHub
act-observability-squad Recovery Services Backup RecoveryServices Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

I was very confused as to how to create a backup policy when I tried to enable backup on my VM. I tried to use the `get-default-for-vm` command in conjunction with `backup policy set` but I got errors. It turns out this was due to me not quoting the policy document. However, some suggestions:

- [x] Accept `--name\-n` for this command. While this name is contained within the JSON document, it would be a much more intuitive experience to allow the user to specify via command line. Essentially when you parse the JSON object, if the user has specified name, it would patch the object with the new name. It would allow you to pipe the output of the "get-default.." command directly into the policy set command without an intervening step of having to use third-party tools to modify it.
- [x] Update the help to clarify that the command is used to "Create a new backup policy or replace an existing one." Since it is basically a PUT option, say it "updates" the policy is incorrect because in CLI 2.0, "update" specifically implies PATCH-like behavior.

---

### Environment summary

**Install Method:** How did you install the CLI? (e.g. pip, interactive script, apt-get, Docker, MSI, nightly)
Answer here: WGET

**CLI Version:** What version of the CLI and modules are installed? (Use `az --version`)
Answer here: azure-cli (2.0.17+dev)

acr (2.0.11+dev)
acs (2.0.15+dev)
appservice (0.1.16+dev)
backup (1.0.0+dev)
batch (3.1.3+dev)
billing (0.1.4+dev)
cdn (0.0.8+dev)
cloud (2.0.7+dev)
cognitiveservices (0.1.7+dev)
command-modules-nspkg (2.0.1+dev)
component (2.0.7+dev)
configure (2.0.10+dev)
consumption (0.1.4+dev)
container (0.1.10+dev)
core (2.0.16+dev)
cosmosdb (0.1.12+dev)
dla (0.0.11+dev)
dls (0.0.13+dev)
eventgrid (0.1.3+dev)
extension (0.0.2+dev)
feedback (2.0.6+dev)
find (0.2.6+dev)
interactive (0.3.9+dev)
iot (0.1.11+dev)
keyvault (2.0.10+dev)
lab (0.0.10+dev)
monitor (0.0.9+dev)
network (2.0.14+dev)
nspkg (3.0.1+dev)
profile (2.0.12+dev)
rdbms (0.0.6+dev)
redis (0.2.8+dev)
resource (2.0.14+dev)
role (2.0.11+dev)
servicefabric (0.0.3+dev)
sql (2.0.11+dev)
storage (2.0.15+dev)
vm (2.0.14+dev)

**OS Version:** What OS and version are you using?
Answer here: WSL

**Shell Type:** What shell are you using? (e.g. bash, cmd.exe, Bash on Windows)
Answer here: Bash on Windows

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.