azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

{"error":{"code":"DeploymentNotFound","message":"Deployment 'deploymentName-***' could not be found."}}

Open backwind1233 opened this issue 2 years ago • 17 comments

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

  1. Download and Unzip the file: test_guid.bicep.zip, you will get test_guid.bicep

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

    Step-2 ---------------------------------------------------------

    az group delete --name $RESOURCE_GROUP --yes 
    

    Step-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..add_subscription_parameter at 0x105d58550>] cli.knack.commands: Configured default 'rg-aks' for arg resource_group_name cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad [] cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x105d5ae60>, <function register_cache_arguments..add_cache_arguments at 0x105d5af80>] cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded [] cli.knack.cli: Event: CommandInvoker.OnPreParseArgs [] cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x104a41b40>, <function CLIQuery.handle_query_parameter at 0x104e6ae60>, <function register_ids_argument..parse_ids_arguments at 0x105d5aef0>] cli.azure.cli.command_modules.resource._bicep: Current value of "use_binary_from_path": false. cli.azure.cli.command_modules.resource._bicep: Bicep CLI installation path: /Users/backwind1233/.azure/bin/bicep cli.azure.cli.command_modules.resource._bicep: Bicep CLI installed: True. urllib3.connectionpool: Starting new HTTPS connection (1): aka.ms:443 urllib3.connectionpool: https://aka.ms:443 "GET /BicepLatestRelease HTTP/1.1" 301 0 urllib3.connectionpool: Starting new HTTPS connection (1): downloads.bicep.azure.com:443 urllib3.connectionpool: https://downloads.bicep.azure.com:443 "GET /releases/latest HTTP/1.1" 200 36279 cli.azure.cli.command_modules.resource._bicep: A new Bicep release is available: v0.26.170. Upgrade now by running "az bicep upgrade". cli.azure.cli.core.commands.client_factory: Getting management service client client_type=ResourceManagementClient cli.azure.cli.core.auth.persistence: build_persistence: location='/Users/backwind1233/.azure/msal_token_cache.json', encrypt=False cli.azure.cli.core.auth.binary_cache: load: /Users/backwind1233/.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/28fbd091-25d8-4f39-b23d-aa4405e040ba/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/28fbd091-25d8-4f39-b23d-aa4405e040ba/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/28fbd091-25d8-4f39-b23d-aa4405e040ba/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/28fbd091-25d8-4f39-b23d-aa4405e040ba/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/28fbd091-25d8-4f39-b23d-aa4405e040ba/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/28fbd091-25d8-4f39-b23d-aa4405e040ba/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/28fbd091-25d8-4f39-b23d-aa4405e040ba/kerberos', 'tenant_region_scope': 'AS', '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: Broker enabled? None cli.azure.cli.core.auth.credential_adaptor: CredentialAdaptor.get_token: scopes=('https://management.core.windows.net//.default',), kwargs={} cli.azure.cli.core.auth.msal_authentication: UserCredential.get_token: scopes=('https://management.core.windows.net//.default',), claims=None, kwargs={} msal.application: Cache hit an AT msal.telemetry: Generate or reuse correlation_id: cb4d80b7-8357-48f8-851b-91c2d2b17bfa cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions//resourcegroups/test-resource-group-1714056289/providers/Microsoft.Resources/deployments/deploymentName-1714056289westus/validate?api-version=2022-09-01' cli.azure.cli.core.sdk.policies: Request method: 'POST' cli.azure.cli.core.sdk.policies: Request headers: cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json' cli.azure.cli.core.sdk.policies: 'Content-Length': '926' cli.azure.cli.core.sdk.policies: 'Accept': 'application/json' cli.azure.cli.core.sdk.policies: 'x-ms-client-request-id': 'c76bb822-0312-11ef-8e7e-9a48581aa92c' cli.azure.cli.core.sdk.policies: 'CommandName': 'deployment group create' cli.azure.cli.core.sdk.policies: 'ParameterSetName': '--name -f -g --debug' cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.59.0 (PIP) azsdk-python-core/1.28.0 Python/3.10.14 (macOS-14.4-arm64-arm-64bit)' cli.azure.cli.core.sdk.policies: 'Authorization': '' cli.azure.cli.core.sdk.policies: Request body: cli.azure.cli.core.sdk.policies: {"properties": {"template": "{\n "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",\n "contentVersion": "1.0.0.0",\n "metadata": {\n "_generator": {\n "name": "bicep",\n "version": "0.22.6.54827",\n "templateHash": "1501688143036687448"\n }\n },\n "parameters": {\n "guidValue": {\n "type": "string",\n "defaultValue": "[newGuid()]"\n }\n },\n "variables": {\n "name_deployment": "[format('deployment-{0}', substring(uniqueString(parameters('guidValue')), 0, 5))]"\n },\n "resources": [],\n "outputs": {\n "output_name_value": {\n "type": "string",\n "value": "[variables('name_deployment')]"\n },\n "guidValue_value": {\n "type": "string",\n "value": "[parameters('guidValue')]"\n }\n }\n}", "parameters": {}, "mode": "Incremental"}} cli.azure.cli.command_modules.resource.custom: HTTP content is being overwritten to preserve template whitepace accurately. The request body logging may not accurately represent this. urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443 urllib3.connectionpool: https://management.azure.com:443 "POST /subscriptions//resourcegroups/test-resource-group-1714056289/providers/Microsoft.Resources/deployments/deploymentName-1714056289westus/validate?api-version=2022-09-01 HTTP/1.1" 200 624 cli.azure.cli.core.sdk.policies: Response status: 200 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': '624' 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-ratelimit-remaining-subscription-writes': '1199' cli.azure.cli.core.sdk.policies: 'x-ms-request-id': '2fcc8df6-83aa-45c7-9215-ac3d07474f81' cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': '2fcc8df6-83aa-45c7-9215-ac3d07474f81' cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': 'EASTASIA:20240425T144757Z:2fcc8df6-83aa-45c7-9215-ac3d07474f81' 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: 9D4C7F36093F4775AAAB1917C0D420CD Ref B: SEL221051503009 Ref C: 2024-04-25T14:47:55Z' cli.azure.cli.core.sdk.policies: 'Date': 'Thu, 25 Apr 2024 14:47:57 GMT' cli.azure.cli.core.sdk.policies: Response content: cli.azure.cli.core.sdk.policies: {"id":"/subscriptions//resourceGroups/test-resource-group-1714056289/providers/Microsoft.Resources/deployments/deploymentName-1714056289westus","name":"deploymentName-1714056289westus","type":"Microsoft.Resources/deployments","properties":{"templateHash":"1501688143036687448","parameters":{"guidValue":{"type":"String","value":"07418d61-7d85-4d89-934d-590702bf6b92"}},"mode":"Incremental","provisioningState":"Succeeded","timestamp":"0001-01-01T00:00:00Z","duration":"PT0S","correlationId":"2fcc8df6-83aa-45c7-9215-ac3d07474f81","providers":[],"dependencies":[],"validatedResources":[]}} cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions//resourcegroups/test-resource-group-1714056289/providers/Microsoft.Resources/deployments/deploymentName-1714056289westus?api-version=2022-09-01' cli.azure.cli.core.sdk.policies: Request method: 'PUT' cli.azure.cli.core.sdk.policies: Request headers: cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json' cli.azure.cli.core.sdk.policies: 'Content-Length': '926' cli.azure.cli.core.sdk.policies: 'Accept': 'application/json' cli.azure.cli.core.sdk.policies: 'x-ms-client-request-id': 'c76bb822-0312-11ef-8e7e-9a48581aa92c' cli.azure.cli.core.sdk.policies: 'CommandName': 'deployment group create' cli.azure.cli.core.sdk.policies: 'ParameterSetName': '--name -f -g --debug' cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.59.0 (PIP) azsdk-python-core/1.28.0 Python/3.10.14 (macOS-14.4-arm64-arm-64bit)' cli.azure.cli.core.sdk.policies: 'Authorization': '' cli.azure.cli.core.sdk.policies: Request body: cli.azure.cli.core.sdk.policies: {"properties": {"template": "{\n "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",\n "contentVersion": "1.0.0.0",\n "metadata": {\n "_generator": {\n "name": "bicep",\n "version": "0.22.6.54827",\n "templateHash": "1501688143036687448"\n }\n },\n "parameters": {\n "guidValue": {\n "type": "string",\n "defaultValue": "[newGuid()]"\n }\n },\n "variables": {\n "name_deployment": "[format('deployment-{0}', substring(uniqueString(parameters('guidValue')), 0, 5))]"\n },\n "resources": [],\n "outputs": {\n "output_name_value": {\n "type": "string",\n "value": "[variables('name_deployment')]"\n },\n "guidValue_value": {\n "type": "string",\n "value": "[parameters('guidValue')]"\n }\n }\n}", "parameters": {}, "mode": "Incremental"}} cli.azure.cli.command_modules.resource.custom: HTTP content is being overwritten to preserve template whitepace accurately. The request body logging may not accurately represent this. urllib3.connectionpool: https://management.azure.com:443 "PUT /subscriptions//resourcegroups/test-resource-group-1714056289/providers/Microsoft.Resources/deployments/deploymentName-1714056289westus?api-version=2022-09-01 HTTP/1.1" 201 614 cli.azure.cli.core.sdk.policies: Response status: 201 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': '614' 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: 'Azure-AsyncOperation': 'https://management.azure.com/subscriptions//resourcegroups/test-resource-group-1714056289/providers/Microsoft.Resources/deployments/deploymentName-1714056289westus/operationStatuses/08584875504054618138?api-version=2022-09-01' cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-writes': '1199' cli.azure.cli.core.sdk.policies: 'x-ms-request-id': 'a57bfd58-d52d-4a64-8b1d-39eb86829bcf' cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': 'a57bfd58-d52d-4a64-8b1d-39eb86829bcf' cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': 'EASTASIA:20240425T144802Z:a57bfd58-d52d-4a64-8b1d-39eb86829bcf' 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: 42FC6E6BBD854431BDD8BBC9840D6DDF Ref B: SEL221051503009 Ref C: 2024-04-25T14:47:58Z' cli.azure.cli.core.sdk.policies: 'Date': 'Thu, 25 Apr 2024 14:48:01 GMT' cli.azure.cli.core.sdk.policies: Response content: cli.azure.cli.core.sdk.policies: {"id":"/subscriptions//resourceGroups/test-resource-group-1714056289/providers/Microsoft.Resources/deployments/deploymentName-1714056289westus","name":"deploymentName-1714056289westus","type":"Microsoft.Resources/deployments","properties":{"templateHash":"1501688143036687448","parameters":{"guidValue":{"type":"String","value":"2bb4fde9-6d49-449b-8210-912c6aa4bb03"}},"mode":"Incremental","provisioningState":"Accepted","timestamp":"2024-04-25T14:48:01.085805Z","duration":"PT0.0008479S","correlationId":"a57bfd58-d52d-4a64-8b1d-39eb86829bcf","providers":[],"dependencies":[]}} cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions//resourcegroups/test-resource-group-1714056289/providers/Microsoft.Resources/deployments/deploymentName-1714056289westus/operationStatuses/08584875504054618138?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': 'c76bb822-0312-11ef-8e7e-9a48581aa92c' cli.azure.cli.core.sdk.policies: 'CommandName': 'deployment group create' cli.azure.cli.core.sdk.policies: 'ParameterSetName': '--name -f -g --debug' cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.59.0 (PIP) azsdk-python-core/1.28.0 Python/3.10.14 (macOS-14.4-arm64-arm-64bit)' 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/*/resourcegroups/test-resource-group-1714056289/providers/Microsoft.Resources/deployments/deploymentName-1714056289westus/operationStatuses/08584875504054618138?api-version=2022-09-01 HTTP/1.1" 404 116 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': '116' 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': '11999' cli.azure.cli.core.sdk.policies: 'x-ms-request-id': '01f21855-45a7-4191-bd45-5e5563eaa14f' cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': '01f21855-45a7-4191-bd45-5e5563eaa14f' cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': 'EASTASIA:20240425T144802Z:01f21855-45a7-4191-bd45-5e5563eaa14f' 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: C036B2D3BEDA4B7F8366CBEE8135D054 Ref B: SEL221051503009 Ref C: 2024-04-25T14:48:02Z' cli.azure.cli.core.sdk.policies: 'Date': 'Thu, 25 Apr 2024 14:48:02 GMT' cli.azure.cli.core.sdk.policies: Response content: cli.azure.cli.core.sdk.policies: {"error":{"code":"DeploymentNotFound","message":"Deployment 'deploymentName-1714056289westus' could not be found."}} cli.azure.cli.core.azclierror: Traceback (most recent call last): File "/opt/homebrew/lib/python3.10/site-packages/azure/core/polling/base_polling.py", line 730, in run self._poll() File "/opt/homebrew/lib/python3.10/site-packages/azure/core/polling/base_polling.py", line 756, in _poll self.update_status() File "/opt/homebrew/lib/python3.10/site-packages/azure/core/polling/base_polling.py", line 782, in update_status _raise_if_bad_http_status_and_method(self._pipeline_response.http_response) File "/opt/homebrew/lib/python3.10/site-packages/azure/core/polling/base_polling.py", line 156, in _raise_if_bad_http_status_and_method raise BadStatus("Invalid return status {!r} for {!r} operation".format(code, response.request.method)) azure.core.polling.base_polling.BadStatus: Invalid return status 404 for 'GET' operation

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

backwind1233 avatar Apr 25 '24 14:04 backwind1233

Thank you for opening this issue, we will look into it.

yonzhan avatar Apr 25 '24 14:04 yonzhan

Any updates?

backwind1233 avatar Apr 29 '24 04:04 backwind1233

Is there any updates here please?

backwind1233 avatar May 13 '24 10:05 backwind1233

I also have this problem in eastus!

nickamckenna avatar May 28 '24 14:05 nickamckenna

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

jiasli avatar Jun 20 '24 12:06 jiasli

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

zhoxing-ms avatar Jun 21 '24 02:06 zhoxing-ms

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

garrettlondon1 avatar Dec 17 '24 02:12 garrettlondon1

I have also started seeing this issue intermittently in Australia East and Australia South East

kiwipiet avatar Nov 26 '25 21:11 kiwipiet

Seeing the same issue in West Europe now... Any progress on this matter?

Irixs-Kornelis avatar Dec 15 '25 16:12 Irixs-Kornelis

Any updates ?

takekazuomi avatar Jan 15 '26 09:01 takekazuomi

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?

rogerwhybrow avatar Feb 02 '26 03:02 rogerwhybrow

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:

  1. the correlation ID (it's in the --debug output / the error response),
  2. the approximate UTC timestamp, and
  3. 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 ?

torreymicrosoft avatar Jun 09 '26 17:06 torreymicrosoft

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

rogerwhybrow avatar Jun 10 '26 08:06 rogerwhybrow

Thanks @rogerwhybrow! @snarkywolverine can we take a look at this?

torreymicrosoft avatar Jul 07 '26 19:07 torreymicrosoft

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.

torreymicrosoft avatar Jul 09 '26 16:07 torreymicrosoft

Thanks @torreymicrosoft, do we have any updates on this one?

rogerwhybrow avatar Sep 10 '26 01:09 rogerwhybrow

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

torreymicrosoft avatar Sep 14 '26 16:09 torreymicrosoft