最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to use args parameter with Azure Container App create CLI command? - Stack Overflow

programmeradmin4浏览0评论

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
  • The --args parameter in az 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
Add a comment  | 

1 Answer 1

Reset to default 0

The 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 arraywith each argument as a separate string.

So, replace your current command with,

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

发布评论

评论列表(0)

  1. 暂无评论