Skip to content

Commit 08743ff

Browse files
[Containerapp] az containerapp up: Support --kind {functionapp} (#9052)
1 parent cb6bffa commit 08743ff

7 files changed

Lines changed: 11131 additions & 7 deletions

File tree

src/containerapp/HISTORY.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ upcoming
77
* 'az containerapp update/up': Disallow changing `--revisions-mode` to Labels.
88
* 'az containerapp session code-interpreter': Fix `--path` in examples
99
* 'az containerapp sessionpool create/update': Support `--lifecycle-type` and `--max-alive-period`
10+
* 'az containerapp up': support for `--kind` parameter
1011
* 'az containerapp env premium-ingress': Deprecate `--min-replicas` and `--max-replicas` parameters, use workload profile scale instead.
1112

1213
1.2.0b3

src/containerapp/azext_containerapp/_help.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@
161161
- name: Create a container app and deploy a model from Azure AI Foundry
162162
text: |
163163
az containerapp up -n my-containerapp -l westus3 --model-registry azureml --model-name Phi-4 --model-version 7
164+
- name: Create an Azure Functions on Azure Container Apps (kind=functionapp)
165+
text: |
166+
az containerapp up -n my-containerapp --image my-app:v1.0 --kind functionapp
164167
"""
165168

166169

@@ -917,7 +920,7 @@
917920
az containerapp create -n my-containerapp -g MyResourceGroup \\
918921
--image my-app:v1.0 --environment MyContainerappEnv \\
919922
--enable-java-agent
920-
- name: Create a container app with kind as functionapp
923+
- name: Create an Azure Functions on Azure Container Apps (kind=functionapp)
921924
text: |
922925
az containerapp create -n my-containerapp -g MyResourceGroup \\
923926
--image my-app:v1.0 --environment MyContainerappEnv \\

src/containerapp/azext_containerapp/_params.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@ def load_arguments(self, _):
3030
with self.argument_context('containerapp', arg_group='Configuration') as c:
3131
c.argument('revisions_mode', arg_type=get_enum_type(['single', 'multiple', 'labels']), help="The active revisions mode for the container app.")
3232

33+
with self.argument_context('containerapp') as c:
34+
c.argument('kind', arg_type=get_enum_type(['functionapp']), help="Set to 'functionapp' to enable built-in support and autoscaling for Azure Functions on Azure Container Apps.", is_preview=True)
35+
3336
with self.argument_context('containerapp create') as c:
3437
c.argument('source', help="Local directory path containing the application source and Dockerfile for building the container image. Preview: If no Dockerfile is present, a container image is generated using buildpacks. If Docker is not running or buildpacks cannot be used, Oryx will be used to generate the image. See the supported Oryx runtimes here: https://aka.ms/SourceToCloudSupportedVersions.", is_preview=True)
3538
c.argument('artifact', help="Local path to the application artifact for building the container image. See the supported artifacts here: https://aka.ms/SourceToCloudSupportedArtifacts.", is_preview=True)
3639
c.argument('build_env_vars', nargs='*', help="A list of environment variable(s) for the build. Space-separated values in 'key=value' format.",
3740
validator=validate_build_env_vars, is_preview=True)
3841
c.argument('max_inactive_revisions', type=int, help="Max inactive revisions a Container App can have.", is_preview=True)
39-
c.argument('kind', type=str, help="Set to 'functionapp' to enable built-in support and autoscaling for Azure Functions on Azure Container Apps.", is_preview=True)
4042
c.argument('registry_identity', help="The managed identity with which to authenticate to the Azure Container Registry (instead of username/password). Use 'system' for a system-defined identity, Use 'system-environment' for an environment level system-defined identity or a resource id for a user-defined environment/containerapp level identity. The managed identity should have been assigned acrpull permissions on the ACR before deployment (use 'az role assignment create --role acrpull ...').")
4143
c.argument('target_label', help="The label to apply to new revisions. Required for revisions-mode 'labels'.", is_preview=True)
4244

src/containerapp/azext_containerapp/_up_utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ def __init__(
430430
target_label=None,
431431
cpu=None,
432432
memory=None,
433+
kind=None,
433434
):
434435

435436
super().__init__(cmd, name, resource_group, exists)
@@ -451,6 +452,7 @@ def __init__(
451452

452453
self.cpu = cpu
453454
self.memory = memory
455+
self.kind = kind
454456

455457
self.should_create_acr = False
456458
self.acr: "AzureContainerRegistry" = None
@@ -492,6 +494,7 @@ def create(self, no_registry=False): # pylint: disable=arguments-differ
492494
target_label=self.target_label,
493495
cpu=self.cpu,
494496
memory=self.memory,
497+
kind=self.kind,
495498
)
496499

497500
def set_force_single_container_updates(self, force_single_container_updates):

src/containerapp/azext_containerapp/custom.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,7 +1320,8 @@ def containerapp_up(cmd,
13201320
connected_cluster_id=None,
13211321
model_registry=None,
13221322
model_name=None,
1323-
model_version=None):
1323+
model_version=None,
1324+
kind=None):
13241325
from ._up_utils import (_validate_up_args, _validate_custom_location_connected_cluster_args, _reformat_image, _get_dockerfile_content, _get_ingress_and_target_port,
13251326
ResourceGroup, Extension, CustomLocation, ContainerAppEnvironment, ContainerApp, _get_registry_from_app,
13261327
_get_registry_details, _get_registry_details_without_get_creds, _create_github_action, _set_up_defaults, up_output,
@@ -1383,7 +1384,7 @@ def containerapp_up(cmd,
13831384
custom_location = CustomLocation(cmd, name=custom_location_id, resource_group_name=resource_group_name, connected_cluster_id=connected_cluster_id)
13841385
extension = Extension(cmd, logs_rg=resource_group_name, logs_location=location, logs_share_key=logs_key, logs_customer_id=logs_customer_id, connected_cluster_id=connected_cluster_id)
13851386
env = ContainerAppEnvironment(cmd, environment, resource_group, location=location, logs_key=logs_key, logs_customer_id=logs_customer_id, custom_location_id=custom_location_id, connected_cluster_id=connected_cluster_id, is_env_for_azml_app=is_azureml_app)
1386-
app = ContainerApp(cmd, name, resource_group, None, image, env, target_port, registry_server, registry_user, registry_pass, env_vars, workload_profile_name, ingress, registry_identity=registry_identity, user_assigned=user_assigned, system_assigned=system_assigned, revisions_mode=revisions_mode, target_label=target_label)
1387+
app = ContainerApp(cmd, name, resource_group, None, image, env, target_port, registry_server, registry_user, registry_pass, env_vars, workload_profile_name, ingress, registry_identity=registry_identity, user_assigned=user_assigned, system_assigned=system_assigned, revisions_mode=revisions_mode, target_label=target_label, kind=kind)
13871388

13881389
# Check and see if registry (username and passwords) or registry-identity are specified. If so, set is_registry_server_params_set to True to use those creds.
13891390
is_registry_server_params_set = bool(registry_server and ((registry_user and registry_pass) or registry_identity))
@@ -1431,7 +1432,7 @@ def containerapp_up(cmd,
14311432
up_output(app, no_dockerfile=(source and not _has_dockerfile(source, dockerfile)))
14321433

14331434

1434-
def containerapp_up_logic(cmd, resource_group_name, name, managed_env, image, env_vars, ingress, target_port, registry_server, registry_user, workload_profile_name, registry_pass, environment_type=None, force_single_container_updates=False, registry_identity=None, system_assigned=None, user_assigned=None, revisions_mode=None, target_label=None, cpu=None, memory=None):
1435+
def containerapp_up_logic(cmd, resource_group_name, name, managed_env, image, env_vars, ingress, target_port, registry_server, registry_user, workload_profile_name, registry_pass, environment_type=None, force_single_container_updates=False, registry_identity=None, system_assigned=None, user_assigned=None, revisions_mode=None, target_label=None, cpu=None, memory=None, kind=None):
14351436
containerapp_def = None
14361437
try:
14371438
containerapp_def = ContainerAppPreviewClient.show(cmd=cmd, resource_group_name=resource_group_name, name=name)
@@ -1443,7 +1444,7 @@ def containerapp_up_logic(cmd, resource_group_name, name, managed_env, image, en
14431444
registry_server=registry_server, registry_user=registry_user, registry_pass=registry_pass, workload_profile_name=workload_profile_name, container_name=name, force_single_container_updates=force_single_container_updates,
14441445
registry_identity=registry_identity, system_assigned=system_assigned, user_assigned=user_assigned, revisions_mode=revisions_mode, target_label=target_label)
14451446
return create_containerapp(cmd=cmd, name=name, resource_group_name=resource_group_name, managed_env=managed_env, image=image, env_vars=env_vars, ingress=ingress, target_port=target_port, registry_server=registry_server, registry_user=registry_user, registry_pass=registry_pass, workload_profile_name=workload_profile_name, environment_type=environment_type,
1446-
registry_identity=registry_identity, system_assigned=system_assigned, user_assigned=user_assigned, revisions_mode=revisions_mode, target_label=target_label, cpu=cpu, memory=memory)
1447+
registry_identity=registry_identity, system_assigned=system_assigned, user_assigned=user_assigned, revisions_mode=revisions_mode, target_label=target_label, cpu=cpu, memory=memory, kind=kind)
14471448

14481449

14491450
def list_certificates(cmd, name, resource_group_name, location=None, certificate=None, thumbprint=None, managed_certificates_only=False, private_key_certificates_only=False):

0 commit comments

Comments
 (0)