Skip to content

Conversation

@shivamkm07
Copy link

This PR adds command param in debug command.


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.

Copilot AI review requested due to automatic review settings September 19, 2025 11:01
@azure-client-tools-bot-prd
Copy link

Validation for Breaking Change Starting...

Thanks for your contribution!

@azure-client-tools-bot-prd
Copy link

Hi @shivamkm07,
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.

@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.

@github-actions
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>

@shivamkm07 shivamkm07 closed this Sep 19, 2025
@github-actions
Copy link

CodeGen Tools Feedback Collection

Thank you for using our CodeGen tool. We value your feedback, and we would like to know how we can improve our product. Please take a few minutes to fill our codegen survey

Copy link
Contributor

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 adds a command parameter to the debug command and introduces a comprehensive set of Azure Function management commands for Azure Container Apps. The primary purpose is to enhance debugging capabilities by allowing custom commands to be passed when establishing debug connections, while also adding new function-related operations for container apps.

  • Adds a command parameter to the containerapp debug command for custom debug commands
  • Introduces new command group containerapp function with list and show operations
  • Adds function key management commands for listing and updating function and host keys

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
custom.py Updates debug function signature to accept command parameter and adds new function management commands
_ssh_utils.py Modifies debug WebSocket connection to handle URL encoding and append command parameter to debug URL
_params.py Adds parameter definitions for all new function-related commands
commands.py Registers new containerapp function command group and subcommands
_help.py Adds comprehensive help documentation for all new function commands
_clients.py Implements API client methods for function operations and key management
containerapp_functions_decorator.py New decorator classes for function list and show operations
containerapp_function_keys_decorator.py New decorator classes for function key management operations
HISTORY.rst Documents the new features in release history

Comment on lines +1774 to +1848
class ContainerAppFunctionsPreviewClient:
api_version = PREVIEW_API_VERSION

@classmethod
def list_function_keys(cls, cmd, resource_group_name, name, function_name):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerapps/{}/functions/{}/listkeys?api-version={}"
request_url = url_fmt.format(
management_hostname.strip('/'),
sub_id,
resource_group_name,
name,
function_name,
cls.api_version)

r = send_raw_request(cmd.cli_ctx, "POST", request_url)
return r.json()

@classmethod
def update_function_keys(cls, cmd, resource_group_name, name, function_name, key_name, key_value=None):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerapps/{}/functions/{}/keys/{}?api-version={}"
request_url = url_fmt.format(
management_hostname.strip('/'),
sub_id,
resource_group_name,
name,
function_name,
key_name,
cls.api_version)

body = {}
if key_value:
body["value"] = key_value

r = send_raw_request(cmd.cli_ctx, "PUT", request_url, body=json.dumps(body))
return r.json()

@classmethod
def list_host_keys(cls, cmd, resource_group_name, name):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerapps/{}/host/default/listkeys?api-version={}"
request_url = url_fmt.format(
management_hostname.strip('/'),
sub_id,
resource_group_name,
name,
cls.api_version)

r = send_raw_request(cmd.cli_ctx, "POST", request_url)
return r.json()

@classmethod
def update_host_keys(cls, cmd, resource_group_name, name, key_type, key_name, key_value=None):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerapps/{}/host/default/{}/{}?api-version={}"
request_url = url_fmt.format(
management_hostname.strip('/'),
sub_id,
resource_group_name,
name,
key_type,
key_name,
cls.api_version)

body = {}
if key_value:
body["value"] = key_value

r = send_raw_request(cmd.cli_ctx, "PUT", request_url, body=json.dumps(body))
return r.json()
Copy link

Copilot AI Sep 19, 2025

Choose a reason for hiding this comment

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

Duplicate class definition. There's already a ContainerAppFunctionsPreviewClient class defined at line 306. This creates a naming conflict and the second definition will override the first one.

Suggested change
class ContainerAppFunctionsPreviewClient:
api_version = PREVIEW_API_VERSION
@classmethod
def list_function_keys(cls, cmd, resource_group_name, name, function_name):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerapps/{}/functions/{}/listkeys?api-version={}"
request_url = url_fmt.format(
management_hostname.strip('/'),
sub_id,
resource_group_name,
name,
function_name,
cls.api_version)
r = send_raw_request(cmd.cli_ctx, "POST", request_url)
return r.json()
@classmethod
def update_function_keys(cls, cmd, resource_group_name, name, function_name, key_name, key_value=None):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerapps/{}/functions/{}/keys/{}?api-version={}"
request_url = url_fmt.format(
management_hostname.strip('/'),
sub_id,
resource_group_name,
name,
function_name,
key_name,
cls.api_version)
body = {}
if key_value:
body["value"] = key_value
r = send_raw_request(cmd.cli_ctx, "PUT", request_url, body=json.dumps(body))
return r.json()
@classmethod
def list_host_keys(cls, cmd, resource_group_name, name):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerapps/{}/host/default/listkeys?api-version={}"
request_url = url_fmt.format(
management_hostname.strip('/'),
sub_id,
resource_group_name,
name,
cls.api_version)
r = send_raw_request(cmd.cli_ctx, "POST", request_url)
return r.json()
@classmethod
def update_host_keys(cls, cmd, resource_group_name, name, key_type, key_name, key_value=None):
management_hostname = cmd.cli_ctx.cloud.endpoints.resource_manager
sub_id = get_subscription_id(cmd.cli_ctx)
url_fmt = "{}/subscriptions/{}/resourceGroups/{}/providers/Microsoft.App/containerapps/{}/host/default/{}/{}?api-version={}"
request_url = url_fmt.format(
management_hostname.strip('/'),
sub_id,
resource_group_name,
name,
key_type,
key_name,
cls.api_version)
body = {}
if key_value:
body["value"] = key_value
r = send_raw_request(cmd.cli_ctx, "PUT", request_url, body=json.dumps(body))
return r.json()
# Duplicate definition of ContainerAppFunctionsPreviewClient removed to resolve naming conflict.

Copilot uses AI. Check for mistakes.
poll_results(cmd, operation_url)

class ContainerAppFunctionsPreviewClient:
api_version = PREVIEW_API_VERSION
Copy link

Copilot AI Sep 19, 2025

Choose a reason for hiding this comment

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

Missing indentation. This line should be indented to be part of the class definition.

Suggested change
api_version = PREVIEW_API_VERSION
api_version = PREVIEW_API_VERSION

Copilot uses AI. Check for mistakes.
Comment on lines +305 to +309
with self.command_group('containerapp function') as g:
g.custom_command('list-keys', 'list_containerapp_function_keys')
g.custom_command('update-keys', 'update_containerapp_function_keys')
g.custom_command('list-hostkeys', 'list_containerapp_function_hostkeys')
g.custom_command('update-hostkeys', 'update_containerapp_function_hostkeys')
Copy link

Copilot AI Sep 19, 2025

Choose a reason for hiding this comment

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

Duplicate command group definition. The 'containerapp function' command group is already defined at lines 35-37. This will cause conflicts between the two command group definitions.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants