{"error":{"code":"DeploymentNotFound","message":"Deployment 'deploymentName-***' could not be found."}}
Describe the bug
The Azure Cli output "{"error":{"code":"DeploymentNotFound","message":"Deployment 'deploymentName-***' could not be found."}}"
but actually it has deployed successfully, and when I check in the Azure Portal, there is no error.
How to reproduce
-
Download and Unzip the file: test_guid.bicep.zip, you will get
test_guid.bicep -
Run following steps from Step-1 to Step-3
Step-1 ---------------------------------------------------------
export RESOURCE_GROUP=test-resource-group-$(date +%s) export deploymentName=deploymentName-$(date +%s) az group create --name $RESOURCE_GROUP -l eastus az deployment group create --name ${deploymentName}eastus -f test_guid.bicep -g $RESOURCE_GROUPStep-2 ---------------------------------------------------------
az group delete --name $RESOURCE_GROUP --yesStep-3 ---------------------------------------------------------
az group create --name $RESOURCE_GROUP -l westus az deployment group create --name ${deploymentName}westus -f test_guid.bicep -g $RESOURCE_GROUP --debug
Related command
NA
Errors
{"error":{"code":"DeploymentNotFound","message":"Deployment 'deploymentName-***' could not be found."}}
Issue script & Debug output
cli.knack.cli: Command arguments: ['deployment', 'group', 'create', '--name', 'deploymentName-1714056289westus', '-f', 'test_guid.bicep', '-g', 'test-resource-group-1714056289', '--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 0x1048eb9a0>, <function OutputProducer.on_global_arguments at 0x104a41ab0>, <function CLIQuery.on_global_arguments at 0x104e6add0>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'deployment': ['azure.cli.command_modules.resource']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name Load Time Groups Commands
cli.azure.cli.core: resource 0.111 51 228
cli.azure.cli.core: Total (1) 0.111 51 228
cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next']
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name Load Time Groups Commands Directory
cli.azure.cli.core: Total (0) 0.000 0 0
cli.azure.cli.core: Loaded 51 groups, 228 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : deployment group create
cli.azure.cli.core: Command table: deployment group create
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x105c9b9a0>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/Users/backwind1233/.azure/commands/2024-04-25.22-47-46.deployment_group_create.99220.log'.
az_command_data_logger: command args: deployment group create --name {} -f {} -g {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/opt/homebrew/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 712, in _run_job result = LongRunningOperation(cmd_copy.cli_ctx, 'Starting {}'.format(cmd_copy.name))(result) File "/opt/homebrew/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 1048, in call raise exception File "/opt/homebrew/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 1035, in call result = poller.result() File "/opt/homebrew/lib/python3.10/site-packages/azure/core/polling/_poller.py", line 242, in result self.wait(timeout) File "/opt/homebrew/lib/python3.10/site-packages/azure/core/tracing/decorator.py", line 76, in wrapper_use_tracer return func(*args, **kwargs) File "/opt/homebrew/lib/python3.10/site-packages/azure/core/polling/_poller.py", line 261, in wait raise self._exception # type: ignore File "/opt/homebrew/lib/python3.10/site-packages/azure/core/polling/_poller.py", line 176, in _start self._polling_method.run() File "/opt/homebrew/lib/python3.10/site-packages/azure/core/polling/base_polling.py", line 734, in run raise HttpResponseError(response=self._pipeline_response.http_response, error=err) from err azure.core.exceptions.HttpResponseError: (DeploymentNotFound) Deployment 'deploymentName-1714056289westus' could not be found. Code: DeploymentNotFound Message: Deployment 'deploymentName-1714056289westus' could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/opt/homebrew/lib/python3.10/site-packages/azure/cli/core/commands/arm.py", line 109, in handle_template_based_exception raise CLIError(ex.inner_exception.error.message) AttributeError: 'BadStatus' object has no attribute 'error'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/opt/homebrew/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke cmd_result = self.invocation.execute(args) File "/opt/homebrew/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 664, in execute raise ex File "/opt/homebrew/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 731, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) File "/opt/homebrew/lib/python3.10/site-packages/azure/cli/core/commands/init.py", line 723, in _run_job return cmd_copy.exception_handler(ex) File "/opt/homebrew/lib/python3.10/site-packages/azure/cli/core/commands/arm.py", line 112, in handle_template_based_exception raise_subdivision_deployment_error(ex.response.internal_response.text, ex.error.code if ex.error else None) File "/opt/homebrew/lib/python3.10/site-packages/azure/cli/core/commands/arm.py", line 104, in raise_subdivision_deployment_error raise DeploymentError(error_message) azure.cli.core.azclierror.DeploymentError: {"error":{"code":"DeploymentNotFound","message":"Deployment 'deploymentName-1714056289westus' could not be found."}}
cli.azure.cli.core.azclierror: {"error":{"code":"DeploymentNotFound","message":"Deployment 'deploymentName-1714056289westus' could not be found."}} az_command_data_logger: {"error":{"code":"DeploymentNotFound","message":"Deployment 'deploymentName-1714056289westus' could not be found."}} cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x105c9bbe0>] az_command_data_logger: exit code: 1 cli.main: Command ran in 12.416 seconds (init: 0.136, invoke: 12.280) 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 3936 in cache telemetry.main: Begin creating telemetry upload process. telemetry.process: Creating upload process: "/opt/homebrew/opt/[email protected]/bin/python3.10 /opt/homebrew/lib/python3.10/site-packages/azure/cli/telemetry/init.py /Users/backwind1233/.azure" telemetry.process: Return from creating process telemetry.main: Finish creating telemetry upload process.
Expected behavior
Everything is ok.
Environment Summary
azure-cli 2.59.0
core 2.59.0 telemetry 1.1.0
Extensions: account 0.2.5 application-insights 1.2.1 containerapp 0.3.50 interactive 0.5.3 rdbms-connect 1.0.5 resource-graph 2.1.0 serviceconnector-passwordless 1.0.3 spring 1.21.0 spring-cloud 3.1.8
Dependencies: msal 1.27.0 azure-mgmt-resource 23.1.0b2
Python location '/opt/homebrew/opt/[email protected]/bin/python3.10' Extensions directory '/Users/backwind1233/.azure/cliextensions'
Python (Darwin) 3.10.14 (main, Mar 19 2024, 21:46:16) [Clang 15.0.0 (clang-1500.3.9.4)]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
Additional context
No response
Thank you for opening this issue, we will look into it.
Any updates?
Is there any updates here please?
I also have this problem in eastus!
I am having the same issue in westus. I am following https://azurearcjumpstart.com/azure_arc_jumpstart/azure_arc_servers/azure/azure_arm_template_win to perform some testing, and the GET request failed with 404:
> az deployment group create --resource-group Arc-Servers-Win-Demo --name arcwinsrvdemo --template-uri https://raw.githubusercontent.com/microsoft/azure_arc/main/azure_arc_servers_jumpstart/azure/windows/arm_template/azuredeploy.json --parameters azuredeploy.parameters.json --debug
...
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/Arc-Servers-Win-Demo/providers/Microsoft.Resources/deployments/arcwinsrvdemo/operationStatuses/08584827209803016684?api-version=2022-09-01'
cli.azure.cli.core.sdk.policies: Request method: 'GET'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies: 'x-ms-client-request-id': '261221cc-2eff-11ef-b124-1091d1f98a2a'
cli.azure.cli.core.sdk.policies: 'CommandName': 'deployment group create'
cli.azure.cli.core.sdk.policies: 'ParameterSetName': '--resource-group --name --template-uri --parameters --debug'
cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.61.0 (ZIP) azsdk-python-core/1.28.0 Python/3.11.8 (Windows-10-10.0.22631-SP0)'
cli.azure.cli.core.sdk.policies: 'Authorization': '*****'
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: This request has no body
urllib3.connectionpool: https://management.azure.com:443 "GET /subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourcegroups/Arc-Servers-Win-Demo/providers/Microsoft.Resources/deployments/arcwinsrvdemo/operationStatuses/08584827209803016684?api-version=2022-09-01 HTTP/1.1" 404 98
cli.azure.cli.core.sdk.policies: Response status: 404
cli.azure.cli.core.sdk.policies: Response headers:
cli.azure.cli.core.sdk.policies: 'Cache-Control': 'no-cache'
cli.azure.cli.core.sdk.policies: 'Pragma': 'no-cache'
cli.azure.cli.core.sdk.policies: 'Content-Length': '98'
cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json; charset=utf-8'
cli.azure.cli.core.sdk.policies: 'Expires': '-1'
cli.azure.cli.core.sdk.policies: 'x-ms-failure-cause': 'gateway'
cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-reads': '249'
cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-global-reads': '3749'
cli.azure.cli.core.sdk.policies: 'x-ms-request-id': '23f838eb-27a8-4ff4-80d6-d3f3e82dc36f'
cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': '23f838eb-27a8-4ff4-80d6-d3f3e82dc36f'
cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': 'SOUTHEASTASIA:20240620T121836Z:23f838eb-27a8-4ff4-80d6-d3f3e82dc36f'
cli.azure.cli.core.sdk.policies: 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
cli.azure.cli.core.sdk.policies: 'X-Content-Type-Options': 'nosniff'
cli.azure.cli.core.sdk.policies: 'X-Cache': 'CONFIG_NOCACHE'
cli.azure.cli.core.sdk.policies: 'X-MSEdge-Ref': 'Ref A: BC64ED3B38D7456FB21E869322D7DAE4 Ref B: MAA201060515033 Ref C: 2024-06-20T12:18:35Z'
cli.azure.cli.core.sdk.policies: 'Date': 'Thu, 20 Jun 2024 12:18:35 GMT'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: {"error":{"code":"DeploymentNotFound","message":"Deployment 'arcwinsrvdemo' could not be found."}}
azure.core.exceptions.HttpResponseError: (DeploymentNotFound) Deployment 'deploymentName-1714056289westus' could not be found. Code: DeploymentNotFound Message: Deployment 'deploymentName-1714056289westus' could not be found.
Due to the fact that the az deployment related CLI commands have not been updated for a long time, the unexpected error of 404 DeploymentNotFound was responsed by the REST service. Therefore, the ARM service team needs to help investigate the root cause of this error message.
@jorgecotillo Could you please help with this ARM deployment related issue? The impact of this issue seems to be widespread
Is there a result from this issue?
It seems if the bicep template first deploys XYZ resources under a certain deployment name "main"..
- Once you Remove YZ and only deploy X, bicep deployment fails but individual modules succeed
It is still looking for the old deployments not referenced in the new bicep templates once YZ are removed and failing the pipeline
I have also started seeing this issue intermittently in Australia East and Australia South East
Seeing the same issue in West Europe now... Any progress on this matter?
Any updates ?
This issue is also occurring intermittently in Australia East and Australia South East for us. It is exceptionally frustrating. Is there any update on this one please?
Thanks for your patience, and apologies for the long wait — this is being actively re-reviewed as an outstanding open issue for the ARM Deployments team.
Pulling the thread together: as @jiasli reproduced (June 2024) and @zhoxing-ms diagnosed, the failure is the polling GET on the deployment's operationStatuses returning 404 DeploymentNotFound, carrying x-ms-failure-cause: gateway, even though the deployment itself succeeds. That gateway failure-cause points at the ARM control-plane/gateway routing layer rather than the CLI — the CLI is faithfully reporting a 404 it got back from the service. Normal deployments poll to success fine, which fits the intermittent pattern you're all describing across regions (east/west US, Australia East/SE, West Europe).
Because it's intermittent and server-side, the team needs telemetry to chase it, and the only correlation ID in this thread is from 2024. For those of you hitting it recently — @rogerwhybrow, @takekazuomi, @Irixs-Kornelis, @kiwipiet — could you share, for a recent failure:
- the correlation ID (it's in the
--debugoutput / the error response), - the approximate UTC timestamp, and
- the region.
That lets us look up exactly what the gateway did on those requests. Keeping this issue open so we can have recent telemetry to be able to repro and investigate. Please reach out if a correlation ID is available.
@rogerwhybrow @takekazuomi @Irixs-Kornelis ?
Thanks Torrey, I was able to replicate this issue on the 5th of June 2026 with the --debug flag enabled. Please find detailed below the requested diagnostics:
- x-ms-correlation-request-id: 8c1f24c3-f07b-424f-a606-dc14b89a6e4e
- UTC Timestamp: 2026-06-05T02:09:37.6465942Z
- location: australiasoutheast
Thanks @rogerwhybrow! @snarkywolverine can we take a look at this?
Thanks all for the continued reports, and for your patience - here's a real update now that we've been able to dig into the service side.
What's happening. When az deployment group create starts a deployment it gets back an Azure-AsyncOperation URL and polls it - the .../deployments/{name}/operationStatuses/{id} endpoint - until the operation reaches a terminal state. Intermittently that poll comes back 404 DeploymentNotFound with x-ms-failure-cause: gateway, even though the deployment itself succeeds (as several of you confirmed in the portal). The CLI is faithfully surfacing a 404 it received from the service, so this isn't a CLI defect - it's on the ARM deployments service side, and in principle any client that polls the async-operation URL (CLI, SDKs, PowerShell) can hit it.
Root cause. The operation-status resource that clients poll is currently modeled as a child of the deployment resource. That leaves a small race where the poll can resolve to a 404 during the deployment's lifecycle even though the deployment provisioned successfully, which lines up with the intermittent, cross-region pattern you're all describing (eastus, West Europe, Australia East/Southeast, and others).
Where the fix lives. This is a change that would involve re-modeling that operation-status resource so the race can't occur rather than anything in the CLI. I don't have a firm public date to share yet, so I'm keeping this issue open and will update it here as that progresses.
Big thanks to @jiasli for the clean repro, @zhoxing-ms for the earlier hand-off, and @rogerwhybrow for the recent correlation ID - that's exactly what we needed to line this up with our telemetry. If anyone hits it again, the most useful things to drop here are the correlation ID, the approximate UTC timestamp, and the region of the failed poll.
@rogerwhybrow @takekazuomi @Irixs-Kornelis @kiwipiet - appreciate the patience; I'll report back here as this moves.
Thanks @torreymicrosoft, do we have any updates on this one?
Thanks @torreymicrosoft, do we have any updates on this one?
Hi Roger! No updates, this is currently not actively being worked on, but it is being tracked, thus I can't provide a current ETA.
If you have a timely use-case that would assist with our prioritization, I would definitely be interested in understanding it more if you are able to provide details!
Thanks!
Torrey