Azure / Azure/azure-cli

Allow using `az sql db restore` cross-server

Open
#20,703 10 comments 0 reactions 0 assignees View on GitHub
act-codegen-extensibility-squad customer-reported question Service Attention SQL
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

**Is your feature request related to a problem? Please describe.**
I'm frustrated that I cannot use `az sql db restore` to restore a PITR backup of my database to a new database on another server.

**Describe the solution you'd like**
Currently `az sql db restore` supports the following arguments:
```
--dest-name
--name -n
--resource-group -g
--server -s
```
I would propose adding the following arguments:
```
--dest-resource-group
--dest-server
```
This way one can restore a PITR backup to another server in another resource group.

**Describe alternatives you've considered**
Only workarounds like:
- ~~Using the REST API directly~~ See comment below. Cross-server restore of PITR backups doesn't seem be supported by the REST API.
- First restoring the database on the same server, and then using an alternative method to get a clone on the target server

**Additional context**
I expect that `az sql db restore` uses the REST API, and specifically [this endpoint](https://docs.microsoft.com/en-us/rest/api/sql/2021-05-01-preview/databases/create-or-update#creates-a-database-from-pointintimerestore.).
As far as I can see there is no limitation that requires using the same server or resource group in the `sourceDatabaseId`.

The preview command for restoring LTR backups, `az sql db ltr-backup restore`, does support restoring cross-server.
But since LTR backups are only weekly, this does not suffice for our use-case.

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.