Skip to content

Conversation

@violetVo
Copy link

Related command

Description

Testing Guide

History Notes

[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change
[Component Name 2] az command b: Add some customer-facing feature


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

Copilot AI review requested due to automatic review settings November 30, 2025 12:01
@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Nov 30, 2025

❌AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.13
️✔️acs
️✔️latest
️✔️3.12
️✔️3.13
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.13
️✔️ams
️✔️latest
️✔️3.12
️✔️3.13
️✔️apim
️✔️latest
️✔️3.12
️✔️3.13
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.13
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️aro
️✔️latest
️✔️3.12
️✔️3.13
️✔️backup
️✔️latest
️✔️3.12
️✔️3.13
️✔️batch
️✔️latest
️✔️3.12
️✔️3.13
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.13
️✔️billing
️✔️latest
️✔️3.12
️✔️3.13
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.13
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.13
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.13
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.13
️✔️config
️✔️latest
️✔️3.12
️✔️3.13
️✔️configure
️✔️latest
️✔️3.12
️✔️3.13
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.13
️✔️container
️✔️latest
️✔️3.12
️✔️3.13
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.13
️✔️core
️✔️latest
️✔️3.12
️✔️3.13
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.13
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.13
️✔️dls
️✔️latest
️✔️3.12
️✔️3.13
️✔️dms
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.13
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.13
️✔️find
️✔️latest
️✔️3.12
️✔️3.13
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.13
️✔️identity
️✔️latest
️✔️3.12
️✔️3.13
️✔️iot
️✔️latest
️✔️3.12
️✔️3.13
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.13
️✔️lab
️✔️latest
️✔️3.12
️✔️3.13
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️maps
️✔️latest
️✔️3.12
️✔️3.13
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.13
❌monitor
❌latest
❌3.12
Type Test Case Error Message Line
Failed test_monitor_clone_vm_metric_alerts_scenario self = <azure.cli.testsdk.base.ExecutionResult object at 0x7fa76dcfb470>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7fa772a51820>
command = 'monitor metrics alert create -g clitest.rg000001 -n alert1 --scopes /subscriptions/00000000-0000-0000-0000-0000000000...ompute/virtualMachines/vm2 --action ag1 --region eastus --condition "avg Percentage CPU > 90" --description "High CPU"'
expect_failure = False

    def in_process_execute(self, cli_ctx, command, expect_failure=False):
        from io import StringIO
        from vcr.errors import CannotOverwriteExistingCassetteException
    
        if command.startswith('az '):
            command = command[3:]
    
        stdout_buf = StringIO()
        logging_buf = StringIO()
        try:
            # issue: stderr cannot be redirect in this form, as a result some failure information
            # is lost when command fails.
>           self.exit_code = cli_ctx.invoke(shlex.split(command), out_file=stdout_buf) or 0
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/azure-cli-testsdk/azure/cli/testsdk/base.py:303: 
                                        
env/lib/python3.12/site-packages/knack/cli.py:245: in invoke
    exit_code = self.exception_handler(ex)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/init.py:133: in exception_handler
    return handle_exception(ex)
           ^^^^^^^^^^^^^^^^^^^^
src/azure-cli-testsdk/azure/cli/testsdk/patches.py:33: in handle_main_exception
    raise ex
env/lib/python3.12/site-packages/knack/cli.py:233: in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/commands/init.py:666: in execute
    raise ex
src/azure-cli-core/azure/cli/core/commands/init.py:734: in run_jobs_serially
    results.append(self.run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/commands/init.py:726: in run_job
    return cmd_copy.exception_handler(ex)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli/azure/cli/command_modules/monitor/exception_handler.py:23: in exception_handler
    raise ex
src/azure-cli-core/azure/cli/core/commands/init.py:703: in run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/commands/init.py:336: in call
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/commands/command_operation.py:120: in handler
    return op(**command_args)
           ^^^^^^^^^^^^^^^^^^
src/azure-cli/azure/cli/command_modules/monitor/operations/metric_alert.py:74: in create_metric_alert
    return Create(cli_ctx=cmd.cli_ctx)(command_args={
src/azure-cli-core/azure/cli/core/aaz/command.py:155: in call
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/metrics/alert/create.py:27: in handler
    self.execute_operations()
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/metrics/alert/create.py:488: in execute_operations
    self.MetricAlertsCreateOrUpdate(ctx=self.ctx)()
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/metrics/alert/create.py:508: in call
    session = self.client.send_request(request=request, stream=False, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/aaz/client.py:108: in send_request
    session = self.pipeline.run(request, stream=stream, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:242: in run
    return first_node.send(pipeline_request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.12/site-packages/azure/mgmt/core/policies/base.py:95: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.12/site-packages/azure/core/pipeline/policies/redirect.py:205: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.12/site-packages/azure/core/pipeline/policies/retry.py:545: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/aaz/http_policy.py:112: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:130: in send
    self.sender.send(request.http_request, **request.context.options),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.12/site-packages/azure/core/pipeline/transport/requests_basic.py:365: in send
    response = self.session.request(  # type: ignore
env/lib/python3.12/site-packages/requests/sessions.py:589: in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.12/site-packages/requests/sessions.py:703: in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.12/site-packages/requests/adapters.py:667: in send
    resp = conn.urlopen(
env/lib/python3.12/site-packages/urllib3/connectionpool.py:787: in urlopen
    response = self.make_request(
env/lib/python3.12/site-packages/urllib3/connectionpool.py:534: in make_request
    response = conn.getresponse()
               ^^^^^^^^^^^^^^^^^^
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
    

self = <vcr.patch.VCRRequestsHTTPSConnection/mnt/vss/work/1/s/src/azure-cli/azure/cli/command_modules/monitor/tests/latest/recordings/test_monitor_clone_vm_metric_alerts_scenario.yaml object at 0x7fa76dba7530>
 = False, kwargs = {}

    def getresponse(self, 
=False, **kwargs):
        """Retrieve the response"""
        # Check to see if the cassette has a response for this request. If so,
        # then return it
        if self.cassette.can_play_response_for(self.vcr_request):
            log.info(f"Playing response for {self.vcr_request} from cassette")
            response = self.cassette.play_response(self.vcr_request)
            return VCRHTTPResponse(response)
        else:
            if self.cassette.write_protected and self.cassette.filter_request(self.vcr_request):
>               raise CannotOverwriteExistingCassetteException(
                    cassette=self.cassette,
                    failed_request=self.vcr_request,
                )
E               vcr.errors.CannotOverwriteExistingCassetteException: Can't overwrite existing cassette ('/mnt/vss/work/1/s/src/azure-cli/azure/cli/command_modules/monitor/tests/latest/recordings/test_monitor_clone_vm_metric_alerts_scenario.yaml') in your current record mode ('once').
E               No match for the request (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Insights/metricAlerts/alert1?api-version=2024-03-01-preview>)&nbsp;was&nbsp;found.
E               Found 2 similar requests with 1 different matcher(s) :
E               
E               1 - (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Insights/metricAlerts/alert1?api-version=2018-03-01>).
E               Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path']
E               Matchers failed :
E               custom_request_query_matcher - assertion failure :
E               None
E               
E               2 - (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Insights/metricAlerts/alert1?api-version=2018-03-01>).
E               Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path']
E               Matchers failed :
E               custom_request_query_matcher - assertion failure :
E               None

env/lib/python3.12/site-packages/vcr/stubs/init.py:264: CannotOverwriteExistingCassetteException

During handling of the above exception, another exception occurred:

self = <azure.cli.command_modules.monitor.tests.latest.test_monitor_general_operations.MonitorCloneVMScenarios testMethod=test_monitor_clone_vm_metric_alerts_scenario>
resource_group = 'clitest.rg000001'

    @AllowLargeResponse()
    @ResourceGroupPreparer(location='eastus')
    def test_monitor_clone_vm_metric_alerts_scenario(self, resource_group):
        self.kwargs.update({
            'alert': 'alert1',
            'vm1': 'vm1',
            'vm2': 'vm2',
            'vm3': 'vm3',
            'ag1': 'ag1',
            'rg': resource_group
        })
    
        vm1_json = self.cmd('vm create -g {rg} -n {vm1} --image Ubuntu2204 --admin-password TestPassword11!! '
                            '--admin-username testadmin --authentication-type password').get_output_in_json()
        vm2_json = self.cmd('vm create -g {rg} -n {vm2} --image Ubuntu2204 --admin-password TestPassword11!! '
                            '--admin-username testadmin --authentication-type password').get_output_in_json()
        vm3_json = self.cmd('vm create -g {rg} -n {vm3} --image Ubuntu2204 --admin-password TestPassword11!! '
                            '--admin-username testadmin --authentication-type password').get_output_in_json()
        self.kwargs.update({
            'vm1_id': vm1_json['id'],
            'vm2_id': vm2_json['id'],
            'vm3_id': vm3_json['id']
        })
        self.cmd('monitor action-group create -g {rg} -n {ag1}')
>       self.cmd('monitor metrics alert create -g {rg} -n {alert} --scopes {vm1_id} {vm2_id} --action {ag1} --region eastus --condition "avg Percentage CPU > 90" --description "High CPU"', checks=[
            self.check('description', 'High CPU'),
            self.check('severity', 2),
            self.check('autoMitigate', None),
            self.check('windowSize', 'PT5M'),
            self.check('evaluationFrequency', 'PT1M'),
            self.check('length(scopes)', 2)
        ])

src/azure-cli/azure/cli/command_modules/monitor/tests/latest/test_monitor_general_operations.py:39: 
 
 
 
 
 
 
 
                                 
src/azure-cli-testsdk/azure/cli/testsdk/base.py:177: in cmd
    return execute(self.cli_ctx, command, expect_failure=expect_failure).assert_with_checks(checks)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-testsdk/azure/cli/testsdk/base.py:252: in init
    self.in_process_execute(cli_ctx, command, expect_failure=expect_failure)
                                       _ 

self = <azure.cli.testsdk.base.ExecutionResult object at 0x7fa76dcfb470>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7fa772a51820>
command = 'monitor metrics alert create -g clitest.rg000001 -n alert1 --scopes /subscriptions/00000000-0000-0000-0000-0000000000...ompute/virtualMachines/vm2 --action ag1 --region eastus --condition "avg Percentage CPU > 90" --description "High CPU"'
expect_failure = False

    def _in_process_execute(self, cli_ctx, command, expect_failure=False):
        from io import StringIO
        from vcr.errors import CannotOverwriteExistingCassetteException
    
        if command.startswith('az '):
            command = command[3:]
    
        stdout_buf = StringIO()
        logging_buf = StringIO()
        try:
            # issue: stderr cannot be redirect in this form, as a result some failure information
            # is lost when command fails.
            self.exit_code = cli_ctx.invoke(shlex.split(command), out_file=stdout_buf) or 0
            self.output = stdout_buf.getvalue()
            self.applog = logging_buf.getvalue()
    
        except CannotOverwriteExistingCassetteException as ex:
>           raise AssertionError(ex)
E           AssertionError: Can't overwrite existing cassette ('/mnt/vss/_work/1/s/src/azure-cli/azure/cli/command_modules/monitor/tests/latest/recordings/test_monitor_clone_vm_metric_alerts_scenario.yaml') in your current record mode ('once').
E           No match for the request (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Insights/metricAlerts/alert1?api-version=2024-03-01-preview>)&nbsp;was&nbsp;found.
E           Found 2 similar requests with 1 different matcher(s) :
E           
E           1 - (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Insights/metricAlerts/alert1?api-version=2018-03-01>).
E           Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path']
E           Matchers failed :
E           _custom_request_query_matcher - assertion failure :
E           None
E           
E           2 - (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Insights/metricAlerts/alert1?api-version=2018-03-01>).
E           Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path']
E           Matchers failed :
E           _custom_request_query_matcher - assertion failure :
E           None

src/azure-cli-testsdk/azure/cli/testsdk/base.py:308: AssertionError
azure/cli/command_modules/monitor/tests/latest/test_monitor_general_operations.py:14
Failed test_monitor_clone_storage_metric_alerts_scenario The error message is too long, please check the pipeline log for details. azure/cli/command_modules/monitor/tests/latest/test_monitor_general_operations.py:63
Failed test_monitor_clone_storage_metric_alerts_always_scenario The error message is too long, please check the pipeline log for details. azure/cli/command_modules/monitor/tests/latest/test_monitor_general_operations.py:121
Failed test_monitor_clone_public_ip_metric_alerts_scenario The error message is too long, please check the pipeline log for details. azure/cli/command_modules/monitor/tests/latest/test_monitor_general_operations.py:187
Failed test_dynamic_metric_alert_basic The error message is too long, please check the pipeline log for details. azure/cli/command_modules/monitor/tests/latest/test_monitor_metric_alert_scenarios.py:338
Failed test_dynamic_metric_alert_multiple_scopes The error message is too long, please check the pipeline log for details. azure/cli/command_modules/monitor/tests/latest/test_monitor_metric_alert_scenarios.py:374
Failed test_metric_alert_condition_create The error message is too long, please check the pipeline log for details. azure/cli/command_modules/monitor/tests/latest/test_monitor_metric_alert_scenarios.py:444
Failed test_metric_alert_for_rg_and_sub The error message is too long, please check the pipeline log for details. azure/cli/command_modules/monitor/tests/latest/test_monitor_metric_alert_scenarios.py:509
Failed test_metric_alert_for_sql_database_scope The error message is too long, please check the pipeline log for details. azure/cli/command_modules/monitor/tests/latest/test_monitor_metric_alert_scenarios.py:268
Failed test_metric_alert_multiple_scopes The error message is too long, please check the pipeline log for details. azure/cli/command_modules/monitor/tests/latest/test_monitor_metric_alert_scenarios.py:300
Failed test_metric_alert_single_scope The error message is too long, please check the pipeline log for details. azure/cli/command_modules/monitor/tests/latest/test_monitor_metric_alert_scenarios.py:237
Failed test_metric_alert_skip_metric_validation The error message is too long, please check the pipeline log for details. azure/cli/command_modules/monitor/tests/latest/test_monitor_metric_alert_scenarios.py:555
Failed test_metric_alert_special_char_scenario The error message is too long, please check the pipeline log for details. azure/cli/command_modules/monitor/tests/latest/test_monitor_metric_alert_scenarios.py:115
Failed test_metric_alert_v2_scenario The error message is too long, please check the pipeline log for details. azure/cli/command_modules/monitor/tests/latest/test_monitor_metric_alert_scenarios.py:14
Failed test_metric_namespace_special_character The error message is too long, please check the pipeline log for details. azure/cli/command_modules/monitor/tests/latest/test_monitor_metric_alert_scenarios.py:576
Failed test_metrics_alert_metric_name_with_special_characters The error message is too long, please check the pipeline log for details. azure/cli/command_modules/monitor/tests/latest/test_monitor_metric_alert_scenarios.py:91
❌3.13
Type Test Case Error Message Line
Failed test_monitor_clone_vm_metric_alerts_scenario self = <azure.cli.testsdk.base.ExecutionResult object at 0x7fac070e7e10>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7fac101a5450>
command = 'monitor metrics alert create -g clitest.rg000001 -n alert1 --scopes /subscriptions/00000000-0000-0000-0000-0000000000...ompute/virtualMachines/vm2 --action ag1 --region eastus --condition "avg Percentage CPU > 90" --description "High CPU"'
expect_failure = False

    def in_process_execute(self, cli_ctx, command, expect_failure=False):
        from io import StringIO
        from vcr.errors import CannotOverwriteExistingCassetteException
    
        if command.startswith('az '):
            command = command[3:]
    
        stdout_buf = StringIO()
        logging_buf = StringIO()
        try:
            # issue: stderr cannot be redirect in this form, as a result some failure information
            # is lost when command fails.
>           self.exit_code = cli_ctx.invoke(shlex.split(command), out_file=stdout_buf) or 0
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/azure-cli-testsdk/azure/cli/testsdk/base.py:303: 
                                        
env/lib/python3.13/site-packages/knack/cli.py:245: in invoke
    exit_code = self.exception_handler(ex)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/init.py:133: in exception_handler
    return handle_exception(ex)
           ^^^^^^^^^^^^^^^^^^^^
src/azure-cli-testsdk/azure/cli/testsdk/patches.py:33: in handle_main_exception
    raise ex
env/lib/python3.13/site-packages/knack/cli.py:233: in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/commands/init.py:666: in execute
    raise ex
src/azure-cli-core/azure/cli/core/commands/init.py:734: in run_jobs_serially
    results.append(self.run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/commands/init.py:726: in run_job
    return cmd_copy.exception_handler(ex)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli/azure/cli/command_modules/monitor/exception_handler.py:23: in exception_handler
    raise ex
src/azure-cli-core/azure/cli/core/commands/init.py:703: in run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/commands/init.py:336: in call
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/commands/command_operation.py:120: in handler
    return op(**command_args)
           ^^^^^^^^^^^^^^^^^^
src/azure-cli/azure/cli/command_modules/monitor/operations/metric_alert.py:74: in create_metric_alert
    return Create(cli_ctx=cmd.cli_ctx)(command_args={
src/azure-cli-core/azure/cli/core/aaz/command.py:155: in call
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/metrics/alert/create.py:27: in handler
    self.execute_operations()
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/metrics/alert/create.py:488: in execute_operations
    self.MetricAlertsCreateOrUpdate(ctx=self.ctx)()
src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/metrics/alert/create.py:508: in call
    session = self.client.send_request(request=request, stream=False, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/aaz/client.py:108: in send_request
    session = self.pipeline.run(request, stream=stream, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.13/site-packages/azure/core/pipeline/base.py:242: in run
    return first_node.send(pipeline_request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.13/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.13/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.13/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.13/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.13/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.13/site-packages/azure/mgmt/core/policies/base.py:95: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.13/site-packages/azure/core/pipeline/policies/redirect.py:205: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.13/site-packages/azure/core/pipeline/policies/retry.py:545: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/aaz/http_policy.py:112: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.13/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.13/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.13/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.13/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.13/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.13/site-packages/azure/core/pipeline/base.py:130: in send
    self.sender.send(request.http_request, **request.context.options),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.13/site-packages/azure/core/pipeline/transport/requests_basic.py:365: in send
    response = self.session.request(  # type: ignore
env/lib/python3.13/site-packages/requests/sessions.py:589: in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.13/site-packages/requests/sessions.py:703: in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.13/site-packages/requests/adapters.py:667: in send
    resp = conn.urlopen(
env/lib/python3.13/site-packages/urllib3/connectionpool.py:787: in urlopen
    response = self.make_request(
env/lib/python3.13/site-packages/urllib3/connectionpool.py:534: in make_request
    response = conn.getresponse()
               ^^^^^^^^^^^^^^^^^^
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
    

self = <vcr.patch.VCRRequestsHTTPSConnection/mnt/vss/work/1/s/src/azure-cli/azure/cli/command_modules/monitor/tests/latest/recordings/test_monitor_clone_vm_metric_alerts_scenario.yaml object at 0x7fac06fe6430>
 = False, kwargs = {}

    def getresponse(self, 
=False, **kwargs):
        """Retrieve the response"""
        # Check to see if the cassette has a response for this request. If so,
        # then return it
        if self.cassette.can_play_response_for(self.vcr_request):
            log.info(f"Playing response for {self.vcr_request} from cassette")
            response = self.cassette.play_response(self.vcr_request)
            return VCRHTTPResponse(response)
        else:
            if self.cassette.write_protected and self.cassette.filter_request(self.vcr_request):
>               raise CannotOverwriteExistingCassetteException(
                    cassette=self.cassette,
                    failed_request=self.vcr_request,
                )
E               vcr.errors.CannotOverwriteExistingCassetteException: Can't overwrite existing cassette ('/mnt/vss/work/1/s/src/azure-cli/azure/cli/command_modules/monitor/tests/latest/recordings/test_monitor_clone_vm_metric_alerts_scenario.yaml') in your current record mode ('once').
E               No match for the request (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Insights/metricAlerts/alert1?api-version=2024-03-01-preview>)&nbsp;was&nbsp;found.
E               Found 2 similar requests with 1 different matcher(s) :
E               
E               1 - (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Insights/metricAlerts/alert1?api-version=2018-03-01>).
E               Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path']
E               Matchers failed :
E               custom_request_query_matcher - assertion failure :
E               None
E               
E               2 - (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Insights/metricAlerts/alert1?api-version=2018-03-01>).
E               Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path']
E               Matchers failed :
E               custom_request_query_matcher - assertion failure :
E               None

env/lib/python3.13/site-packages/vcr/stubs/init.py:264: CannotOverwriteExistingCassetteException

During handling of the above exception, another exception occurred:

self = <azure.cli.command_modules.monitor.tests.latest.test_monitor_general_operations.MonitorCloneVMScenarios testMethod=test_monitor_clone_vm_metric_alerts_scenario>
resource_group = 'clitest.rg000001'

    @AllowLargeResponse()
    @ResourceGroupPreparer(location='eastus')
    def test_monitor_clone_vm_metric_alerts_scenario(self, resource_group):
        self.kwargs.update({
            'alert': 'alert1',
            'vm1': 'vm1',
            'vm2': 'vm2',
            'vm3': 'vm3',
            'ag1': 'ag1',
            'rg': resource_group
        })
    
        vm1_json = self.cmd('vm create -g {rg} -n {vm1} --image Ubuntu2204 --admin-password TestPassword11!! '
                            '--admin-username testadmin --authentication-type password').get_output_in_json()
        vm2_json = self.cmd('vm create -g {rg} -n {vm2} --image Ubuntu2204 --admin-password TestPassword11!! '
                            '--admin-username testadmin --authentication-type password').get_output_in_json()
        vm3_json = self.cmd('vm create -g {rg} -n {vm3} --image Ubuntu2204 --admin-password TestPassword11!! '
                            '--admin-username testadmin --authentication-type password').get_output_in_json()
        self.kwargs.update({
            'vm1_id': vm1_json['id'],
            'vm2_id': vm2_json['id'],
            'vm3_id': vm3_json['id']
        })
        self.cmd('monitor action-group create -g {rg} -n {ag1}')
>       self.cmd('monitor metrics alert create -g {rg} -n {alert} --scopes {vm1_id} {vm2_id} --action {ag1} --region eastus --condition "avg Percentage CPU > 90" --description "High CPU"', checks=[
            self.check('description', 'High CPU'),
            self.check('severity', 2),
            self.check('autoMitigate', None),
            self.check('windowSize', 'PT5M'),
            self.check('evaluationFrequency', 'PT1M'),
            self.check('length(scopes)', 2)
        ])

src/azure-cli/azure/cli/command_modules/monitor/tests/latest/test_monitor_general_operations.py:39: 
 
 
 
 
 
 
 
                                 
src/azure-cli-testsdk/azure/cli/testsdk/base.py:177: in cmd
    return execute(self.cli_ctx, command, expect_failure=expect_failure).assert_with_checks(checks)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-testsdk/azure/cli/testsdk/base.py:252: in init
    self.in_process_execute(cli_ctx, command, expect_failure=expect_failure)
                                       _ 

self = <azure.cli.testsdk.base.ExecutionResult object at 0x7fac070e7e10>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7fac101a5450>
command = 'monitor metrics alert create -g clitest.rg000001 -n alert1 --scopes /subscriptions/00000000-0000-0000-0000-0000000000...ompute/virtualMachines/vm2 --action ag1 --region eastus --condition "avg Percentage CPU > 90" --description "High CPU"'
expect_failure = False

    def _in_process_execute(self, cli_ctx, command, expect_failure=False):
        from io import StringIO
        from vcr.errors import CannotOverwriteExistingCassetteException
    
        if command.startswith('az '):
            command = command[3:]
    
        stdout_buf = StringIO()
        logging_buf = StringIO()
        try:
            # issue: stderr cannot be redirect in this form, as a result some failure information
            # is lost when command fails.
            self.exit_code = cli_ctx.invoke(shlex.split(command), out_file=stdout_buf) or 0
            self.output = stdout_buf.getvalue()
            self.applog = logging_buf.getvalue()
    
        except CannotOverwriteExistingCassetteException as ex:
>           raise AssertionError(ex)
E           AssertionError: Can't overwrite existing cassette ('/mnt/vss/_work/1/s/src/azure-cli/azure/cli/command_modules/monitor/tests/latest/recordings/test_monitor_clone_vm_metric_alerts_scenario.yaml') in your current record mode ('once').
E           No match for the request (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Insights/metricAlerts/alert1?api-version=2024-03-01-preview>)&nbsp;was&nbsp;found.
E           Found 2 similar requests with 1 different matcher(s) :
E           
E           1 - (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Insights/metricAlerts/alert1?api-version=2018-03-01>).
E           Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path']
E           Matchers failed :
E           _custom_request_query_matcher - assertion failure :
E           None
E           
E           2 - (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Insights/metricAlerts/alert1?api-version=2018-03-01>).
E           Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path']
E           Matchers failed :
E           _custom_request_query_matcher - assertion failure :
E           None

src/azure-cli-testsdk/azure/cli/testsdk/base.py:308: AssertionError
azure/cli/command_modules/monitor/tests/latest/test_monitor_general_operations.py:14
Failed test_monitor_clone_storage_metric_alerts_scenario The error message is too long, please check the pipeline log for details. azure/cli/command_modules/monitor/tests/latest/test_monitor_general_operations.py:63
Failed test_monitor_clone_storage_metric_alerts_always_scenario The error message is too long, please check the pipeline log for details. azure/cli/command_modules/monitor/tests/latest/test_monitor_general_operations.py:121
Failed test_monitor_clone_public_ip_metric_alerts_scenario The error message is too long, please check the pipeline log for details. azure/cli/command_modules/monitor/tests/latest/test_monitor_general_operations.py:187
Failed test_dynamic_metric_alert_basic The error message is too long, please check the pipeline log for details. azure/cli/command_modules/monitor/tests/latest/test_monitor_metric_alert_scenarios.py:338
Failed test_dynamic_metric_alert_multiple_scopes The error message is too long, please check the pipeline log for details. azure/cli/command_modules/monitor/tests/latest/test_monitor_metric_alert_scenarios.py:374
Failed test_metric_alert_condition_create The error message is too long, please check the pipeline log for details. azure/cli/command_modules/monitor/tests/latest/test_monitor_metric_alert_scenarios.py:444
Failed test_metric_alert_for_rg_and_sub The error message is too long, please check the pipeline log for details. azure/cli/command_modules/monitor/tests/latest/test_monitor_metric_alert_scenarios.py:509
Failed test_metric_alert_for_sql_database_scope The error message is too long, please check the pipeline log for details. azure/cli/command_modules/monitor/tests/latest/test_monitor_metric_alert_scenarios.py:268
Failed test_metric_alert_multiple_scopes The error message is too long, please check the pipeline log for details. azure/cli/command_modules/monitor/tests/latest/test_monitor_metric_alert_scenarios.py:300
Failed test_metric_alert_single_scope The error message is too long, please check the pipeline log for details. azure/cli/command_modules/monitor/tests/latest/test_monitor_metric_alert_scenarios.py:237
Failed test_metric_alert_skip_metric_validation The error message is too long, please check the pipeline log for details. azure/cli/command_modules/monitor/tests/latest/test_monitor_metric_alert_scenarios.py:555
Failed test_metric_alert_special_char_scenario The error message is too long, please check the pipeline log for details. azure/cli/command_modules/monitor/tests/latest/test_monitor_metric_alert_scenarios.py:115
Failed test_metric_alert_v2_scenario The error message is too long, please check the pipeline log for details. azure/cli/command_modules/monitor/tests/latest/test_monitor_metric_alert_scenarios.py:14
Failed test_metric_namespace_special_character The error message is too long, please check the pipeline log for details. azure/cli/command_modules/monitor/tests/latest/test_monitor_metric_alert_scenarios.py:576
Failed test_metrics_alert_metric_name_with_special_characters The error message is too long, please check the pipeline log for details. azure/cli/command_modules/monitor/tests/latest/test_monitor_metric_alert_scenarios.py:91
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.13
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.13
️✔️network
️✔️latest
️✔️3.12
️✔️3.13
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.13
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.13
️✔️profile
️✔️latest
️✔️3.12
️✔️3.13
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.13
️✔️redis
️✔️latest
️✔️3.12
️✔️3.13
️✔️relay
️✔️latest
️✔️3.12
️✔️3.13
️✔️resource
️✔️latest
️✔️3.12
️✔️3.13
️✔️role
️✔️latest
️✔️3.12
️✔️3.13
️✔️search
️✔️latest
️✔️3.12
️✔️3.13
️✔️security
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.13
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.13
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.13
️✔️sql
️✔️latest
️✔️3.12
️✔️3.13
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.13
️✔️storage
️✔️latest
️✔️3.12
️✔️3.13
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.13
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.13
️✔️util
️✔️latest
️✔️3.12
️✔️3.13
️✔️vm
️✔️latest
️✔️3.12
️✔️3.13

@yonzhan
Copy link
Collaborator

yonzhan commented Nov 30, 2025

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

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

azure-client-tools-bot-prd bot commented Nov 30, 2025

️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

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

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 generates Azure CLI commands from the 2024-03-01-preview API for monitor metric alerts and related data collection functionality. The changes introduce new command modules for managing data collection endpoints, data collection rules, and application insights workbooks with their associated subresources.

Key Changes:

  • Added comprehensive CRUD operations for data collection endpoints and rules
  • Implemented workbook management commands including identity and revision operations
  • All new commands include confirmation prompts for destructive operations

Reviewed changes

Copilot reviewed 96 out of 236 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
data_collection/rule/*.py Implements CRUD operations for data collection rules with extensive schema definitions
data_collection/endpoint/*.py Adds data collection endpoint management with association tracking
app_insights/workbook/*.py Provides workbook management including identity assignment and revision history
app_insights/workbook/identity/*.py Handles workbook identity operations (assign, remove, delete, show)
app_insights/workbook/revision/*.py Manages workbook revision listing and retrieval

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"monitor app-insights workbook identity",
)
class __CMDGroup(AAZCommandGroup):
"""Manage workbook idneity
Copy link

Copilot AI Nov 30, 2025

Choose a reason for hiding this comment

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

Corrected spelling of 'idneity' to 'identity'

Suggested change
"""Manage workbook idneity
"""Manage workbook identity

Copilot uses AI. Check for mistakes.
"""Show workbook revision.

:example: Show workbook revision
az monitor app-insights workbook revision list -g rg --resource-name name --revision-id id
Copy link

Copilot AI Nov 30, 2025

Choose a reason for hiding this comment

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

Example command uses 'list' but this is the 'show' command. The example should use 'show' instead of 'list' to correctly demonstrate this command's usage.

Suggested change
az monitor app-insights workbook revision list -g rg --resource-name name --revision-id id
az monitor app-insights workbook revision show -g rg --resource-name name --revision-id id

Copilot uses AI. Check for mistakes.
@necusjz
Copy link
Member

necusjz commented Nov 30, 2025

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

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