Skip to content

Error running SQL DB restore using AZ CLI #24048

@robnotley

Description

@robnotley

This is autogenerated. Please review and update as needed.

Describe the bug

When running az backup restore restore-azurewl the error below occurs.

Initially I run az backup recoverypoint list to get a list of recovery points to work with. Then I run az backup recoveryconfig show to create a recovery config JSON file before running az backup restore restore-azurewl using the JSON file. The issue appears to be related to the JSON file but the formatting appears to be correct as the JSON file appears to validate.

Command Name
az backup restore restore-azurewl

Errors:

The command failed with an unexpected error. Here is the traceback:
Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 663, in execute
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 718, in _run_job
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/backup/_exception_handler.py", line 11, in backup_exception_handler
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 697, in _run_job
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 333, in __call__
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/backup/custom_base.py", line 508, in restore_azure_wl
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/backup/custom_wl.py", line 618, in restore_azure_wl
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/backup/custom_help.py", line 448, in get_or_read_json
  File "json\__init__.py", line 293, in load
  File "json\__init__.py", line 346, in loads
  File "json\decoder.py", line 337, in decode
  File "json\decoder.py", line 355, in raw_decode
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

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...

get list of recovery points to work with

  • az backup recoverypoint list --resource-group %resourcegroup% --vault-name %RSVVault% --container-name %container% --item-name "SQLDataBase;mssqlserver;pm" --output table

build recoveryconfig json file

  • az backup recoveryconfig show --restore-mode OriginalWorkloadRestore --backup-management-type AzureWorkload
    --container-name %container% --item-name "SQLDataBase;mssqlserver;pm"
    --log-point-in-time "27-09-2022-07:32:58" --resource-group %resourcegroup%
    --target-container-name %targetcontainer% --target-item-name "SQLDataBase;mssqlserver;pm"
    --target-resource-group %resourcegroup% --target-server-name %servername%
    --target-server-type SQLDatabase --target-vault-name %RSVVault%
    --vault-name %RSVVault% --workload-type SQLDataBase
    --output json `

c:\temp\recoveryconfig.json

run restore task

  • az backup restore restore-azurewl --resource-group {} --vault-name {} --recovery-config recoveryconfig.json

Expected Behavior

A restore job should be started in Azure RSV.

Environment Summary

Windows-10-10.0.22621-SP0
Python 3.10.5
Installer: MSI

azure-cli 2.40.0

Additional Context

I have been following the docs below;
https://learn.microsoft.com/en-us/azure/backup/backup-azure-sql-restore-cli
https://learn.microsoft.com/en-us/cli/azure/backup/recoveryconfig?view=azure-cli-latest
https://learn.microsoft.com/en-us/cli/azure/backup/restore?view=azure-cli-latest#az-backup-restore-restore-azurewl

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions