-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
Describe the bug
az webapp config snapshot restore is returning error "no resource group found" when trying to restore a snapshot backup to a paired region. This is required for DR scenarios, and is supported and working properly via Restore-AzWebAppSnapshot.
Steps
Using the cloud shell, create a rg in east us2, a webapp, and enable snapshot backups.
$sourceRg = 'app-rg'
$sourcePlanName = 'app-plan'
$sourceAppName = 'app-web'
$recoveryRegion = 'centralus'
az group create --name $targetRg --location $recoveryRegion
$sku = az appservice plan show --name $sourcePlanName --resource-group $sourceRg --query "sku.name" -o tsv
az appservice plan create --name $targetPlanName --resource-group $targetRg --location $recoveryRegion --sku $sku
az webapp create --name $targetAppName --plan $targetPlanName --resource-group $targetRg
restore the most recent snapshot
$snapshots = az webapp config snapshot list --name $sourceAppName --resource-group $sourceRg | ConvertFrom-Json -DateKind String
az webapp config snapshot restore -g $targetRg -n $targetAppName --source-name $sourceAppName --source-resource-group $sourceRg --time $snapshots[0].time --debug
BUG:
Portal returns error: Operation returned an invalid status 'Not Found'
EXPECTED:
No error, and snapshot is restored to target Web App
Related command
az webapp config snapshot restore -g $targetRg -n $targetAppName --source-name $sourceAppName --source-resource-group $sourceRg --time $snapshots[0].time
Errors
Operation returned an invalid status 'Not Found'
Issue script & Debug output
az webapp config snapshot restore -g $targetRg -n $targetAppName --source-name $sourceAppName --source-resource-group $sourceRg --time $snapshots[0].time --debug
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: {"Code":"NotFound","Message":"Cannot find ResourceGroup with name [redacted].","Target":null,"Details":[{"Message":"Cannot find ResourceGroup with name [redacted]."},{"Code":"NotFound"},{"ErrorEntity":{"ExtendedCode":"51004","MessageTemplate":"Cannot find {0} with name {1}.","Parameters":["ResourceGroup","[redacted]"],"Code":"NotFound","Message":"Cannot find ResourceGroup with name [redacted]."}}],"Innererror":null}
cli.azure.cli.core.azclierror: Traceback (most recent call last):
File "/usr/lib64/az/lib/python3.9/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 666, in execute
raise ex
File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 734, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 703, in _run_job
result = cmd_copy(params)
File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/init.py", line 336, in call
return self.handler(*args, **kwargs)
File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/core/commands/command_operation.py", line 120, in handler
return op(**command_args)
File "/usr/lib64/az/lib/python3.9/site-packages/azure/cli/command_modules/appservice/custom.py", line 2996, in restore_snapshot
return client.web_apps.begin_restore_snapshot(resource_group_name, name, request)
File "/usr/lib64/az/lib/python3.9/site-packages/azure/core/tracing/decorator.py", line 94, in wrapper_use_tracer
return func(*args, **kwargs)
File "/usr/lib64/az/lib/python3.9/site-packages/azure/mgmt/web/v2023_01_01/operations/_web_apps_operations.py", line 33595, in begin_restore_snapshot
raw_result = self._restore_snapshot_initial( # type: ignore
File "/usr/lib64/az/lib/python3.9/site-packages/azure/mgmt/web/v2023_01_01/operations/_web_apps_operations.py", line 33465, in _restore_snapshot_initial
map_error(status_code=response.status_code, response=response, error_map=error_map)
File "/usr/lib64/az/lib/python3.9/site-packages/azure/core/exceptions.py", line 161, in map_error
raise error
azure.core.exceptions.ResourceNotFoundError: Operation returned an invalid status 'Not Found'
Content: {"Code":"NotFound","Message":"Cannot find ResourceGroup with name [redacted].","Target":null,"Details":[{"Message":"Cannot find ResourceGroup with name [redacted]."},{"Code":"NotFound"},{"ErrorEntity":{"ExtendedCode":"51004","MessageTemplate":"Cannot find {0} with name {1}.","Parameters":["ResourceGroup","[redacted]"],"Code":"NotFound","Message":"Cannot find ResourceGroup with name [redacted]."}}],"Innererror":null}
Expected behavior
No error, and snapshot is restored to target Web App
Environment Summary
azure-cli 2.69.0
core 2.69.0
telemetry 1.1.0
Extensions:
ai-examples 0.2.5
ml 2.34.0
ssh 2.0.6
Dependencies:
msal 1.31.2b1
azure-mgmt-resource 23.1.1
Python location '/usr/bin/python3.9'
Config directory '/home/chris/.azure'
Extensions directory '/home/chris/.azure/cliextensions'
Extensions system directory '/usr/lib/python3.9/site-packages/azure-cli-extensions'
Python (Linux) 3.9.19 (main, Dec 18 2024, 20:53:49)
[GCC 11.2.0]
Legal docs and information: aka.ms/AzureCliLegal
Additional context
This works when using Restore-AzWebAppSnapshot