Skip to content

[ARM] az policy: Rewrite Azure Policy CRUD commands using auto-generation#33416

Open
Celinadhh wants to merge 25 commits into
Azure:devfrom
Celinadhh:feature-policy
Open

[ARM] az policy: Rewrite Azure Policy CRUD commands using auto-generation#33416
Celinadhh wants to merge 25 commits into
Azure:devfrom
Celinadhh:feature-policy

Conversation

@Celinadhh

@Celinadhh Celinadhh commented May 21, 2026

Copy link
Copy Markdown
Member

Related command

az policy assignment {create, delete, list, show, update}
az policy assignment identity {assign, remove, show}
az policy assignment non-compliance-message {create, delete, list, show, update}
az policy definition {create, delete, list, show, update}
az policy definition version {create, delete, list, show, update}
az policy enrollment {create, delete, list, show, update}
az policy exemption {create, delete, list, show, update}
az policy set-definition {create, delete, list, show, update}
az policy set-definition version {create, delete, list, show, update}

Description
Reimplement all azure policy CRUD commands using the auto-generation toolset with customization. This will onboard CLI to the newer api-versions and to newer commands like definition/set-definition version and enrollment.
Testing Guide
All tests are updated and passing in record and playback modes.
Few new tests added.


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

@azure-client-tools-bot-prd

azure-client-tools-bot-prd Bot commented May 21, 2026

Copy link
Copy Markdown
❌AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.14
️✔️acs
️✔️latest
️✔️3.12
️✔️3.14
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.14
️✔️ams
️✔️latest
️✔️3.12
️✔️3.14
️✔️apim
️✔️latest
️✔️3.12
️✔️3.14
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.14
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.14
️✔️aro
️✔️latest
️✔️3.12
️✔️3.14
️✔️backup
️✔️latest
️✔️3.12
️✔️3.14
️✔️batch
️✔️latest
️✔️3.12
️✔️3.14
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.14
️✔️billing
️✔️latest
️✔️3.12
️✔️3.14
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.14
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.14
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.14
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.14
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.14
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.14
️✔️config
️✔️latest
️✔️3.12
️✔️3.14
️✔️configure
️✔️latest
️✔️3.12
️✔️3.14
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.14
️✔️container
️✔️latest
️✔️3.12
️✔️3.14
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.14
️✔️core
️✔️latest
️✔️3.12
️✔️3.14
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.14
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.14
️✔️dls
️✔️latest
️✔️3.12
️✔️3.14
️✔️dms
️✔️latest
️✔️3.12
️✔️3.14
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.14
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.14
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.14
️✔️find
️✔️latest
️✔️3.12
️✔️3.14
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.14
️✔️identity
️✔️latest
️✔️3.12
️✔️3.14
️✔️iot
️✔️latest
️✔️3.12
️✔️3.14
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.14
️✔️lab
️✔️latest
️✔️3.12
️✔️3.14
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.14
️✔️maps
️✔️latest
️✔️3.12
️✔️3.14
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.14
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.14
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.14
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.14
️✔️network
️✔️latest
️✔️3.12
️✔️3.14
❌policyinsights
❌latest
❌3.12
Type Test Case Error Message Line
Failed test_policy_insights_remediation ctx = <azure.cli.core.aaz.command_ctx.AAZCommandCtx object at 0x7f7372fdfce0>

    @staticmethod
    def ResolvePolicyId(ctx):
        policy_id = ctx.args.policy.data or ctx.args.policy_set_definition.data
        if not is_valid_resource_id(policy_id):
            definition = None
            name = policy_id.split('/')[-1]
            command_string = None
            if has_value(ctx.args.policy):
                command_string = f"policy definition show --name {name}"
            else:
                command_string = f"policy set-definition show --name {name}"
    
            if policy_id.startswith('/providers'):
                management_group_name = policy_id.split('/')[4]
                command_string = command_string + f" --management-group {management_group_name}"
    
            try:
>               definition = Common.run_cli_deserialize(command_string)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/azure-cli/azure/cli/command_modules/resource/policy.py:204: 
 
 
                                      
src/azure-cli/azure/cli/command_modules/resource/policy.py:273: in run_cli_deserialize
    result = run_az_cmd(shlex.split(command), out_file=stdout_buf)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/util.py:1478: in run_az_cmd
    cli.invoke(args, out_file=out_file)
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:153: 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:677: in execute
    raise ex
src/azure-cli-core/azure/cli/core/commands/init.py:820: in run_jobs_serially
    results.append(self.run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/commands/init.py:789: in run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/aaz/command.py:154: in call
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/definition/show.py:39: in handler
    self.execute_operations()
src/azure-cli/azure/cli/command_modules/resource/policy.py:928: in execute_operations
    self.PolicyDefinitionsGetBuiltIn(ctx=self.ctx)()
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/definition/show.py:271: in call
    session = self.client.send_request(request=request, stream=False, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/aaz/client.py:107: 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:375: in send
    response = self.session.request(  # type: ignore
env/lib/python3.12/site-packages/requests/sessions.py:592: in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.12/site-packages/requests/sessions.py:706: in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.12/site-packages/requests/adapters.py:645: in send
    resp = conn.urlopen(
env/lib/python3.12/site-packages/urllib3/connectionpool.py:788: in urlopen
    response = self.make_request(
env/lib/python3.12/site-packages/urllib3/connectionpool.py:534: in make_request
    response = conn.getresponse()
               ^^^^^^^^^^^^^^^^^^
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
       

self = <VCRRequestsHTTPSConnection/mnt/vss/work/1/s/src/azure-cli/azure/cli/command_modules/policyinsights/tests/latest/recordings/test_policy_insights_remediation.yaml(host='management.azure.com', port=443) at 0x7f737245fbc0>
 = 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/policyinsights/tests/latest/recordings/test_policy_insights_remediation.yaml') in your current record mode ('once').
E               No match for the request (<Request (GET) https://management.azure.com/providers/Microsoft.Authorization/policyDefinitions/06a78e20-9358-41c9-923c-fb736d382a4d?api-version=2025-11-01>)&nbsp;was&nbsp;found.
E               Found 1 similar requests with 1 different matcher(s) :
E               
E               1 - (<Request (GET) https://management.azure.com/providers/Microsoft.Authorization/policyDefinitions/06a78e20-9358-41c9-923c-fb736d382a4d?api-version=2024-05-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:277: CannotOverwriteExistingCassetteException

The above exception was the direct cause of the following exception:

self = <azure.cli.command_modules.policyinsights.tests.latest.test_policyinsights_scenario.PolicyInsightsTests testMethod=test_policy_insights_remediation>
resource_group_location = 'westus', storage_account = 'cliremediation000002'

    @AllowLargeResponse()
    @ResourceGroupPreparer(name_prefix='cli_test_remediation')
    @StorageAccountPreparer(name_prefix='cliremediation', allow_shared_key_access=False)
    def test_policy_insights_remediation(self, resource_group_location, storage_account):
        self.kwargs.update({
            'pan': self.create_random_name('azurecli-test-policy-assignment', 40),
            'rn': self.create_random_name('azurecli-test-remediation', 40),
            'bip': '06a78e20-9358-41c9-923c-fb736d382a4d',
            'location': resource_group_location,
            'sa': storage_account
        })
    
        # create a subscription policy assignment that we can trigger remediations on
>       assignment = self.cmd(
            'policy assignment create --policy {bip} -n {pan}').get_output_in_json()

src/azure-cli/azure/cli/command_modules/policyinsights/tests/latest/test_policyinsights_scenario.py:152: 
 
 
 
 
 
 
 
                                 
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)
src/azure-cli-testsdk/azure/cli/testsdk/base.py:315: in in_process_execute
    raise ex.exception
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:677: in execute
    raise ex
src/azure-cli-core/azure/cli/core/commands/init.py:820: in run_jobs_serially
    results.append(self.run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/commands/init.py:789: in run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/aaz/command.py:154: in call
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/create.py:50: in handler
    self.execute_operations()
src/azure-cli/azure/cli/command_modules/resource/policy.py:446: in execute_operations
    self.pre_operations()
src/azure-cli/azure/cli/command_modules/resource/policy.py:441: in pre_operations
    Common.ResolvePolicyId(self.ctx)
 
 
 
 
 
 
 
 
 
 
                             _ 

ctx = <azure.cli.core.aaz._command_ctx.AAZCommandCtx object at 0x7f7372fdfce0>

    @staticmethod
    def ResolvePolicyId(ctx):
        policy_id = ctx.args.policy._data or ctx.args.policy_set_definition._data
        if not is_valid_resource_id(policy_id):
            definition = None
            name = policy_id.split('/')[-1]
            command_string = None
            if has_value(ctx.args.policy):
                command_string = f"policy definition show --name {name}"
            else:
                command_string = f"policy set-definition show --name {name}"
    
            if policy_id.startswith('/providers'):
                management_group_name = policy_id.split('/')[4]
                command_string = command_string + f" --management-group {management_group_name}"
    
            try:
                definition = Common.run_cli_deserialize(command_string)
            except Exception as ex:
>               raise InvalidArgumentValueError(
                    f"Invalid value in --policy or --policy-set-definition: '{policy_id}'") from ex
E               azure.cli.core.azclierror.InvalidArgumentValueError: Invalid value in --policy or --policy-set-definition: '06a78e20-9358-41c9-923c-fb736d382a4d'

src/azure-cli/azure/cli/command_modules/resource/policy.py:206: InvalidArgumentValueError
azure/cli/command_modules/policyinsights/tests/latest/test_policyinsights_scenario.py:138
Failed test_policy_insights_remediation_complete The error message is too long, please check the pipeline log for details. azure/cli/command_modules/policyinsights/tests/latest/test_policyinsights_scenario.py:389
Failed test_policy_insights_remediation_management_group The error message is too long, please check the pipeline log for details. azure/cli/command_modules/policyinsights/tests/latest/test_policyinsights_scenario.py:333
Failed test_policy_insights_remediation_policy_set The error message is too long, please check the pipeline log for details. azure/cli/command_modules/policyinsights/tests/latest/test_policyinsights_scenario.py:272
Failed test_policy_insights_remediation_reevaluate The error message is too long, please check the pipeline log for details. azure/cli/command_modules/policyinsights/tests/latest/test_policyinsights_scenario.py:497
Failed test_policy_insights_triggerscan The error message is too long, please check the pipeline log for details. azure/cli/command_modules/policyinsights/tests/latest/test_policyinsights_scenario.py:112
❌3.14
Type Test Case Error Message Line
Failed test_policy_insights_remediation ctx = <azure.cli.core.aaz.command_ctx.AAZCommandCtx object at 0x7fb9696f4c20>

    @staticmethod
    def ResolvePolicyId(ctx):
        policy_id = ctx.args.policy.data or ctx.args.policy_set_definition.data
        if not is_valid_resource_id(policy_id):
            definition = None
            name = policy_id.split('/')[-1]
            command_string = None
            if has_value(ctx.args.policy):
                command_string = f"policy definition show --name {name}"
            else:
                command_string = f"policy set-definition show --name {name}"
    
            if policy_id.startswith('/providers'):
                management_group_name = policy_id.split('/')[4]
                command_string = command_string + f" --management-group {management_group_name}"
    
            try:
>               definition = Common.run_cli_deserialize(command_string)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/azure-cli/azure/cli/command_modules/resource/policy.py:204: 
 
 
                                      
src/azure-cli/azure/cli/command_modules/resource/policy.py:273: in run_cli_deserialize
    result = run_az_cmd(shlex.split(command), out_file=stdout_buf)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/util.py:1478: in run_az_cmd
    cli.invoke(args, out_file=out_file)
env/lib/python3.14/site-packages/knack/cli.py:245: in invoke
    exit_code = self.exception_handler(ex)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/init.py:153: 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.14/site-packages/knack/cli.py:233: in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/commands/init.py:677: in execute
    raise ex
src/azure-cli-core/azure/cli/core/commands/init.py:820: in run_jobs_serially
    results.append(self.run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/commands/init.py:789: in run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/aaz/command.py:154: in call
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/definition/show.py:39: in handler
    self.execute_operations()
src/azure-cli/azure/cli/command_modules/resource/policy.py:928: in execute_operations
    self.PolicyDefinitionsGetBuiltIn(ctx=self.ctx)()
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/definition/show.py:271: in call
    session = self.client.send_request(request=request, stream=False, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/aaz/client.py:107: in send_request
    session = self.pipeline.run(request, stream=stream, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:242: in run
    return first_node.send(pipeline_request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/mgmt/core/policies/base.py:95: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/policies/redirect.py:205: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/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.14/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:130: in send
    self.sender.send(request.http_request, **request.context.options),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/transport/requests_basic.py:375: in send
    response = self.session.request(  # type: ignore
env/lib/python3.14/site-packages/requests/sessions.py:592: in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/requests/sessions.py:706: in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/requests/adapters.py:645: in send
    resp = conn.urlopen(
env/lib/python3.14/site-packages/urllib3/connectionpool.py:788: in urlopen
    response = self.make_request(
env/lib/python3.14/site-packages/urllib3/connectionpool.py:534: in make_request
    response = conn.getresponse()
               ^^^^^^^^^^^^^^^^^^
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
       

self = <VCRRequestsHTTPSConnection/mnt/vss/work/1/s/src/azure-cli/azure/cli/command_modules/policyinsights/tests/latest/recordings/test_policy_insights_remediation.yaml(host='management.azure.com', port=443) at 0x7fb9696f6cf0>
 = 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/policyinsights/tests/latest/recordings/test_policy_insights_remediation.yaml') in your current record mode ('once').
E               No match for the request (<Request (GET) https://management.azure.com/providers/Microsoft.Authorization/policyDefinitions/06a78e20-9358-41c9-923c-fb736d382a4d?api-version=2025-11-01>)&nbsp;was&nbsp;found.
E               Found 1 similar requests with 1 different matcher(s) :
E               
E               1 - (<Request (GET) https://management.azure.com/providers/Microsoft.Authorization/policyDefinitions/06a78e20-9358-41c9-923c-fb736d382a4d?api-version=2024-05-01>).
E               Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path']
E               Matchers failed :
E               custom_request_query_matcher - assertion failure :
E               None

env/lib/python3.14/site-packages/vcr/stubs/init.py:277: CannotOverwriteExistingCassetteException

The above exception was the direct cause of the following exception:

self = <azure.cli.command_modules.policyinsights.tests.latest.test_policyinsights_scenario.PolicyInsightsTests testMethod=test_policy_insights_remediation>
resource_group_location = 'westus', storage_account = 'cliremediation000002'

    @AllowLargeResponse()
    @ResourceGroupPreparer(name_prefix='cli_test_remediation')
    @StorageAccountPreparer(name_prefix='cliremediation', allow_shared_key_access=False)
    def test_policy_insights_remediation(self, resource_group_location, storage_account):
        self.kwargs.update({
            'pan': self.create_random_name('azurecli-test-policy-assignment', 40),
            'rn': self.create_random_name('azurecli-test-remediation', 40),
            'bip': '06a78e20-9358-41c9-923c-fb736d382a4d',
            'location': resource_group_location,
            'sa': storage_account
        })
    
        # create a subscription policy assignment that we can trigger remediations on
>       assignment = self.cmd(
            'policy assignment create --policy {bip} -n {pan}').get_output_in_json()

src/azure-cli/azure/cli/command_modules/policyinsights/tests/latest/test_policyinsights_scenario.py:152: 
 
 
 
 
 
 
 
                                 
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)
src/azure-cli-testsdk/azure/cli/testsdk/base.py:315: in in_process_execute
    raise ex.exception
env/lib/python3.14/site-packages/knack/cli.py:233: in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/commands/init.py:677: in execute
    raise ex
src/azure-cli-core/azure/cli/core/commands/init.py:820: in run_jobs_serially
    results.append(self.run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/commands/init.py:789: in run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/aaz/command.py:154: in call
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/create.py:50: in handler
    self.execute_operations()
src/azure-cli/azure/cli/command_modules/resource/policy.py:446: in execute_operations
    self.pre_operations()
src/azure-cli/azure/cli/command_modules/resource/policy.py:441: in pre_operations
    Common.ResolvePolicyId(self.ctx)
 
 
 
 
 
 
 
 
 
 
                             _ 

ctx = <azure.cli.core.aaz._command_ctx.AAZCommandCtx object at 0x7fb9696f4c20>

    @staticmethod
    def ResolvePolicyId(ctx):
        policy_id = ctx.args.policy._data or ctx.args.policy_set_definition._data
        if not is_valid_resource_id(policy_id):
            definition = None
            name = policy_id.split('/')[-1]
            command_string = None
            if has_value(ctx.args.policy):
                command_string = f"policy definition show --name {name}"
            else:
                command_string = f"policy set-definition show --name {name}"
    
            if policy_id.startswith('/providers'):
                management_group_name = policy_id.split('/')[4]
                command_string = command_string + f" --management-group {management_group_name}"
    
            try:
                definition = Common.run_cli_deserialize(command_string)
            except Exception as ex:
>               raise InvalidArgumentValueError(
                    f"Invalid value in --policy or --policy-set-definition: '{policy_id}'") from ex
E               azure.cli.core.azclierror.InvalidArgumentValueError: Invalid value in --policy or --policy-set-definition: '06a78e20-9358-41c9-923c-fb736d382a4d'

src/azure-cli/azure/cli/command_modules/resource/policy.py:206: InvalidArgumentValueError
azure/cli/command_modules/policyinsights/tests/latest/test_policyinsights_scenario.py:138
Failed test_policy_insights_remediation_complete The error message is too long, please check the pipeline log for details. azure/cli/command_modules/policyinsights/tests/latest/test_policyinsights_scenario.py:389
Failed test_policy_insights_remediation_management_group The error message is too long, please check the pipeline log for details. azure/cli/command_modules/policyinsights/tests/latest/test_policyinsights_scenario.py:333
Failed test_policy_insights_remediation_policy_set The error message is too long, please check the pipeline log for details. azure/cli/command_modules/policyinsights/tests/latest/test_policyinsights_scenario.py:272
Failed test_policy_insights_remediation_reevaluate The error message is too long, please check the pipeline log for details. azure/cli/command_modules/policyinsights/tests/latest/test_policyinsights_scenario.py:497
Failed test_policy_insights_triggerscan The error message is too long, please check the pipeline log for details. azure/cli/command_modules/policyinsights/tests/latest/test_policyinsights_scenario.py:112
️✔️postgresql
️✔️latest
️✔️3.12
️✔️3.14
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.14
️✔️profile
️✔️latest
️✔️3.12
️✔️3.14
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.14
️✔️redis
️✔️latest
️✔️3.12
️✔️3.14
️✔️relay
️✔️latest
️✔️3.12
️✔️3.14
❌resource
❌latest
❌3.12
Type Test Case Error Message Line
Failed test_subscription_level_deployment self = <azure.cli.testsdk.base.ExecutionResult object at 0x7f05744eb920>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7f0579966720>
command = 'policy assignment delete -n location-lock', 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:153: 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:677: in execute
    raise ex
src/azure-cli-core/azure/cli/core/commands/init.py:820: in run_jobs_serially
    results.append(self.run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/commands/init.py:789: in run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/aaz/command.py:154: in call
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/delete.py:38: in handler
    self.execute_operations()
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/delete.py:69: in execute_operations
    self.PolicyAssignmentsDelete(ctx=self.ctx)()
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/delete.py:85: in call
    session = self.client.send_request(request=request, stream=False, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/aaz/client.py:107: 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:375: in send
    response = self.session.request(  # type: ignore
env/lib/python3.12/site-packages/requests/sessions.py:592: in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.12/site-packages/requests/sessions.py:706: in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.12/site-packages/requests/adapters.py:645: in send
    resp = conn.urlopen(
env/lib/python3.12/site-packages/urllib3/connectionpool.py:788: in urlopen
    response = self.make_request(
env/lib/python3.12/site-packages/urllib3/connectionpool.py:534: in make_request
    response = conn.getresponse()
               ^^^^^^^^^^^^^^^^^^
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
      

self = <VCRRequestsHTTPSConnection/mnt/vss/work/1/s/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_subscription_level_deployment.yaml(host='management.azure.com', port=443) at 0x7f05744b1bb0>
 = 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/resource/tests/latest/recordings/test_subscription_level_deployment.yaml') in your current record mode ('once').
E               No match for the request (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/policyAssignments/location-lock?api-version=2025-11-01>)&nbsp;was&nbsp;found.
E               Found 1 similar requests with 1 different matcher(s) :
E               
E               1 - (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/policyAssignments/location-lock?api-version=2024-05-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:277: CannotOverwriteExistingCassetteException

During handling of the above exception, another exception occurred:

self = <azure.cli.command_modules.resource.tests.latest.test_resource.DeploymentTestAtSubscriptionScope testMethod=test_subscription_level_deployment>

    def tearDown(self):
>       self.cmd('policy assignment delete -n location-lock')

src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource.py:1494: 
 
 
 
 
 
 
                                  
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 0x7f05744eb920>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7f0579966720>
command = 'policy assignment delete -n location-lock', 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/resource/tests/latest/recordings/test_subscription_level_deployment.yaml') in your current record mode ('once').
E           No match for the request (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/policyAssignments/location-lock?api-version=2025-11-01>)&nbsp;was&nbsp;found.
E           Found 1 similar requests with 1 different matcher(s) :
E           
E           1 - (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/policyAssignments/location-lock?api-version=2024-05-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/resource/tests/latest/test_resource.py:1497
Failed test_subscription_level_deployment_old_command self = <azure.cli.testsdk.base.ExecutionResult object at 0x7f0575e726c0>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7f0579a4ccb0>
command = 'policy assignment delete -n location-lock', 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:153: 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:677: in execute
    raise ex
src/azure-cli-core/azure/cli/core/commands/init.py:820: in run_jobs_serially
    results.append(self.run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/commands/init.py:789: in run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/aaz/command.py:154: in call
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/delete.py:38: in handler
    self.execute_operations()
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/delete.py:69: in execute_operations
    self.PolicyAssignmentsDelete(ctx=self.ctx)()
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/delete.py:85: in call
    session = self.client.send_request(request=request, stream=False, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/aaz/client.py:107: 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:375: in send
    response = self.session.request(  # type: ignore
env/lib/python3.12/site-packages/requests/sessions.py:592: in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.12/site-packages/requests/sessions.py:706: in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.12/site-packages/requests/adapters.py:645: in send
    resp = conn.urlopen(
env/lib/python3.12/site-packages/urllib3/connectionpool.py:788: in urlopen
    response = self.make_request(
env/lib/python3.12/site-packages/urllib3/connectionpool.py:534: in make_request
    response = conn.getresponse()
               ^^^^^^^^^^^^^^^^^^
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
      

self = <VCRRequestsHTTPSConnection/mnt/vss/work/1/s/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_subscription_level_deployment_old_command.yaml(host='management.azure.com', port=443) at 0x7f0574ee10a0>
 = 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/resource/tests/latest/recordings/test_subscription_level_deployment_old_command.yaml') in your current record mode ('once').
E               No match for the request (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/policyAssignments/location-lock?api-version=2025-11-01>)&nbsp;was&nbsp;found.
E               Found 1 similar requests with 1 different matcher(s) :
E               
E               1 - (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/policyAssignments/location-lock?api-version=2024-05-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:277: CannotOverwriteExistingCassetteException

During handling of the above exception, another exception occurred:

self = <azure.cli.command_modules.resource.tests.latest.test_resource.DeploymentTestAtSubscriptionScope testMethod=test_subscription_level_deployment_old_command>

    def tearDown(self):
>       self.cmd('policy assignment delete -n location-lock')

src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource.py:1494: 
 
 
 
 
 
 
                                  
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 0x7f0575e726c0>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7f0579a4ccb0>
command = 'policy assignment delete -n location-lock', 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/resource/tests/latest/recordings/test_subscription_level_deployment_old_command.yaml') in your current record mode ('once').
E           No match for the request (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/policyAssignments/location-lock?api-version=2025-11-01>)&nbsp;was&nbsp;found.
E           Found 1 similar requests with 1 different matcher(s) :
E           
E           1 - (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/policyAssignments/location-lock?api-version=2024-05-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/resource/tests/latest/test_resource.py:1565
❌3.14
Type Test Case Error Message Line
Failed test_subscription_level_deployment self = <azure.cli.testsdk.base.ExecutionResult object at 0x7fd8aa5097e0>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7fd8b1ab1bd0>
command = 'policy assignment delete -n location-lock', 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.14/site-packages/knack/cli.py:245: in invoke
    exit_code = self.exception_handler(ex)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/init.py:153: 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.14/site-packages/knack/cli.py:233: in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/commands/init.py:677: in execute
    raise ex
src/azure-cli-core/azure/cli/core/commands/init.py:820: in run_jobs_serially
    results.append(self.run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/commands/init.py:789: in run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/aaz/command.py:154: in call
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/delete.py:38: in handler
    self.execute_operations()
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/delete.py:69: in execute_operations
    self.PolicyAssignmentsDelete(ctx=self.ctx)()
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/delete.py:85: in call
    session = self.client.send_request(request=request, stream=False, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/aaz/client.py:107: in send_request
    session = self.pipeline.run(request, stream=stream, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:242: in run
    return first_node.send(pipeline_request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/mgmt/core/policies/base.py:95: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/policies/redirect.py:205: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/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.14/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:130: in send
    self.sender.send(request.http_request, **request.context.options),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/transport/requests_basic.py:375: in send
    response = self.session.request(  # type: ignore
env/lib/python3.14/site-packages/requests/sessions.py:592: in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/requests/sessions.py:706: in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/requests/adapters.py:645: in send
    resp = conn.urlopen(
env/lib/python3.14/site-packages/urllib3/connectionpool.py:788: in urlopen
    response = self.make_request(
env/lib/python3.14/site-packages/urllib3/connectionpool.py:534: in make_request
    response = conn.getresponse()
               ^^^^^^^^^^^^^^^^^^
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
      

self = <VCRRequestsHTTPSConnection/mnt/vss/work/1/s/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_subscription_level_deployment.yaml(host='management.azure.com', port=443) at 0x7fd8aa3d2dd0>
 = 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/resource/tests/latest/recordings/test_subscription_level_deployment.yaml') in your current record mode ('once').
E               No match for the request (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/policyAssignments/location-lock?api-version=2025-11-01>)&nbsp;was&nbsp;found.
E               Found 1 similar requests with 1 different matcher(s) :
E               
E               1 - (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/policyAssignments/location-lock?api-version=2024-05-01>).
E               Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path']
E               Matchers failed :
E               custom_request_query_matcher - assertion failure :
E               None

env/lib/python3.14/site-packages/vcr/stubs/init.py:277: CannotOverwriteExistingCassetteException

During handling of the above exception, another exception occurred:

self = <azure.cli.command_modules.resource.tests.latest.test_resource.DeploymentTestAtSubscriptionScope testMethod=test_subscription_level_deployment>

    def tearDown(self):
>       self.cmd('policy assignment delete -n location-lock')

src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource.py:1494: 
 
 
 
 
 
 
                                  
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 0x7fd8aa5097e0>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7fd8b1ab1bd0>
command = 'policy assignment delete -n location-lock', 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/resource/tests/latest/recordings/test_subscription_level_deployment.yaml') in your current record mode ('once').
E           No match for the request (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/policyAssignments/location-lock?api-version=2025-11-01>)&nbsp;was&nbsp;found.
E           Found 1 similar requests with 1 different matcher(s) :
E           
E           1 - (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/policyAssignments/location-lock?api-version=2024-05-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/resource/tests/latest/test_resource.py:1497
Failed test_subscription_level_deployment_old_command self = <azure.cli.testsdk.base.ExecutionResult object at 0x7fd8b0ffcd70>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7fd8b172ed50>
command = 'policy assignment delete -n location-lock', 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.14/site-packages/knack/cli.py:245: in invoke
    exit_code = self.exception_handler(ex)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/init.py:153: 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.14/site-packages/knack/cli.py:233: in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/commands/init.py:677: in execute
    raise ex
src/azure-cli-core/azure/cli/core/commands/init.py:820: in run_jobs_serially
    results.append(self.run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/commands/init.py:789: in run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/aaz/command.py:154: in call
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/delete.py:38: in handler
    self.execute_operations()
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/delete.py:69: in execute_operations
    self.PolicyAssignmentsDelete(ctx=self.ctx)()
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/delete.py:85: in call
    session = self.client.send_request(request=request, stream=False, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/aaz/client.py:107: in send_request
    session = self.pipeline.run(request, stream=stream, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:242: in run
    return first_node.send(pipeline_request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/mgmt/core/policies/base.py:95: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/policies/redirect.py:205: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/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.14/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:98: in send
    response = self.next.send(request)
               ^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/base.py:130: in send
    self.sender.send(request.http_request, **request.context.options),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/pipeline/transport/requests_basic.py:375: in send
    response = self.session.request(  # type: ignore
env/lib/python3.14/site-packages/requests/sessions.py:592: in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/requests/sessions.py:706: in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/requests/adapters.py:645: in send
    resp = conn.urlopen(
env/lib/python3.14/site-packages/urllib3/connectionpool.py:788: in urlopen
    response = self.make_request(
env/lib/python3.14/site-packages/urllib3/connectionpool.py:534: in make_request
    response = conn.getresponse()
               ^^^^^^^^^^^^^^^^^^
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
      

self = <VCRRequestsHTTPSConnection/mnt/vss/work/1/s/src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_subscription_level_deployment_old_command.yaml(host='management.azure.com', port=443) at 0x7fd8aaf12db0>
 = 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/resource/tests/latest/recordings/test_subscription_level_deployment_old_command.yaml') in your current record mode ('once').
E               No match for the request (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/policyAssignments/location-lock?api-version=2025-11-01>)&nbsp;was&nbsp;found.
E               Found 1 similar requests with 1 different matcher(s) :
E               
E               1 - (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/policyAssignments/location-lock?api-version=2024-05-01>).
E               Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path']
E               Matchers failed :
E               custom_request_query_matcher - assertion failure :
E               None

env/lib/python3.14/site-packages/vcr/stubs/init.py:277: CannotOverwriteExistingCassetteException

During handling of the above exception, another exception occurred:

self = <azure.cli.command_modules.resource.tests.latest.test_resource.DeploymentTestAtSubscriptionScope testMethod=test_subscription_level_deployment_old_command>

    def tearDown(self):
>       self.cmd('policy assignment delete -n location-lock')

src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource.py:1494: 
 
 
 
 
 
 
                                  
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 0x7fd8b0ffcd70>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7fd8b172ed50>
command = 'policy assignment delete -n location-lock', 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/resource/tests/latest/recordings/test_subscription_level_deployment_old_command.yaml') in your current record mode ('once').
E           No match for the request (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/policyAssignments/location-lock?api-version=2025-11-01>)&nbsp;was&nbsp;found.
E           Found 1 similar requests with 1 different matcher(s) :
E           
E           1 - (<Request (DELETE) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/policyAssignments/location-lock?api-version=2024-05-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/resource/tests/latest/test_resource.py:1565
️✔️role
️✔️latest
️✔️3.12
️✔️3.14
️✔️search
️✔️latest
️✔️3.12
️✔️3.14
️✔️security
️✔️latest
️✔️3.12
️✔️3.14
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.14
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.14
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.14
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.14
️✔️sql
️✔️latest
️✔️3.12
️✔️3.14
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.14
️✔️storage
️✔️latest
️✔️3.12
️✔️3.14
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.14
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.14
️✔️util
️✔️latest
️✔️3.12
️✔️3.14
️✔️vm
️✔️latest
️✔️3.12
️✔️3.14

@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi @Celinadhh,
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

@azure-client-tools-bot-prd

azure-client-tools-bot-prd Bot commented May 21, 2026

Copy link
Copy Markdown
⚠️AzureCLI-BreakingChangeTest
⚠️resource
rule cmd_name rule_message suggest_message
⚠️ 1006 - ParaAdd policy assignment create cmd policy assignment create added parameter self_serve_exemption_settings
⚠️ 1010 - ParaPropUpdate policy assignment create cmd policy assignment create update parameter enforcement_mode: updated property choices from ['Default', 'DoNotEnforce'] to ['Default', 'DoNotEnforce', 'Enroll']
⚠️ 1009 - ParaPropRemove policy assignment create cmd policy assignment create update parameter metadata: removed property nargs=+
⚠️ 1010 - ParaPropUpdate policy assignment create cmd policy assignment create update parameter metadata: updated property aaz_type from AAZDictArg to AAZAnyTypeArg
⚠️ 1010 - ParaPropUpdate policy assignment create cmd policy assignment create update parameter metadata: updated property type from Dict<String,Any> to Any
⚠️ 1006 - ParaAdd policy assignment update cmd policy assignment update added parameter self_serve_exemption_settings
⚠️ 1010 - ParaPropUpdate policy assignment update cmd policy assignment update update parameter enforcement_mode: updated property choices from ['Default', 'DoNotEnforce'] to ['Default', 'DoNotEnforce', 'Enroll']
⚠️ 1009 - ParaPropRemove policy assignment update cmd policy assignment update update parameter metadata: removed property nargs=+
⚠️ 1010 - ParaPropUpdate policy assignment update cmd policy assignment update update parameter metadata: updated property aaz_type from AAZDictArg to AAZAnyTypeArg
⚠️ 1010 - ParaPropUpdate policy assignment update cmd policy assignment update update parameter metadata: updated property type from Dict<String,Any> to Any
⚠️ 1006 - ParaAdd policy definition create cmd policy definition create added parameter external_evaluation_enforcement_settings
⚠️ 1009 - ParaPropRemove policy definition create cmd policy definition create update parameter metadata: removed property nargs=+
⚠️ 1010 - ParaPropUpdate policy definition create cmd policy definition create update parameter metadata: updated property aaz_type from AAZDictArg to AAZAnyTypeArg
⚠️ 1010 - ParaPropUpdate policy definition create cmd policy definition create update parameter metadata: updated property type from Dict<String,Any> to Any
⚠️ 1009 - ParaPropRemove policy definition create cmd policy definition create update parameter rules: removed property nargs=+
⚠️ 1010 - ParaPropUpdate policy definition create cmd policy definition create update parameter rules: updated property aaz_type from AAZDictArg to AAZAnyTypeArg
⚠️ 1010 - ParaPropUpdate policy definition create cmd policy definition create update parameter rules: updated property type from Dict<String,Any> to Any
⚠️ 1006 - ParaAdd policy definition update cmd policy definition update added parameter external_evaluation_enforcement_settings
⚠️ 1009 - ParaPropRemove policy definition update cmd policy definition update update parameter metadata: removed property nargs=+
⚠️ 1010 - ParaPropUpdate policy definition update cmd policy definition update update parameter metadata: updated property aaz_type from AAZDictArg to AAZAnyTypeArg
⚠️ 1010 - ParaPropUpdate policy definition update cmd policy definition update update parameter metadata: updated property type from Dict<String,Any> to Any
⚠️ 1009 - ParaPropRemove policy definition update cmd policy definition update update parameter rules: removed property nargs=+
⚠️ 1010 - ParaPropUpdate policy definition update cmd policy definition update update parameter rules: updated property aaz_type from AAZDictArg to AAZAnyTypeArg
⚠️ 1010 - ParaPropUpdate policy definition update cmd policy definition update update parameter rules: updated property type from Dict<String,Any> to Any
⚠️ 1011 - SubgroupAdd policy definition version sub group policy definition version added
⚠️ 1011 - SubgroupAdd policy enrollment sub group policy enrollment added
⚠️ 1009 - ParaPropRemove policy exemption create cmd policy exemption create update parameter exemption_category: removed property required=True
⚠️ 1009 - ParaPropRemove policy exemption create cmd policy exemption create update parameter metadata: removed property nargs=+
⚠️ 1010 - ParaPropUpdate policy exemption create cmd policy exemption create update parameter metadata: updated property aaz_type from AAZDictArg to AAZAnyTypeArg
⚠️ 1010 - ParaPropUpdate policy exemption create cmd policy exemption create update parameter metadata: updated property type from Dict<String,Any> to Any
⚠️ 1009 - ParaPropRemove policy exemption create cmd policy exemption create update parameter policy_assignment: removed property required=True
⚠️ 1009 - ParaPropRemove policy exemption update cmd policy exemption update update parameter metadata: removed property nargs=+
⚠️ 1010 - ParaPropUpdate policy exemption update cmd policy exemption update update parameter metadata: updated property aaz_type from AAZDictArg to AAZAnyTypeArg
⚠️ 1010 - ParaPropUpdate policy exemption update cmd policy exemption update update parameter metadata: updated property type from Dict<String,Any> to Any
⚠️ 1009 - ParaPropRemove policy set-definition create cmd policy set-definition create update parameter metadata: removed property nargs=+
⚠️ 1010 - ParaPropUpdate policy set-definition create cmd policy set-definition create update parameter metadata: updated property aaz_type from AAZDictArg to AAZAnyTypeArg
⚠️ 1010 - ParaPropUpdate policy set-definition create cmd policy set-definition create update parameter metadata: updated property type from Dict<String,Any> to Any
⚠️ 1009 - ParaPropRemove policy set-definition update cmd policy set-definition update update parameter metadata: removed property nargs=+
⚠️ 1010 - ParaPropUpdate policy set-definition update cmd policy set-definition update update parameter metadata: updated property aaz_type from AAZDictArg to AAZAnyTypeArg
⚠️ 1010 - ParaPropUpdate policy set-definition update cmd policy set-definition update update parameter metadata: updated property type from Dict<String,Any> to Any
⚠️ 1011 - SubgroupAdd policy set-definition version sub group policy set-definition version added

@microsoft-github-policy-service microsoft-github-policy-service Bot added the Auto-Assign Auto assign by bot label May 21, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot added ARM az resource/group/lock/tag/deployment/policy/managementapp/account management-group act-identity-squad labels May 21, 2026
@yonzhan

yonzhan commented May 21, 2026

Copy link
Copy Markdown
Collaborator

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

@github-actions

Copy link
Copy Markdown

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>

@yonzhan yonzhan assigned yanzhudd and isra-fel and unassigned zhoxing-ms and yanzhudd May 21, 2026
@Celinadhh Celinadhh marked this pull request as ready for review June 4, 2026 21:10
Copilot AI review requested due to automatic review settings June 4, 2026 21:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR rewrites Azure Policy CRUD command implementations to use the AAZ auto-generation toolset, onboarding to newer API versions and adding new command surfaces (definition/set-definition versions and policy enrollment).

Changes:

  • Added new command groups and command registrations for policy definition version, policy set-definition version, and policy enrollment.
  • Updated multiple policy command implementations to newer API versions and adjusted schemas (e.g., metadata/schema types, new properties like external evaluation settings and self-serve exemption).
  • Refreshed test recordings to align with new API versions and client versions.

Reviewed changes

Copilot reviewed 63 out of 87 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/azure-cli/azure/cli/command_modules/resource/tests/latest/recordings/test_resource_policy_arg_validate.yaml Updates recording to newer API version/user-agent for policy definition calls.
src/azure-cli/azure/cli/command_modules/resource/commands.py Registers new command groups for policy definition/set-definition versions and policy enrollment.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/set_definition/version/_show.py Adds generated “policy set-definition version show” command (new API version).
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/set_definition/version/_delete.py Adds generated “policy set-definition version delete” command with confirmation.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/set_definition/version/init.py Exposes new policy set-definition version command modules.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/set_definition/version/__cmd_group.py Declares the “policy set-definition version” command group.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/set_definition/_update.py Moves set-definition update to newer API version and loosens metadata/schema typing.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/set_definition/_show.py Moves set-definition show to newer API version and loosens metadata/schema typing.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/set_definition/_list.py Moves set-definition list to newer API version and loosens metadata/schema typing; sets list value required.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/set_definition/_delete.py Moves set-definition delete to newer API version.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/set_definition/_create.py Moves set-definition create to newer API version; adds example for version; loosens metadata/schema typing.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/exemption/_update.py Updates exemption update to newer preview API; adds formats/enum values; loosens metadata typing.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/exemption/_show.py Updates exemption show to newer preview API; loosens metadata typing.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/exemption/_list.py Updates exemption list to newer preview API; adjusts arg formats; loosens metadata typing; sets list value required.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/exemption/_delete.py Updates exemption delete to newer preview API.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/exemption/_create.py Updates exemption create to newer preview API; loosens metadata typing; expands selector kind enum.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/enrollment/_update.py Adds generated “policy enrollment update” command (new preview API).
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/enrollment/_show.py Adds generated “policy enrollment show” command (new preview API).
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/enrollment/_list.py Adds generated “policy enrollment list” command (new preview API) with paging.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/enrollment/_delete.py Adds generated “policy enrollment delete” command with confirmation (new preview API).
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/enrollment/_create.py Adds generated “policy enrollment create” command (new preview API).
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/enrollment/init.py Exposes new policy enrollment command modules.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/enrollment/__cmd_group.py Declares the “policy enrollment” command group.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/definition/version/_show.py Adds generated “policy definition version show” command (new API version).
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/definition/version/_delete.py Adds generated “policy definition version delete” command with confirmation (new API version).
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/definition/version/init.py Exposes new policy definition version command modules.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/definition/version/__cmd_group.py Declares the “policy definition version” command group.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/definition/_update.py Moves policy definition update to newer API; adds external evaluation settings; loosens metadata/rule typing.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/definition/_show.py Moves policy definition show to newer API; includes external evaluation settings; loosens metadata/rule typing.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/definition/_list.py Moves policy definition list to newer API; includes external evaluation settings; sets list value required.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/definition/_delete.py Moves policy definition delete to newer API.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/definition/_create.py Moves policy definition create to newer API; adds examples; adds external evaluation settings; loosens metadata/rule typing.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/non_compliance_message/_update.py Moves non-compliance-message update to newer API; updates selector usage; adds new assignment properties in schema.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/non_compliance_message/_show.py Moves non-compliance-message show to newer API; adds new assignment properties in schema.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/non_compliance_message/_list.py Moves non-compliance-message list to newer API; updates selector usage; adds new assignment properties in schema.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/non_compliance_message/_delete.py Moves non-compliance-message delete to newer API; adds new assignment properties in schema.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/non_compliance_message/_create.py Moves non-compliance-message create to newer API; updates selector usage; adds new assignment properties in schema.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/non_compliance_message/__cmd_group.py Updates non-compliance-message command group description.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/identity/_show.py Moves assignment identity show to newer API; adds new assignment properties in schema.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/identity/_remove.py Moves assignment identity remove to newer API; updates selector usage; adds new assignment properties in schema.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/identity/_assign.py Moves assignment identity assign to newer API; updates selector usage; adds new assignment properties in schema.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/identity/__cmd_group.py Updates assignment identity command group description.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/_update.py Moves assignment update to newer API; adds new enforcement mode and self-serve exemption settings; loosens metadata typing.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/_show.py Moves assignment show to newer API; includes new assignment properties in schema.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/_list.py Moves assignment list to newer API; includes new assignment properties in schema; sets list value required.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/_delete.py Moves assignment delete to newer API; includes new assignment properties in schema.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/_create.py Moves assignment create to newer API; adds enforcement mode and self-serve exemption settings; fixes docstring example.
src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/__cmd_group.py Updates “policy” command group description to include policy enrollments.
Comments suppressed due to low confidence (2)

src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/_create.py:1

  • The help text says the possible values are only Default and DoNotEnforce, but the enum now includes Enroll. Update the long-summary (and/or short-summary) to include Enroll so CLI help matches actual accepted values.
# --------------------------------------------------------------------------------------------

src/azure-cli/azure/cli/command_modules/resource/aaz/latest/policy/assignment/_update.py:1

  • Same as create: help text omits Enroll even though it’s allowed by the enum. Adjust the help text so users discover the new value via -h.
# --------------------------------------------------------------------------------------------

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

@Celinadhh

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Commenter does not have sufficient privileges for PR 33416 in repo Azure/azure-cli

Comment thread src/azure-cli/azure/cli/command_modules/resource/policy.py
Comment thread src/azure-cli/azure/cli/command_modules/resource/policy.py

@mentat9 mentat9 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good.

@Celinadhh

Copy link
Copy Markdown
Member Author

@Pan-Qi could you help me run /azp run again? thank you!

@Pan-Qi

Pan-Qi commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

/azp run

1 similar comment
@Celinadhh

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Commenter does not have sufficient privileges for PR 33416 in repo Azure/azure-cli

@Celinadhh

Copy link
Copy Markdown
Member Author

@Pan-Qi somehow that didn't trigger the pipeline. could you try commenting again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

act-identity-squad ARM az resource/group/lock/tag/deployment/policy/managementapp/account management-group Auto-Assign Auto assign by bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants