Skip to content

Commit f260067

Browse files
berndverstCopilot
andauthored
Update src/durabletask/azext_durabletask/_scheduler.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent c9b422e commit f260067

1 file changed

Lines changed: 16 additions & 15 deletions

File tree

src/durabletask/azext_durabletask/_scheduler.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -362,26 +362,27 @@ def _update_containerapp_env_vars(cli_ctx, target_name, target_resource_group, t
362362
f"Container app '{target_name}' has no containers in its template."
363363
)
364364

365-
container = template.containers[0]
366-
env_vars = list(container.env or [])
367-
368365
conn_str = f"Endpoint={endpoint};Authentication=ManagedIdentity"
369366
if client_id:
370367
conn_str += f";ClientID={client_id}"
371368
env_map = {"DURABLE_TASK_SCHEDULER_CONNECTION_STRING": conn_str,
372369
"TASKHUB_NAME": task_hub_name}
373-
for name, value in env_map.items():
374-
found = False
375-
for ev in env_vars:
376-
if ev.name == name:
377-
ev.value = value
378-
found = True
379-
break
380-
if not found:
381-
from azure.mgmt.appcontainers.models import EnvironmentVar
382-
env_vars.append(EnvironmentVar(name=name, value=value))
383-
384-
container.env = env_vars
370+
371+
from azure.mgmt.appcontainers.models import EnvironmentVar
372+
373+
# Apply the environment variables to all containers in the template.
374+
for container in template.containers:
375+
env_vars = list(container.env or [])
376+
for name, value in env_map.items():
377+
found = False
378+
for ev in env_vars:
379+
if ev.name == name:
380+
ev.value = value
381+
found = True
382+
break
383+
if not found:
384+
env_vars.append(EnvironmentVar(name=name, value=value))
385+
container.env = env_vars
385386
ca_client.container_apps.begin_update(
386387
target_resource_group, target_name,
387388
{"template": template},

0 commit comments

Comments
 (0)