deployment sub create --name {} --location {} --template-file {} --parameters {} {} --no-wait
Result: Failure Exception: CLIError: Object of type JsonCTemplate is not JSON serializable Stack: File "/azure-functions-host/workers/python/3.8/LINUX/X64/azure_functions_worker/dispatcher.py",
line 407, in _handle__invocation_request call_result = await self._loop.run_in_executor( File "/usr/local/lib/python3.8/concurrent/futures/thread.py",
line 57, in run result = self.fn(*self.args, **self.kwargs) File "/azure-functions-host/workers/python/3.8/LINUX/X64/azure_functions_worker/dispatcher.py",
line 649, in _run_sync_func return ExtensionManager.get_sync_invocation_wrapper(context, File "/azure-functions-host/workers/python/3.8/LINUX/X64/azure_functions_worker/extension.py",
line 215, in _raw_invocation_wrapper result = function(**args) File "/home/site/wwwroot/Post_StartBicep/__init__.py",
line 36, in main data = start_bicep(location, params) File "/home/site/wwwroot/Post_StartBicep/__init__.py", line 13, in start_bicep response = az_cli(cliCommands) File "/home/site/wwwroot/shared_code/az_cli.py",
line 14, in az_cli raise cli.result.error File "/home/site/wwwroot/.python_packages/lib/site-packages/knack/cli.py",
line 231, in invoke cmd_result = self.invocation.execute(args) File "/home/site/wwwroot/.python_packages/lib/site-packages/azure/cli/core/commands/__init__.py",
line 658, in execute raise ex File "/home/site/wwwroot/.python_packages/lib/site-packages/azure/cli/core/commands/__init__.py",
line 721, in _run_jobs_serially results.append(self._run_job(expanded_arg, cmd_copy)) File "/home/site/wwwroot/.python_packages/lib/site-packages/azure/cli/core/commands/__init__.py",
line 713, in _run_job return cmd_copy.exception_handler(ex) File "/home/site/wwwroot/.python_packages/lib/site-packages/azure/cli/core/commands/arm.py",
line 114, in handle_template_based_exception raise CLIError(ex)
My bicep template should create a resource group to Azure.
Related command
deployment sub create --name {} --location {} --template-file {} --parameters {} {} --no-wait
Describe the bug
I have an Azure Functionapp that runs python code where I call az cli with above command. The function works locally, but when I run it in Functionapp, I get an error message saying 'Object of type JsonCTemplate is not JSON serializable'.
Expected behavior
My bicep template should create a resource group to Azure.
Environment summary
az cli called through python function to deploy resources using Bicep template.
Functionapp configuration: