About the error
This error is an Python error throws out by Azure CLI. The complete error may look like the following:
During handling of the above exception, another exception occurred: 236 237Traceback (most recent call last): 238 File "/opt/az/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke 239 cmd_result = self.invocation.execute(args) 240 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 241 File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 666, in execute 242 raise ex 243 File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 734, in _run_jobs_serially 244 results.append(self._run_job(expanded_arg, cmd_copy)) 245 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 246 File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_job 247 return cmd_copy.exception_handler(ex) 248 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 249 File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/arm.py", line 114, in handle_template_based_exception 250 raise CLIError(ex) 251knack.util.CLIError: The content for this response was already consumed
Root cause
This error occurs generally when you have syntax errors in your ARM template or Bicep code. By looking into the error only, it is very difficult to identity the root cause.
Solution
To find out the the root cause, simply add --debug
option to your CLI. In this way, you will be able to identity the actual root error and get it fixed.
Example command
az deployment group create \
--name "$DEPLOYMENT_NAME" \
--resource-group "$RG_NAME" \
--template-file "main.bicep" \
--debug
Once you find out the root cause, fix it accordingly:
Message: The template deployment '***' is not valid according to the validation procedure. The tracking id is '***'. See inner errors for details.