Skip to content

Conversation

khushishah513
Copy link
Contributor


This checklist is used to make sure that common guidelines for a pull request are followed.

Related command

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally? (pip install wheel==0.30.0 required)
  • My extension version conforms to the Extension version schema

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify src/index.json.

Copy link

Hi @khushishah513,
Please write the description of changes which can be perceived by customers into HISTORY.rst.
If you want to release a new extension version, please update the version in setup.py as well.

Copy link

azure-client-tools-bot-prd bot commented Sep 19, 2025

⚠️Azure CLI Extensions Breaking Change Test
⚠️containerapp
rule cmd_name rule_message suggest_message
⚠️ 1006 - ParaAdd containerapp debug cmd containerapp debug added parameter debug_command
⚠️ 1011 - SubgroupAdd containerapp function sub group containerapp function added

@yonzhan
Copy link
Collaborator

yonzhan commented Sep 19, 2025

Thank you for your contribution! We will review the pull request and get back to you soon.

Copy link

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

Copy link

Hi @khushishah513

Release Suggestions

Module: containerapp

  • Update VERSION to 1.2.0b4 in src/containerapp/setup.py

Notes

Comment on lines 383 to 389
invocation_summary_query = (
f"requests | extend functionNameFromCustomDimension = tostring(customDimensions['faas.name']) "
f"| where timestamp >= ago({timespan}) "
f"| where cloud_RoleName =~ '{container_app_name}' "
f"| where operation_Name =~ '{function_name}' or functionNameFromCustomDimension =~ '{function_name}' "
f"| summarize count=count() by success"
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something for future - this will work fine in single-revision mode, but for multi-revision mode, we will need to pass revisionName as well.

- name: Set/Update a master key for a container app
text: |
az containerapp function keys set -n my-containerapp -g MyResourceGroup --key-type masterKey --key-name MyKeyName --key-value MyKeyValue
- name: Set/Update a system key for a container app

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check with Shivam, if we want to add an example to rotate keys as well. Backend already supports it I think.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@khushishah513 khushishah513 marked this pull request as ready for review September 26, 2025 06:43
@Copilot Copilot AI review requested due to automatic review settings September 26, 2025 06:43
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces comprehensive support for Azure Functions on Azure Container Apps through new CLI commands. It adds functionality to manage functions, function keys, debug commands, and retrieve invocation data from Application Insights.

Key changes:

  • Added new command groups for container app functions and function keys management
  • Enhanced debug functionality with command execution capability
  • Integrated Application Insights querying for function invocation monitoring

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
custom.py Added function management commands and enhanced debug functionality with command execution
containerapp_functions_decorator.py New decorator classes for function listing, showing, and invocation operations
containerapp_function_keys_decorator.py New decorator classes for function key management operations
containerapp_debug_command_decorator.py New decorator for executing commands in debug containers
commands.py Added command group definitions and transformers for function operations
_validators.py Added validation functions for function apps and revision management
_utils.py Added utility function for replica selection
_transformers.py Added transformation functions for function data display and debug output
_ssh_utils.py Minor refactoring of debug URL generation
_params.py Added parameter definitions for all new function-related commands
_help.py Added comprehensive help documentation for new commands
_clients.py Added ContainerAppFunctionsPreviewClient with function and key management methods
HISTORY.rst Updated with new feature descriptions

raise ValidationError(f"No replicas found for revision '{revision_name}' of container app '{container_app_name}'.")

# Select a random replica
replica = random.choice(replicas)
Copy link
Preview

Copilot AI Sep 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using random selection for replica choice may lead to unpredictable behavior in production environments. Consider implementing a more deterministic selection strategy, such as choosing the first available replica or the one with the lowest load.

Copilot uses AI. Check for mistakes.

Comment on lines 279 to 281
# If not valid JSON, treat as plain text and decode escape sequences
decoded_output = output_str.encode().decode('unicode_escape')
return decoded_output
Copy link
Preview

Copilot AI Sep 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using decode('unicode_escape') on untrusted input can be a security risk as it can execute escape sequences. Consider using a safer string processing approach or validate the input before decoding.

Suggested change
# If not valid JSON, treat as plain text and decode escape sequences
decoded_output = output_str.encode().decode('unicode_escape')
return decoded_output
# If not valid JSON, treat as plain text and return as-is (do not decode escape sequences)
return output_str

Copilot uses AI. Check for mistakes.

@khushishah513 khushishah513 force-pushed the function-changes branch 3 times, most recently from 0bc26da to 41bc7ef Compare September 26, 2025 06:56
@khushishah513 khushishah513 changed the title [Containerapp] az containerapp function [Containerapp] az containerapp function : list, show, keys list/show/set, invocations summary/traces commands Sep 26, 2025
raise CLIError(f"No replicas found for revision '{revision_name}' of container app '{container_app_name}'.")

# Select a random replica
replica = random.choice(replicas)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we have state of a replica then consider selecting latest created & healthy replica instead of random

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot ContainerApp
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants