Azure / azure-cli

Azure Command-Line Interface
MIT License
4.01k stars 2.98k forks source link

Error running SQL DB restore using AZ CLI #24048

Open robnotley opened 2 years ago

robnotley commented 2 years ago

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.

get list of recovery points to work with

build recoveryconfig json file

run restore task

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

SaurabhSharma-MSFT commented 2 years ago

@robnotley We are looking into it and get back to you for any additional information.

yonzhan commented 2 years ago

route to CXP team

RyanS-J commented 2 years ago

@robnotley - Have you got the content of the JSON file, does this validate?

robnotley commented 2 years ago

route to CXP team

Is there any update on this support request?

robnotley commented 2 years ago

@robnotley - Have you got the content of the JSON file, does this validate?

Yes the JSON file appears to be valid

robnotley commented 2 years ago

Is there any update on this support request?

Is there any update on this support request?

ghost commented 2 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @pvrk, @adityabalaji-msft.

Issue Details
### **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
Author: robnotley
Assignees: -
Labels: `Service Attention`, `Recovery Services Backup`, `customer-reported`, `Backup`, `Auto-Assign`
Milestone: Backlog
adityabalaji-msft commented 2 years ago

Hi @robnotley - would you be able to share the debug output of the command (using the debug flag), removing PII as needed? Also, what is the format of the value of container name and target container name you are using? This might help us debug further.

Hi @akshayneema - in the meantime, could you take a look at the recovery config show command that is provided above in the thread and whether all the parameters are as per requirement? It might be possible that some of the params like target-container-name and target-vault are applicable for certain scenarios only (eg. restore as files, CRR etc.), so would be good to confirm that.

+@Daya-Patil for visibility

robnotley commented 2 years ago

Hi @adityabalaji-msft

Full detailed commands are below

I ran this from my local machine and also from Azure portal CLI with different results.

Local machine

az backup recoveryconfig show --resource-group "rg-rndev-westeurope-common-c799b2ce" --vault-name "rsv-rndev-f9161b42" --container-name "VMAppContainer;compute;rg-rndev-westeurope-dashworks-0f0f7c68;vm-rndev-sql-green-9f412f7b" --item-name "SQLDataBase;mssqlserver;pm" --restore-mode OriginalWorkloadRestore --rp-name 1847309172622175981 --target-item-name "SQLDataBase;mssqlserver;pm" --target-server-name "sql-green" --target-server-type SQLInstance --workload-type SQLDataBase --output json `

c:\github\recoveryconfig.json

az backup restore restore-azurewl --resource-group "rg-rndev-westeurope-common-c799b2ce" --vault-name "rsv-rndev-f9161b42" --recovery-config c:\github\recoveryconfig.json --debug

Result

PS C:\Github> az backup restore restore-azurewl --resource-group "rg-rndev-westeurope-common-c799b2ce" --vault-name "rsv-rndev-f9161b42" --recovery-config c:\github\recoveryconfig.json --debug cli.knack.cli: Command arguments: ['backup', 'restore', 'restore-azurewl', '--resource-group', 'rg-rndev-westeurope-common-c799b2ce', '--vault-name', 'rsv-rndev-f9161b42', '--recovery-config', 'c:\github\recoveryconfig.json', '--debug'] cli.knack.cli: init debug log: Enable color in terminal. cli.knack.cli: Event: Cli.PreExecute [] cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x022F9388>, <function OutputProducer.on_global_arguments at 0x024DD658>, <function CLIQuery.on_global_arguments at 0x024FA2B0>] cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate [] cli.azure.cli.core: Modules found from index for 'backup': ['azure.cli.command_modules.backup'] cli.azure.cli.core: Loading command modules: cli.azure.cli.core: Name Load Time Groups Commands cli.azure.cli.core: backup 0.006 16 58 cli.azure.cli.core: Total (1) 0.006 16 58 cli.azure.cli.core: Loaded 16 groups, 58 commands. cli.azure.cli.core: Found a match in the command table. cli.azure.cli.core: Raw command : backup restore restore-azurewl cli.azure.cli.core: Command table: backup restore restore-azurewl cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x04D066E8>] cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\Users\RobNotley.azure\commands\2022-10-14.11-01-52.backup_restore_restore-azurewl.2940.log'. az_command_data_logger: command args: backup restore restore-azurewl --resource-group {} --vault-name {} --recovery-config {} --debug cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x04D21928>] cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad [] cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x04D21A00>, <function register_cache_arguments..add_cache_arguments at 0x04D3FF58>] cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded [] cli.knack.cli: Event: CommandInvoker.OnPreParseArgs [] cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x024DD6A0>, <function CLIQuery.handle_query_parameter at 0x024FA2F8>, <function register_ids_argument..parse_ids_arguments at 0x04D3FF10>] cli.azure.cli.core.commands.client_factory: Getting management service client client_type=RecoveryServicesBackupClient cli.azure.cli.core.auth.persistence: build_persistence: location='C:\Users\RobNotley\.azure\service_principal_entries.bin', encrypt=True cli.azure.cli.core.auth.persistence: build_persistence: location='C:\Users\RobNotley\.azure\msal_token_cache.bin', encrypt=True cli.azure.cli.core.auth.binary_cache: load: C:\Users\RobNotley.azure\msal_http_cache.bin urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None) msal.authority: openid_config = {'token_endpoint': 'https://login.microsoftonline.com/f435e8dc-375f-44be-8aba-49a32140fdb3/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/f435e8dc-375f-44be-8aba-49a32140fdb3/discovery/v2.0/keys', 'response_modes_supported': ['query', 'fragment', 'form_post'], 'subject_types_supported': ['pairwise'], 'id_token_signing_alg_values_supported': ['RS256'], 'response_types_supported': ['code', 'id_token', 'code id_token', 'id_token token'], 'scopes_supported': ['openid', 'profile', 'email', 'offline_access'], 'issuer': 'https://login.microsoftonline.com/f435e8dc-375f-44be-8aba-49a32140fdb3/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/f435e8dc-375f-44be-8aba-49a32140fdb3/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/f435e8dc-375f-44be-8aba-49a32140fdb3/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/f435e8dc-375f-44be-8aba-49a32140fdb3/oauth2/v2.0/logout', 'claims_supported': ['sub', 'iss', 'cloud_instance_name', 'cloud_instance_host_name', 'cloud_graph_host_name', 'msgraph_host', 'aud', 'exp', 'iat', 'auth_time', 'acr', 'nonce', 'preferred_username', 'name', 'tid', 'ver', 'at_hash', 'c_hash', 'email'], 'kerberos_endpoint': 'https://login.microsoftonline.com/f435e8dc-375f-44be-8aba-49a32140fdb3/kerberos', 'tenant_region_scope': 'EU', 'cloud_instance_name': 'microsoftonline.com', 'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'} msal.application: Region to be used: None cli.azure.cli.core.util: azure.cli.core.util.handle_exception is called with an exception: cli.azure.cli.core.util: 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)

cli.azure.cli.core.azclierror: The command failed with an unexpected error. Here is the traceback: az_command_data_logger: The command failed with an unexpected error. Here is the traceback: cli.azure.cli.core.azclierror: 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) az_command_data_logger: 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 open an issue, please run: 'az feedback' cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x04D06808>] az_command_data_logger: exit code: 1 cli.main__: Command ran in 0.713 seconds (init: 0.356, invoke: 0.357) telemetry.main: Begin splitting cli events and extra events, total events: 1 telemetry.client: Accumulated 0 events. Flush the clients. telemetry.main: Finish splitting cli events and extra events, cli events: 1 telemetry.save: Save telemetry record of length 6651 in cache telemetry.check: Negative: The C:\Users\RobNotley.azure\telemetry.txt was modified at 2022-10-14 10:54:09.838550, which in less than 600.000000 s

Files

telemetry.txt

I can't upload JSON file as this isn't support but output of this is;

{ "alternate_directory_paths": null, "container_id": null, "container_uri": "VMAppContainer;Compute;rg-rndev-westeurope-dashworks-0f0f7c68;vm-rndev-sql-green-9f412f7b", "database_name": null, "filepath": null, "item_type": "SQL", "item_uri": "SQLDataBase;MSSQLSERVER;PM", "log_point_in_time": null, "recovery_mode": null, "recovery_point_id": "1847309172622175981", "restore_mode": "OriginalLocation", "source_resource_id": "/subscriptions/e64d6ed8-3ae2-4516-835c-1fc3df103568/resourceGroups/rg-rndev-westeurope-dashworks-0f0f7c68/providers/Microsoft.Compute/virtualMachines/vm-rndev-sql-green-9f412f7b", "workload_type": "SQLDataBase" }

robnotley commented 2 years ago

Cloud Shell through Azure Portal

PS /home/rob> $rc = az backup recoveryconfig show --resource-group "rg-rndev-westeurope-common-c799b2ce" --vault-name "rsv-rndev-f9161b42" --container-name "VMAppContainer;compute;rg-rndev-westeurope-dashworks-0f0f7c68;vm-rndev-sql-green-9f412f7b" --item-name "SQLDataBase;mssqlserver;pm" --restore-mode OriginalWorkloadRestore --rp-name 1847309172622175981 --target-item-name "SQLDataBase;mssqlserver;pm" --target-server-name "sql-green" --target-server-type SQLInstance --workload-type SQLDataBase --output json

PS /home/rob> $rc

{
"alternate_directory_paths": null,
"container_id": null,
"container_uri": "VMAppContainer;Compute;rg-rndev-westeurope-dashworks-0f0f7c68;vm-rndev-sql-green-9f412f7b", "database_name": null,
"filepath": null,
"item_type": "SQL", "item_uri": "SQLDataBase;MSSQLSERVER;PM", "log_point_in_time": null, "recovery_mode": null, "recovery_point_id": "1847309172622175981", "restore_mode": "OriginalLocation", "source_resource_id": "/subscriptions/e64d6ed8-3ae2-4516-835c-1fc3df103568/resourceGroups/rg-rndev-westeurope-dashworks-0f0f7c68/providers/Microsoft.Compute/virtualMachines/vm-rndev-sql-green-9f412f7b", "workload_type": "SQLDataBase" }

PS /home/rob> az backup restore restore-azurewl --resource-group "rg-rndev-westeurope-common-c799b2ce" --vault-name "rsv-rndev-f9161b42" --recovery-config $rc unrecognized arguments: alternate_directory_paths: null, container_id: null, container_uri: VMAppContainer;Compute;rg-rndev-westeurope-dashworks-0f0f7c68;vm-rndev-sql-green-9f412f7b, database_name: null, filepath: null, item_type: SQL, item_uri: SQLDataBase;MSSQLSERVER;PM, log_point_in_time: null, recovery_mode: null, recovery_point_id: 1847309172622175981, restore_mode: OriginalLocation, source_resource_id: /subscriptions/e64d6ed8-3ae2-4516-835c-1fc3df103568/resourceGroups/rg-rndev-westeurope-dashworks-0f0f7c68/providers/Microsoft.Compute/virtualMachines/vm-rndev-sql-green-9f412f7b, workload_type: SQLDataBase }

Examples from AI knowledge base: https://aka.ms/cli_ref Read more about the command in reference docs PS /home/rob> az backup restore restore-azurewl --resource-group "rg-rndev-westeurope-common-c799b2ce" --vault-name "rsv-rndev-f9161b42" --recovery-config $rc --debug cli.knack.cli: Command arguments: ['backup', 'restore', 'restore-azurewl', '--resource-group', 'rg-rndev-westeurope-common-c799b2ce', '--vault-name', 'rsv-rndev-f9161b42', '--recovery-config', '{', ' alternate_directory_paths: null,', ' container_id: null,', ' container_uri: VMAppContainer;Compute;rg-rndev-westeurope-dashworks-0f0f7c68;vm-rndev-sql-green-9f412f7b,', ' database_name: null,', ' filepath: null,', ' item_type: SQL,', ' item_uri: SQLDataBase;MSSQLSERVER;PM,', ' log_point_in_time: null,', ' recovery_mode: null,', ' recovery_point_id: 1847309172622175981,', ' restore_mode: OriginalLocation,', ' source_resource_id: /subscriptions/e64d6ed8-3ae2-4516-835c-1fc3df103568/resourceGroups/rg-rndev-westeurope-dashworks-0f0f7c68/providers/Microsoft.Compute/virtualMachines/vm-rndev-sql-green-9f412f7b,', ' workload_type: SQLDataBase', '}', '--debug'] cli.knack.cli: init debug log: Enable color in terminal. cli.knack.cli: Event: Cli.PreExecute [] cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7faf69814160>, <function OutputProducer.on_global_arguments at 0x7faf696d24c0>, <function CLIQuery.on_global_arguments at 0x7faf696d7a60>] cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate [] cli.azure.cli.core: Modules found from index for 'backup': ['azure.cli.command_modules.backup'] cli.azure.cli.core: Loading command modules: cli.azure.cli.core: Name Load Time Groups Commands cli.azure.cli.core: backup 0.004 16 58 cli.azure.cli.core: Total (1) 0.004 16 58 cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_next'] cli.azure.cli.core: Loading extensions: cli.azure.cli.core: Name Load Time Groups Commands Directory cli.azure.cli.core: ai-examples 0.136 1 1 /usr/lib/python3.9/site-packages/azure-cli-extensions/ai-examples cli.azure.cli.core: Total (1) 0.136 1 1
cli.azure.cli.core: Loaded 17 groups, 59 commands. cli.azure.cli.core: Found a match in the command table. cli.azure.cli.core: Raw command : backup restore restore-azurewl cli.azure.cli.core: Command table: backup restore restore-azurewl cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7faf68c5b9d0>] cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/rob/.azure/commands/2022-10-14.10-05-31.backup_restore_restore-azurewl.167.log'. az_command_data_logger: command args: backup restore restore-azurewl --resource-group {} --vault-name {} --recovery-config {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} --debug cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x7faf68c294c0>] cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad [] cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x7faf68bc5e50>, <function register_cache_arguments..add_cache_arguments at 0x7faf68bc5f70>] cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded [] cli.knack.cli: Event: CommandInvoker.OnPreParseArgs [] urllib3.connectionpool: Starting new HTTPS connection (1): app.aladdin.microsoft.com:443 urllib3.connectionpool: https://app.aladdin.microsoft.com:443 "GET /api/v1.0/suggestions?query=%7B%22command%22%3A+%22backup+restore+restore-azurewl%22%2C+%22parameters%22%3A+%22%22%7D&clientType=AzureCli&context=%7B%22versionNumber%22%3A+%222.40.0%22%2C+%22errorType%22%3A+%22UnrecognizedArguments%22%2C+%22correlationId%22%3A+%2252c6ec74-e78b-4c0a-ad87-da1044b4d0d4%22%2C+%22subscriptionId%22%3A+%22e64d6ed8-3ae2-4516-835c-1fc3df103568%22%2C+%22eventId%22%3A+%22e8880212-6404-4bf3-a803-b760d26e7886%22%7D HTTP/1.1" 200 None cli.azure.cli.core.azclierror: unrecognized arguments: alternate_directory_paths: null, container_id: null, container_uri: VMAppContainer;Compute;rg-rndev-westeurope-dashworks-0f0f7c68;vm-rndev-sql-green-9f412f7b, database_name: null, filepath: null, item_type: SQL, item_uri: SQLDataBase;MSSQLSERVER;PM, log_point_in_time: null, recovery_mode: null, recovery_point_id: 1847309172622175981, restore_mode: OriginalLocation, source_resource_id: /subscriptions/e64d6ed8-3ae2-4516-835c-1fc3df103568/resourceGroups/rg-rndev-westeurope-dashworks-0f0f7c68/providers/Microsoft.Compute/virtualMachines/vm-rndev-sql-green-9f412f7b, workload_type: SQLDataBase } az_command_data_logger: unrecognized arguments: alternate_directory_paths: null, container_id: null, container_uri: VMAppContainer;Compute;rg-rndev-westeurope-dashworks-0f0f7c68;vm-rndev-sql-green-9f412f7b, database_name: null, filepath: null, item_type: SQL, item_uri: SQLDataBase;MSSQLSERVER;PM, log_point_in_time: null, recovery_mode: null, recovery_point_id: 1847309172622175981, restore_mode: OriginalLocation, source_resource_id: /subscriptions/e64d6ed8-3ae2-4516-835c-1fc3df103568/resourceGroups/rg-rndev-westeurope-dashworks-0f0f7c68/providers/Microsoft.Compute/virtualMachines/vm-rndev-sql-green-9f412f7b, workload_type: SQLDataBase }

Examples from AI knowledge base: https://aka.ms/cli_ref Read more about the command in reference docs cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7faf68c5bc10>] az_command_data_logger: exit code: 2 cli.main: Command ran in 0.532 seconds (init: 0.123, invoke: 0.409) telemetry.main: Begin splitting cli events and extra events, total events: 1 telemetry.client: Accumulated 0 events. Flush the clients. telemetry.main: Finish splitting cli events and extra events, cli events: 1 telemetry.save: Save telemetry record of length 3926 in cache telemetry.check: Negative: The /home/rob/.azure/telemetry.txt was modified at 2022-10-14 10:02:30.794808, which in less than 600.000000 s

telemetry.txt

zubairabid commented 2 years ago

@robnotley can you save the JSON output manually into a file instead of using the > c:\github\recovery.json bit, and try the request with that file instead? It appears to be an file encoding issue with the way Powershell < 6 behaves, and not a CLI bug. You can check https://learn.microsoft.com/en-us/powershell/scripting/dev-cross-plat/vscode/understanding-file-encoding?view=powershell-7#configuring-powershell for more details if the workaround works for you.

zubairabid commented 9 months ago

@robnotley would you be able to confirm if this worked for you? If so, we can close this issue.