Skip to content

"az containerapp job start" with "env-vars" doesn't workΒ #27023

@TiloGit

Description

@TiloGit

Describe the bug

Try to set env-vars during start but it doesn't work. It has no effect and just starts with the job definition.

Related command

how to reproduce:

########create Azure Job
jobname="test-job-issue-with-env-var-11"
az containerapp job create \
    --name $jobname --resource-group $vfresgroup  --environment "managedEnvironment-vfpgrg101-b5a2" \
    --replica-timeout 1800 --replica-retry-limit 1 --replica-completion-count 1 --parallelism 1 \
    --trigger-type "Manual" \
    --image "mcr.microsoft.com/mcr/hello-world" \
    --cpu ".25" --memory "0.5Gi" \
	--env-vars "MYTEST=9" 
##start job
az containerapp job start -n $jobname -g $vfresgroup

########Start with different env var. 
##with different value
az containerapp job start -n $jobname -g $vfresgroup --env-vars "VF_DURATION=14"
##with new env var
az containerapp job start -n $jobname -g $vfresgroup --env-vars "NEW_VAR=MyVar123"
##expected to see different value/new value but nothing. 
az containerapp job execution list -n $jobname -g $vfresgroup -o yaml

Errors

no error, just doesn't work.

Issue script & Debug output

tilo@TSDell7k:/mnt/c/temp/tso-share$ az containerapp job start -n $jobname -g $vfresgroup --env-vars "VF_DURATION=14" --debug
cli.knack.cli: Command arguments: ['containerapp', 'job', 'start', '-n', 'test-job-issue-with-env-var-11', '-g', 'vf-pg-rg101', '--env-vars', 'VF_DURATION=14', '--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 0x7fdaabac12d0>, <function OutputProducer.on_global_arguments at 0x7fdaaba1c1f0>, <function CLIQuery.on_global_arguments at 0x7fdaab8393f0>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'containerapp': ['azure.cli.command_modules.serviceconnector', 'azext_containerapp']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name                  Load Time    Groups  Commands
cli.azure.cli.core: serviceconnector          0.140        12       182
cli.azure.cli.core: Total (1)                 0.140        12       182
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: containerapp              0.110        41       127  /home/tilo/.azure/cliextensions/containerapp
cli.azure.cli.core: Total (1)                 0.110        41       127
cli.azure.cli.core: Loaded 52 groups, 309 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command  : containerapp job start
cli.azure.cli.core: Command table: containerapp job start
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7fdaaa86ecb0>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/tilo/.azure/commands/2023-07-27.13-02-23.containerapp_job_start.3469.log'.
az_command_data_logger: command args: containerapp job start -n {} -g {} --env-vars {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x7fdaaa88b7f0>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x7fdaaa8d9750>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x7fdaaa8d9870>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7fdaaba1c280>, <function CLIQuery.handle_query_parameter at 0x7fdaab839480>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x7fdaaa8d97e0>]
az_command_data_logger: extension name: containerapp
az_command_data_logger: extension version: 0.3.36
Command group 'containerapp job' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
cli.azure.cli.core.util: Found subscription ID 5b4c80c3-zzzz-zzzz-zzzz-1b86e5e17ce0 in the URL https://management.azure.com/subscriptions/5b4c80c3-zzzz-zzzz-zzzz-1b86e5e17ce0/resourceGroups/vf-pg-rg101/providers/Microsoft.App/jobs/test-job-issue-with-env-var-11/start?api-version=2023-04-01-preview
cli.azure.cli.core.util: Retrieving token for resource https://management.core.windows.net/, subscription 5b4c80c3-zzzz-zzzz-zzzz-1b86e5e17ce0
cli.azure.cli.core.auth.persistence: build_persistence: location='/home/tilo/.azure/msal_token_cache.json', encrypt=False
cli.azure.cli.core.auth.binary_cache: load: /home/tilo/.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/3b5fbee7-zzzz-zzzz-zzzz-0e5eee005367/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/3b5fbee7-zzzz-zzzz-zzzz-0e5eee005367/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/3b5fbee7-zzzz-zzzz-zzzz-0e5eee005367/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/3b5fbee7-zzzz-zzzz-zzzz-0e5eee005367/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/3b5fbee7-zzzz-zzzz-zzzz-0e5eee005367/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/3b5fbee7-zzzz-zzzz-zzzz-0e5eee005367/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/3b5fbee7-zzzz-zzzz-zzzz-0e5eee005367/kerberos', 'tenant_region_scope': 'NA', '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? False
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: 774f4db9-ad22-4c60-ba53-3e091d14074b
cli.azure.cli.core.util: Request URL: 'https://management.azure.com/subscriptions/5b4c80c3-zzzz-zzzz-zzzz-1b86e5e17ce0/resourceGroups/vf-pg-rg101/providers/Microsoft.App/jobs/test-job-issue-with-env-var-11/start?api-version=2023-04-01-preview'
cli.azure.cli.core.util: Request method: 'POST'
cli.azure.cli.core.util: Request headers:
cli.azure.cli.core.util:     'User-Agent': 'python/3.10.10 (Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.35) AZURECLI/2.50.0 (DEB)'
cli.azure.cli.core.util:     'Accept-Encoding': 'gzip, deflate'
cli.azure.cli.core.util:     'Accept': '*/*'
cli.azure.cli.core.util:     'Connection': 'keep-alive'
cli.azure.cli.core.util:     'x-ms-client-request-id': 'dd925f93-b367-4790-89e5-ee148ce88b66'
cli.azure.cli.core.util:     'CommandName': 'containerapp job start'
cli.azure.cli.core.util:     'ParameterSetName': '-n -g --env-vars --debug'
cli.azure.cli.core.util:     'Authorization': 'Bearer eyJ0eXAiOiJKV...'
cli.azure.cli.core.util:     'Content-Length': '0'
cli.azure.cli.core.util: Request body:
cli.azure.cli.core.util: None
urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool: https://management.azure.com:443 "POST /subscriptions/5b4c80c3-zzzz-zzzz-zzzz-1b86e5e17ce0/resourceGroups/vf-pg-rg101/providers/Microsoft.App/jobs/test-job-issue-with-env-var-11/start?api-version=2023-04-01-preview HTTP/1.1" 200 None
cli.azure.cli.core.util: Response status: 200
cli.azure.cli.core.util: Response headers:
cli.azure.cli.core.util:     'Cache-Control': 'no-cache'
cli.azure.cli.core.util:     'Pragma': 'no-cache'
cli.azure.cli.core.util:     'Transfer-Encoding': 'chunked'
cli.azure.cli.core.util:     'Content-Type': 'application/json; charset=utf-8'
cli.azure.cli.core.util:     'Content-Encoding': 'gzip'
cli.azure.cli.core.util:     'Expires': '-1'
cli.azure.cli.core.util:     'Vary': 'Accept-Encoding,Accept-Encoding'
cli.azure.cli.core.util:     'x-ms-ratelimit-remaining-subscription-writes': '1199'
cli.azure.cli.core.util:     'api-supported-versions': '2022-11-01-preview, 2023-04-01-preview, 2023-05-01, 2023-05-02-preview'
cli.azure.cli.core.util:     'Server': 'Microsoft-IIS/10.0'
cli.azure.cli.core.util:     'X-Powered-By': 'ASP.NET'
cli.azure.cli.core.util:     'x-ms-request-id': '33a59a8e-513a-430c-9e20-9b865eaeccd5'
cli.azure.cli.core.util:     'x-ms-correlation-request-id': '33a59a8e-513a-430c-9e20-9b865eaeccd5'
cli.azure.cli.core.util:     'x-ms-routing-request-id': 'WESTUS2:20230727T200225Z:33a59a8e-513a-430c-9e20-9b865eaeccd5'
cli.azure.cli.core.util:     'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
cli.azure.cli.core.util:     'X-Content-Type-Options': 'nosniff'
cli.azure.cli.core.util:     'Date': 'Thu, 27 Jul 2023 20:02:25 GMT'
cli.azure.cli.core.util: Response content:
cli.azure.cli.core.util: {"id":"/subscriptions/5b4c80c3-zzzz-zzzz-zzzz-1b86e5e17ce0/resourceGroups/vf-pg-rg101/providers/Microsoft.App/jobs/test-job-issue-with-env-var-11/executions/test-job-issue-with-env-var-11-thp6far","name":"test-job-issue-with-env-var-11-thp6far"}
cli.knack.cli: Event: CommandInvoker.OnTransformResult [<function _resource_group_transform at 0x7fdaaa8b6cb0>, <function _x509_from_base64_to_hex_transform at 0x7fdaaa8b6d40>]
cli.knack.cli: Event: CommandInvoker.OnFilterResult []
{
  "id": "/subscriptions/5b4c80c3-zzzz-zzzz-zzzz-1b86e5e17ce0/resourceGroups/vf-pg-rg101/providers/Microsoft.App/jobs/test-job-issue-with-env-var-11/executions/test-job-issue-with-env-var-11-thp6far",
  "name": "test-job-issue-with-env-var-11-thp6far",
  "resourceGroup": "vf-pg-rg101"
}
cli.knack.cli: Event: Cli.SuccessfulExecute []
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7fdaaa86eef0>]
az_command_data_logger: exit code: 0
cli.__main__: Command ran in 1.989 seconds (init: 0.196, invoke: 1.793)
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 3501 in cache
telemetry.check: Negative: The /home/tilo/.azure/telemetry.txt was modified at 2023-07-27 12:56:06.375243, which in less than 600.000000 s

Expected behavior

container run uses the env-vars specified in the start cmd.

Environment Summary

azure-cli                         2.50.0

core                              2.50.0
telemetry                          1.0.8

Extensions:
ad                                 0.1.0
containerapp                      0.3.36

Dependencies:
msal                              1.22.0
azure-mgmt-resource             23.1.0b2

Python location '/opt/az/bin/python3'
Extensions directory '/home/tilo/.azure/cliextensions'

Python (Linux) 3.10.10 (main, Jun 29 2023, 11:09:14) [GCC 11.3.0]

Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.

Additional context

tilo@TSDell7k:/mnt/c/temp/tso-share$ az containerapp job execution list -n $jobname -g $vfresgroup -o yaml | grep -A 2 'env:'
WARNING: Command group 'containerapp job' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
      - env:
        - name: MYTEST
          value: '9'
--
      - env:
        - name: MYTEST
          value: '9'
--
      - env:
        - name: MYTEST
          value: '9'
--
      - env:
        - name: MYTEST
          value: '9'

Metadata

Metadata

Labels

Auto-AssignAuto assign by botCXP AttentionThis issue is handled by CXP team.ContainerAppcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionThis issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions