I'm attempting to create an Azure Container app using the CLI (az containerapp create), but the command is not recognizing the arguments (--args) provided.
Reference for the command: #az-containerapp-create
Error attempt 1:
az containerapp create \
::
::
--command "celery" \
--args "-A", "gagenerator.celery.celery", "worker", "--loglevel=INFO", "-P", "threads"
unrecognized arguments: -A, gagenerator.celery.celery, worker, --loglevel=INFO, -P, threads
Error attempt 2:
az containerapp create \
::
::
--command "celery" \
--args "-A" "gagenerator.celery.celery" "worker" "--loglevel=INFO" "-P" "threads"
unrecognized arguments: -A gagenerator.celery.celery worker --loglevel=INFO -P threads
I'm able to create the app using UI:
I'm attempting to create an Azure Container app using the CLI (az containerapp create), but the command is not recognizing the arguments (--args) provided.
Reference for the command: https://learn.microsoft/en-us/cli/azure/containerapp?view=azure-cli-latest#az-containerapp-create
Error attempt 1:
az containerapp create \
::
::
--command "celery" \
--args "-A", "gagenerator.celery.celery", "worker", "--loglevel=INFO", "-P", "threads"
unrecognized arguments: -A, gagenerator.celery.celery, worker, --loglevel=INFO, -P, threads
Error attempt 2:
az containerapp create \
::
::
--command "celery" \
--args "-A" "gagenerator.celery.celery" "worker" "--loglevel=INFO" "-P" "threads"
unrecognized arguments: -A gagenerator.celery.celery worker --loglevel=INFO -P threads
I'm able to create the app using UI:
Share Improve this question asked Mar 21 at 1:21 Thiago ScodelerThiago Scodeler 3371 silver badge14 bronze badges 1 |1 Answer
Reset to default 0The error you're facing is because,
- In
attempt 1
, you used comma-separated values for--args
, which the Azure CLI does not support. - In
attempt 2
arguments are provided separately without being enclosed in a string or a JSON array.
az containerapp create
command expects either a single space-separated string
containing all arguments or a JSON-style array
with each argument as a separate string.
So, replace your current command with,
- Space-separated string format:
az containerapp create \
--name <container-app> \
--resource-group <resource-group> \
--image <container-image> \
--command "celery" \
--args "-A gagenerator.celery.celery worker --loglevel=INFO -P threads"
- JSON array format:
az containerapp create \
--name <container-app> \
--resource-group <resource-group> \
--image <container-image> \
--command "celery" \
--args '["-A", "gagenerator.celery.celery", "worker", "--loglevel=INFO", "-P", "threads"]'
Please refer this Msdoc for better understanding of commands format.
--args
parameter inaz containerapp create
should be passed as a single space-separated string or multiple arguments enclosed in square brackets ([]
). So use:--args '["-A", "gagenerator.celery.celery", "worker", "--loglevel=INFO", "-P", "threads"]'
– Sirra Sneha Commented Mar 21 at 4:12