Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AppService] functionapp create: Check if storage account is network restricted #30605

Draft
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

kamperiadis
Copy link
Contributor

Related command
az functionapp create

Description
We need to throw exceptions during the function app creation process if the storage account is network restricted

Testing Guide

  1. Create a network restricted storage account by either disabling the public network access or setting the default network rule action to 'deny'
  2. Create a function app with the storage account from the previous step

History Notes


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

Copy link

azure-client-tools-bot-prd bot commented Jan 2, 2025

❌AzureCLI-FullTest
️✔️acr
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️acs
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.9
️✔️ams
️✔️latest
️✔️3.12
️✔️3.9
️✔️apim
️✔️latest
️✔️3.12
️✔️3.9
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.9
❌appservice
❌latest
❌3.12
Type Test Case Error Message Line
Failed test_functionapp_consumption_linux self = <azure.cli.testsdk.base.ExecutionResult object at 0x7f37d352d430>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7f37d9d63830>
command = 'functionapp create -g azurecli-functionapp-linux000001 -n functionapplinuxconsumption000003 -c ukwest -s clitest000002 --os-type Linux --functions-version 4 --runtime node'
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:302: 
                                        
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:129: in exception_handler
    return handle_exception(ex)
src/azure-cli-testsdk/azure/cli/testsdk/patches.py:33: in handle_main_exception
    raise ex
env/lib/python3.12/site-packages/knack/cli.py:233: in invoke
    cmd_result = self.invocation.execute(args)
src/azure-cli-core/azure/cli/core/commands/init.py:666: in execute
    raise ex
src/azure-cli-core/azure/cli/core/commands/init.py:734: in run_jobs_serially
    results.append(self.run_job(expanded_arg, cmd_copy))
src/azure-cli-core/azure/cli/core/commands/init.py:726: in run_job
    return cmd_copy.exception_handler(ex)
src/azure-cli/azure/cli/command_modules/appservice/commands.py:46: in ex_handler
    raise ex
src/azure-cli-core/azure/cli/core/commands/init.py:703: in run_job
    result = cmd_copy(params)
src/azure-cli-core/azure/cli/core/commands/init.py:336: in call
    return self.handler(*args, **kwargs)
src/azure-cli-core/azure/cli/core/commands/command_operation.py:120: in handler
    return op(**command_args)
src/azure-cli/azure/cli/command_modules/appservice/custom.py:5161: in create_functionapp
    create_file_share(cmd.cli_ctx, resource_group_name, storage_account, content_share_name)
src/azure-cli/azure/cli/command_modules/appservice/custom.py:5397: in create_file_share
    return storage_client.file_shares.create(resource_group_name, storage_account, share_name, file_share=file_share)
env/lib/python3.12/site-packages/azure/core/tracing/decorator.py:94: in wrapper_use_tracer
    return func(*args, **kwargs)
env/lib/python3.12/site-packages/azure/mgmt/storage/v2023_05_01/operations/file_shares_operations.py:643: in create
    pipeline_response: PipelineResponse = self.client.pipeline.run(  # pylint: disable=protected-access
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:229: in run
    return first_node.send(pipeline_request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/mgmt/core/policies/base.py:47: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/policies/redirect.py:197: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/policies/retry.py:532: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/policies/authentication.py:147: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:118: in send
    self.sender.send(request.http_request, **request.context.options),
env/lib/python3.12/site-packages/azure/core/pipeline/transport/requests_basic.py:355: in send
    response = self.session.request(  # type: ignore
env/lib/python3.12/site-packages/requests/sessions.py:589: in request
    resp = self.send(prep, **send_kwargs)
env/lib/python3.12/site-packages/requests/sessions.py:703: in send
    r = adapter.send(request, **kwargs)
env/lib/python3.12/site-packages/requests/adapters.py:667: in send
    resp = conn.urlopen(
env/lib/python3.12/site-packages/urllib3/connectionpool.py:715: in urlopen
    httplib_response = self.make_request(
env/lib/python3.12/site-packages/urllib3/connectionpool.py:458: in make_request
    httplib_response = conn.getresponse(buffering=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
           

self = <vcr.patch.VCRRequestsHTTPSConnection/mnt/vss/work/1/s/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/recordings/test_functionapp_consumption_linux.yaml object at 0x7f37d301c7d0>
 = False, kwargs = {'buffering': True}

    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/appservice/tests/latest/recordings/test_functionapp_consumption_linux.yaml') in your current record mode ('once').
E               No match for the request (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption0000034bf6434412e5?api-version=2023-05-01>)&nbsp;was&nbsp;found.
E               Found 1 similar requests with 1 different matcher(s) :
E               
E               1 - (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption000003ee93a5d7296f?api-version=2023-05-01>).
E               Matchers succeeded : ['method', 'scheme', 'host', 'port', 'custom_request_query_matcher']
E               Matchers failed :
E               path - assertion failure :
E               /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption0000034bf6434412e5 != /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption000003ee93a5d7296f

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

During handling of the above exception, another exception occurred:

self = <azure.cli.command_modules.appservice.tests.latest.test_functionapp_commands.FunctionAppWithLinuxConsumptionPlanTest testMethod=test_functionapp_consumption_linux>
resource_group = 'azurecli-functionapp-linux000001'
storage_account = 'clitest000002'

    @ResourceGroupPreparer(name_prefix='azurecli-functionapp-linux', location=LINUX_ASP_LOCATION_FUNCTIONAPP)
    @StorageAccountPreparer()
    def test_functionapp_consumption_linux(self, resource_group, storage_account):
        functionapp_name = self.create_random_name(
            'functionapplinuxconsumption', 40)
    
>       self.cmd('functionapp create -g {} -n {} -c {} -s {} --os-type Linux --functions-version 4 --runtime node'
                 .format(resource_group, functionapp_name, LINUX_ASP_LOCATION_FUNCTIONAPP, storage_account)).assert_with_checks([
                     JMESPathCheck('state', 'Running'),
                     JMESPathCheck('name', functionapp_name),
                     JMESPathCheck('reserved', True),
                     JMESPathCheck('kind', 'functionapp,linux'),
                     JMESPathCheck('hostNames[0]', functionapp_name + '.azurewebsites.net')])

src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:575: 
 
 
 
 
 
 
 
                                 
src/azure-cli-testsdk/azure/cli/testsdk/base.py:176: 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:251: in init
    self.in_process_execute(cli_ctx, command, expect_failure=expect_failure)
                                       _ 

self = <azure.cli.testsdk.base.ExecutionResult object at 0x7f37d352d430>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7f37d9d63830>
command = 'functionapp create -g azurecli-functionapp-linux000001 -n functionapplinuxconsumption000003 -c ukwest -s clitest000002 --os-type Linux --functions-version 4 --runtime node'
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/appservice/tests/latest/recordings/test_functionapp_consumption_linux.yaml') in your current record mode ('once').
E           No match for the request (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption0000034bf6434412e5?api-version=2023-05-01>)&nbsp;was&nbsp;found.
E           Found 1 similar requests with 1 different matcher(s) :
E           
E           1 - (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption000003ee93a5d7296f?api-version=2023-05-01>).
E           Matchers succeeded : ['method', 'scheme', 'host', 'port', '_custom_request_query_matcher']
E           Matchers failed :
E           path - assertion failure :
E           /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption0000034bf6434412e5 != /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption000003ee93a5d7296f

src/azure-cli-testsdk/azure/cli/testsdk/base.py:307: AssertionError
azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:568
Failed test_functionapp_consumption_linux_dotnet_isolated self = <azure.cli.testsdk.base.ExecutionResult object at 0x7f37d352d430>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7f37d99dc650>
command = 'functionapp create -g azurecli-functionapp-linux000001 -n functionapplinuxconsumption000003 -c ukwest -s clitest000002 --os-type Linux --runtime dotnet-isolated --runtime-version 8 --functions-version 4'
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:302: 
                                        
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:129: in exception_handler
    return handle_exception(ex)
src/azure-cli-testsdk/azure/cli/testsdk/patches.py:33: in handle_main_exception
    raise ex
env/lib/python3.12/site-packages/knack/cli.py:233: in invoke
    cmd_result = self.invocation.execute(args)
src/azure-cli-core/azure/cli/core/commands/init.py:666: in execute
    raise ex
src/azure-cli-core/azure/cli/core/commands/init.py:734: in run_jobs_serially
    results.append(self.run_job(expanded_arg, cmd_copy))
src/azure-cli-core/azure/cli/core/commands/init.py:726: in run_job
    return cmd_copy.exception_handler(ex)
src/azure-cli/azure/cli/command_modules/appservice/commands.py:46: in ex_handler
    raise ex
src/azure-cli-core/azure/cli/core/commands/init.py:703: in run_job
    result = cmd_copy(params)
src/azure-cli-core/azure/cli/core/commands/init.py:336: in call
    return self.handler(*args, **kwargs)
src/azure-cli-core/azure/cli/core/commands/command_operation.py:120: in handler
    return op(**command_args)
src/azure-cli/azure/cli/command_modules/appservice/custom.py:5161: in create_functionapp
    create_file_share(cmd.cli_ctx, resource_group_name, storage_account, content_share_name)
src/azure-cli/azure/cli/command_modules/appservice/custom.py:5397: in create_file_share
    return storage_client.file_shares.create(resource_group_name, storage_account, share_name, file_share=file_share)
env/lib/python3.12/site-packages/azure/core/tracing/decorator.py:94: in wrapper_use_tracer
    return func(*args, **kwargs)
env/lib/python3.12/site-packages/azure/mgmt/storage/v2023_05_01/operations/file_shares_operations.py:643: in create
    pipeline_response: PipelineResponse = self.client.pipeline.run(  # pylint: disable=protected-access
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:229: in run
    return first_node.send(pipeline_request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/mgmt/core/policies/base.py:47: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/policies/redirect.py:197: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/policies/retry.py:532: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/policies/authentication.py:147: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.12/site-packages/azure/core/pipeline/base.py:118: in send
    self.sender.send(request.http_request, **request.context.options),
env/lib/python3.12/site-packages/azure/core/pipeline/transport/requests_basic.py:355: in send
    response = self.session.request(  # type: ignore
env/lib/python3.12/site-packages/requests/sessions.py:589: in request
    resp = self.send(prep, **send_kwargs)
env/lib/python3.12/site-packages/requests/sessions.py:703: in send
    r = adapter.send(request, **kwargs)
env/lib/python3.12/site-packages/requests/adapters.py:667: in send
    resp = conn.urlopen(
env/lib/python3.12/site-packages/urllib3/connectionpool.py:715: in urlopen
    httplib_response = self.make_request(
env/lib/python3.12/site-packages/urllib3/connectionpool.py:458: in make_request
    httplib_response = conn.getresponse(buffering=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
           

self = <vcr.patch.VCRRequestsHTTPSConnection/mnt/vss/work/1/s/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/recordings/test_functionapp_consumption_linux_dotnet_isolated.yaml object at 0x7f37d301c0b0>
 = False, kwargs = {'buffering': True}

    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/appservice/tests/latest/recordings/test_functionapp_consumption_linux_dotnet_isolated.yaml') in your current record mode ('once').
E               No match for the request (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption000003a20e66cdf8fb?api-version=2023-05-01>)&nbsp;was&nbsp;found.
E               Found 1 similar requests with 1 different matcher(s) :
E               
E               1 - (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption000003f76e0293fd09?api-version=2023-05-01>).
E               Matchers succeeded : ['method', 'scheme', 'host', 'port', 'custom_request_query_matcher']
E               Matchers failed :
E               path - assertion failure :
E               /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption000003a20e66cdf8fb != /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption000003f76e0293fd09

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

During handling of the above exception, another exception occurred:

self = <azure.cli.command_modules.appservice.tests.latest.test_functionapp_commands.FunctionAppWithLinuxConsumptionPlanTest testMethod=test_functionapp_consumption_linux_dotnet_isolated>
resource_group = 'azurecli-functionapp-linux000001'
storage_account = 'clitest000002'

    @ResourceGroupPreparer(name_prefix='azurecli-functionapp-linux', location=LINUX_ASP_LOCATION_FUNCTIONAPP)
    @StorageAccountPreparer()
    def test_functionapp_consumption_linux_dotnet_isolated(self, resource_group, storage_account):
        functionapp_name = self.create_random_name(
            'functionapplinuxconsumption', 40)
    
>       self.cmd('functionapp create -g {} -n {} -c {} -s {} --os-type Linux --runtime dotnet-isolated --runtime-version 8 --functions-version 4'
                 .format(resource_group, functionapp_name, LINUX_ASP_LOCATION_FUNCTIONAPP, storage_account)).assert_with_checks([
                     JMESPathCheck('state', 'Running'),
                     JMESPathCheck('name', functionapp_name),
                     JMESPathCheck('reserved', True),
                     JMESPathCheck('kind', 'functionapp,linux'),
                     JMESPathCheck('hostNames[0]', functionapp_name + '.azurewebsites.net')])

src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:634: 
 
 
 
 
 
 
 
                                 
src/azure-cli-testsdk/azure/cli/testsdk/base.py:176: 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:251: in init
    self.in_process_execute(cli_ctx, command, expect_failure=expect_failure)
                                       _ 

self = <azure.cli.testsdk.base.ExecutionResult object at 0x7f37d352d430>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7f37d99dc650>
command = 'functionapp create -g azurecli-functionapp-linux000001 -n functionapplinuxconsumption000003 -c ukwest -s clitest000002 --os-type Linux --runtime dotnet-isolated --runtime-version 8 --functions-version 4'
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/appservice/tests/latest/recordings/test_functionapp_consumption_linux_dotnet_isolated.yaml') in your current record mode ('once').
E           No match for the request (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption000003a20e66cdf8fb?api-version=2023-05-01>)&nbsp;was&nbsp;found.
E           Found 1 similar requests with 1 different matcher(s) :
E           
E           1 - (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption000003f76e0293fd09?api-version=2023-05-01>).
E           Matchers succeeded : ['method', 'scheme', 'host', 'port', '_custom_request_query_matcher']
E           Matchers failed :
E           path - assertion failure :
E           /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption000003a20e66cdf8fb != /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption000003f76e0293fd09

src/azure-cli-testsdk/azure/cli/testsdk/base.py:307: AssertionError
azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:627
Failed test_functionapp_consumption_linux_java The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:587
Failed test_functionapp_windows_runtime The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:1397
Failed test_functionapp_windows_runtime_custom_handler The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:1509
Failed test_functionapp_windows_runtime_functions_version The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:1492
Failed test_functionapp_windows_runtime_java The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:1415
Failed test_functionapp_windows_runtime_version The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:1458
Failed test_functionapp_without_default_distributed_tracing The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:1638
Failed test_functionapp_on_linux_consumption_python_39 The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:1836
Failed test_functionapp_on_linux_functions_version_consumption The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:1892
Failed test_functionapp_on_linux_version_consumption The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:1809
Failed test_functionapp_elastic_premium_restricted_public_network_access_storage_configure_vnet_later The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:2845
Failed test_functionapp_elastic_premium_restricted_public_network_access_storage_vnet The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:2824
❌3.9
Type Test Case Error Message Line
Failed test_functionapp_consumption_linux self = <azure.cli.testsdk.base.ExecutionResult object at 0x7f4563981520>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7f456a38df40>
command = 'functionapp create -g azurecli-functionapp-linux000001 -n functionapplinuxconsumption000003 -c ukwest -s clitest000002 --os-type Linux --functions-version 4 --runtime node'
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:302: 
                                        
env/lib/python3.9/site-packages/knack/cli.py:245: in invoke
    exit_code = self.exception_handler(ex)
src/azure-cli-core/azure/cli/core/init.py:129: 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.9/site-packages/knack/cli.py:233: in invoke
    cmd_result = self.invocation.execute(args)
src/azure-cli-core/azure/cli/core/commands/init.py:666: in execute
    raise ex
src/azure-cli-core/azure/cli/core/commands/init.py:734: in run_jobs_serially
    results.append(self.run_job(expanded_arg, cmd_copy))
src/azure-cli-core/azure/cli/core/commands/init.py:726: in run_job
    return cmd_copy.exception_handler(ex)
src/azure-cli/azure/cli/command_modules/appservice/commands.py:46: in ex_handler
    raise ex
src/azure-cli-core/azure/cli/core/commands/init.py:703: in run_job
    result = cmd_copy(params)
src/azure-cli-core/azure/cli/core/commands/init.py:336: in call
    return self.handler(*args, **kwargs)
src/azure-cli-core/azure/cli/core/commands/command_operation.py:120: in handler
    return op(**command_args)
src/azure-cli/azure/cli/command_modules/appservice/custom.py:5161: in create_functionapp
    create_file_share(cmd.cli_ctx, resource_group_name, storage_account, content_share_name)
src/azure-cli/azure/cli/command_modules/appservice/custom.py:5397: in create_file_share
    return storage_client.file_shares.create(resource_group_name, storage_account, share_name, file_share=file_share)
env/lib/python3.9/site-packages/azure/core/tracing/decorator.py:94: in wrapper_use_tracer
    return func(*args, **kwargs)
env/lib/python3.9/site-packages/azure/mgmt/storage/v2023_05_01/operations/file_shares_operations.py:643: in create
    pipeline_response: PipelineResponse = self.client.pipeline.run(  # pylint: disable=protected-access
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:229: in run
    return first_node.send(pipeline_request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/mgmt/core/policies/base.py:47: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/policies/redirect.py:197: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/policies/retry.py:532: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/policies/authentication.py:147: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:118: in send
    self.sender.send(request.http_request, **request.context.options),
env/lib/python3.9/site-packages/azure/core/pipeline/transport/requests_basic.py:355: in send
    response = self.session.request(  # type: ignore
env/lib/python3.9/site-packages/requests/sessions.py:589: in request
    resp = self.send(prep, **send_kwargs)
env/lib/python3.9/site-packages/requests/sessions.py:703: in send
    r = adapter.send(request, **kwargs)
env/lib/python3.9/site-packages/requests/adapters.py:667: in send
    resp = conn.urlopen(
env/lib/python3.9/site-packages/urllib3/connectionpool.py:715: in urlopen
    httplib_response = self.make_request(
env/lib/python3.9/site-packages/urllib3/connectionpool.py:458: in make_request
    httplib_response = conn.getresponse(buffering=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
           

self = <vcr.patch.VCRRequestsHTTPSConnection/mnt/vss/work/1/s/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/recordings/test_functionapp_consumption_linux.yaml object at 0x7f456353f2e0>
 = False, kwargs = {'buffering': True}

    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/appservice/tests/latest/recordings/test_functionapp_consumption_linux.yaml') in your current record mode ('once').
E               No match for the request (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption000003fe8c5d93593c?api-version=2023-05-01>)&nbsp;was&nbsp;found.
E               Found 1 similar requests with 1 different matcher(s) :
E               
E               1 - (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption000003ee93a5d7296f?api-version=2023-05-01>).
E               Matchers succeeded : ['method', 'scheme', 'host', 'port', 'custom_request_query_matcher']
E               Matchers failed :
E               path - assertion failure :
E               /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption000003fe8c5d93593c != /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption000003ee93a5d7296f

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

During handling of the above exception, another exception occurred:

self = <azure.cli.command_modules.appservice.tests.latest.test_functionapp_commands.FunctionAppWithLinuxConsumptionPlanTest testMethod=test_functionapp_consumption_linux>
resource_group = 'azurecli-functionapp-linux000001'
storage_account = 'clitest000002'

    @ResourceGroupPreparer(name_prefix='azurecli-functionapp-linux', location=LINUX_ASP_LOCATION_FUNCTIONAPP)
    @StorageAccountPreparer()
    def test_functionapp_consumption_linux(self, resource_group, storage_account):
        functionapp_name = self.create_random_name(
            'functionapplinuxconsumption', 40)
    
>       self.cmd('functionapp create -g {} -n {} -c {} -s {} --os-type Linux --functions-version 4 --runtime node'
                 .format(resource_group, functionapp_name, LINUX_ASP_LOCATION_FUNCTIONAPP, storage_account)).assert_with_checks([
                     JMESPathCheck('state', 'Running'),
                     JMESPathCheck('name', functionapp_name),
                     JMESPathCheck('reserved', True),
                     JMESPathCheck('kind', 'functionapp,linux'),
                     JMESPathCheck('hostNames[0]', functionapp_name + '.azurewebsites.net')])

src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:575: 
 
 
 
 
 
 
 
                                 
src/azure-cli-testsdk/azure/cli/testsdk/base.py:176: 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:251: in init
    self.in_process_execute(cli_ctx, command, expect_failure=expect_failure)
                                       _ 

self = <azure.cli.testsdk.base.ExecutionResult object at 0x7f4563981520>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7f456a38df40>
command = 'functionapp create -g azurecli-functionapp-linux000001 -n functionapplinuxconsumption000003 -c ukwest -s clitest000002 --os-type Linux --functions-version 4 --runtime node'
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/appservice/tests/latest/recordings/test_functionapp_consumption_linux.yaml') in your current record mode ('once').
E           No match for the request (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption000003fe8c5d93593c?api-version=2023-05-01>)&nbsp;was&nbsp;found.
E           Found 1 similar requests with 1 different matcher(s) :
E           
E           1 - (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption000003ee93a5d7296f?api-version=2023-05-01>).
E           Matchers succeeded : ['method', 'scheme', 'host', 'port', '_custom_request_query_matcher']
E           Matchers failed :
E           path - assertion failure :
E           /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption000003fe8c5d93593c != /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption000003ee93a5d7296f

src/azure-cli-testsdk/azure/cli/testsdk/base.py:307: AssertionError
azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:568
Failed test_functionapp_consumption_linux_dotnet_isolated self = <azure.cli.testsdk.base.ExecutionResult object at 0x7f456395dc70>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7f456a3386a0>
command = 'functionapp create -g azurecli-functionapp-linux000001 -n functionapplinuxconsumption000003 -c ukwest -s clitest000002 --os-type Linux --runtime dotnet-isolated --runtime-version 8 --functions-version 4'
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:302: 
                                        
env/lib/python3.9/site-packages/knack/cli.py:245: in invoke
    exit_code = self.exception_handler(ex)
src/azure-cli-core/azure/cli/core/init.py:129: 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.9/site-packages/knack/cli.py:233: in invoke
    cmd_result = self.invocation.execute(args)
src/azure-cli-core/azure/cli/core/commands/init.py:666: in execute
    raise ex
src/azure-cli-core/azure/cli/core/commands/init.py:734: in run_jobs_serially
    results.append(self.run_job(expanded_arg, cmd_copy))
src/azure-cli-core/azure/cli/core/commands/init.py:726: in run_job
    return cmd_copy.exception_handler(ex)
src/azure-cli/azure/cli/command_modules/appservice/commands.py:46: in ex_handler
    raise ex
src/azure-cli-core/azure/cli/core/commands/init.py:703: in run_job
    result = cmd_copy(params)
src/azure-cli-core/azure/cli/core/commands/init.py:336: in call
    return self.handler(*args, **kwargs)
src/azure-cli-core/azure/cli/core/commands/command_operation.py:120: in handler
    return op(**command_args)
src/azure-cli/azure/cli/command_modules/appservice/custom.py:5161: in create_functionapp
    create_file_share(cmd.cli_ctx, resource_group_name, storage_account, content_share_name)
src/azure-cli/azure/cli/command_modules/appservice/custom.py:5397: in create_file_share
    return storage_client.file_shares.create(resource_group_name, storage_account, share_name, file_share=file_share)
env/lib/python3.9/site-packages/azure/core/tracing/decorator.py:94: in wrapper_use_tracer
    return func(*args, **kwargs)
env/lib/python3.9/site-packages/azure/mgmt/storage/v2023_05_01/operations/file_shares_operations.py:643: in create
    pipeline_response: PipelineResponse = self.client.pipeline.run(  # pylint: disable=protected-access
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:229: in run
    return first_node.send(pipeline_request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/mgmt/core/policies/base.py:47: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/policies/redirect.py:197: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/policies/retry.py:532: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/policies/authentication.py:147: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:86: in send
    response = self.next.send(request)
env/lib/python3.9/site-packages/azure/core/pipeline/base.py:118: in send
    self.sender.send(request.http_request, **request.context.options),
env/lib/python3.9/site-packages/azure/core/pipeline/transport/requests_basic.py:355: in send
    response = self.session.request(  # type: ignore
env/lib/python3.9/site-packages/requests/sessions.py:589: in request
    resp = self.send(prep, **send_kwargs)
env/lib/python3.9/site-packages/requests/sessions.py:703: in send
    r = adapter.send(request, **kwargs)
env/lib/python3.9/site-packages/requests/adapters.py:667: in send
    resp = conn.urlopen(
env/lib/python3.9/site-packages/urllib3/connectionpool.py:715: in urlopen
    httplib_response = self.make_request(
env/lib/python3.9/site-packages/urllib3/connectionpool.py:458: in make_request
    httplib_response = conn.getresponse(buffering=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
           

self = <vcr.patch.VCRRequestsHTTPSConnection/mnt/vss/work/1/s/src/azure-cli/azure/cli/command_modules/appservice/tests/latest/recordings/test_functionapp_consumption_linux_dotnet_isolated.yaml object at 0x7f45635b93d0>
 = False, kwargs = {'buffering': True}

    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/appservice/tests/latest/recordings/test_functionapp_consumption_linux_dotnet_isolated.yaml') in your current record mode ('once').
E               No match for the request (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption00000308cc4b94b296?api-version=2023-05-01>)&nbsp;was&nbsp;found.
E               Found 1 similar requests with 1 different matcher(s) :
E               
E               1 - (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption000003f76e0293fd09?api-version=2023-05-01>).
E               Matchers succeeded : ['method', 'scheme', 'host', 'port', 'custom_request_query_matcher']
E               Matchers failed :
E               path - assertion failure :
E               /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption00000308cc4b94b296 != /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption000003f76e0293fd09

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

During handling of the above exception, another exception occurred:

self = <azure.cli.command_modules.appservice.tests.latest.test_functionapp_commands.FunctionAppWithLinuxConsumptionPlanTest testMethod=test_functionapp_consumption_linux_dotnet_isolated>
resource_group = 'azurecli-functionapp-linux000001'
storage_account = 'clitest000002'

    @ResourceGroupPreparer(name_prefix='azurecli-functionapp-linux', location=LINUX_ASP_LOCATION_FUNCTIONAPP)
    @StorageAccountPreparer()
    def test_functionapp_consumption_linux_dotnet_isolated(self, resource_group, storage_account):
        functionapp_name = self.create_random_name(
            'functionapplinuxconsumption', 40)
    
>       self.cmd('functionapp create -g {} -n {} -c {} -s {} --os-type Linux --runtime dotnet-isolated --runtime-version 8 --functions-version 4'
                 .format(resource_group, functionapp_name, LINUX_ASP_LOCATION_FUNCTIONAPP, storage_account)).assert_with_checks([
                     JMESPathCheck('state', 'Running'),
                     JMESPathCheck('name', functionapp_name),
                     JMESPathCheck('reserved', True),
                     JMESPathCheck('kind', 'functionapp,linux'),
                     JMESPathCheck('hostNames[0]', functionapp_name + '.azurewebsites.net')])

src/azure-cli/azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:634: 
 
 
 
 
 
 
 
                                 
src/azure-cli-testsdk/azure/cli/testsdk/base.py:176: 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:251: in init
    self.in_process_execute(cli_ctx, command, expect_failure=expect_failure)
                                       _ 

self = <azure.cli.testsdk.base.ExecutionResult object at 0x7f456395dc70>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7f456a3386a0>
command = 'functionapp create -g azurecli-functionapp-linux000001 -n functionapplinuxconsumption000003 -c ukwest -s clitest000002 --os-type Linux --runtime dotnet-isolated --runtime-version 8 --functions-version 4'
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/appservice/tests/latest/recordings/test_functionapp_consumption_linux_dotnet_isolated.yaml') in your current record mode ('once').
E           No match for the request (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption00000308cc4b94b296?api-version=2023-05-01>)&nbsp;was&nbsp;found.
E           Found 1 similar requests with 1 different matcher(s) :
E           
E           1 - (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption000003f76e0293fd09?api-version=2023-05-01>).
E           Matchers succeeded : ['method', 'scheme', 'host', 'port', '_custom_request_query_matcher']
E           Matchers failed :
E           path - assertion failure :
E           /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption00000308cc4b94b296 != /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azurecli-functionapp-linux000001/providers/Microsoft.Storage/storageAccounts/clitest000002/fileServices/default/shares/functionapplinuxconsumption000003f76e0293fd09

src/azure-cli-testsdk/azure/cli/testsdk/base.py:307: AssertionError
azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:627
Failed test_functionapp_consumption_linux_java The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:587
Failed test_functionapp_windows_runtime The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:1397
Failed test_functionapp_windows_runtime_custom_handler The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:1509
Failed test_functionapp_windows_runtime_functions_version The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:1492
Failed test_functionapp_windows_runtime_java The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:1415
Failed test_functionapp_windows_runtime_version The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:1458
Failed test_functionapp_without_default_distributed_tracing The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:1638
Failed test_functionapp_on_linux_consumption_python_39 The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:1836
Failed test_functionapp_on_linux_functions_version_consumption The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:1892
Failed test_functionapp_on_linux_version_consumption The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:1809
Failed test_functionapp_elastic_premium_restricted_public_network_access_storage_configure_vnet_later The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:2845
Failed test_functionapp_elastic_premium_restricted_public_network_access_storage_vnet The error message is too long, please check the pipeline log for details. azure/cli/command_modules/appservice/tests/latest/test_functionapp_commands.py:2824
️✔️aro
️✔️latest
️✔️3.12
️✔️3.9
️✔️backup
️✔️latest
️✔️3.12
️✔️3.9
️✔️batch
️✔️latest
️✔️3.12
️✔️3.9
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.9
️✔️billing
️✔️latest
️✔️3.12
️✔️3.9
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.9
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.9
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.9
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.9
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.9
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.9
️✔️config
️✔️latest
️✔️3.12
️✔️3.9
️✔️configure
️✔️latest
️✔️3.12
️✔️3.9
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.9
️✔️container
️✔️latest
️✔️3.12
️✔️3.9
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.9
️✔️core
️✔️2018-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.9
️✔️databoxedge
️✔️2019-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️dls
️✔️latest
️✔️3.12
️✔️3.9
️✔️dms
️✔️latest
️✔️3.12
️✔️3.9
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.9
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.9
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.9
️✔️find
️✔️latest
️✔️3.12
️✔️3.9
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.9
️✔️identity
️✔️latest
️✔️3.12
️✔️3.9
️✔️iot
️✔️2019-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️keyvault
️✔️2018-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️lab
️✔️latest
️✔️3.12
️✔️3.9
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.9
️✔️maps
️✔️latest
️✔️3.12
️✔️3.9
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.9
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.9
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.9
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.9
️✔️network
️✔️2018-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.9
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.9
️✔️profile
️✔️latest
️✔️3.12
️✔️3.9
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.9
️✔️redis
️✔️latest
️✔️3.12
️✔️3.9
️✔️relay
️✔️latest
️✔️3.12
️✔️3.9
️✔️resource
️✔️2018-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️role
️✔️latest
️✔️3.12
️✔️3.9
️✔️search
️✔️latest
️✔️3.12
️✔️3.9
️✔️security
️✔️latest
️✔️3.12
️✔️3.9
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.9
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.9
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.9
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.9
️✔️sql
️✔️latest
️✔️3.12
️✔️3.9
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.9
️✔️storage
️✔️2018-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.9
️✔️telemetry
️✔️2018-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9
️✔️util
️✔️latest
️✔️3.12
️✔️3.9
️✔️vm
️✔️2018-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.12
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.12
️✔️3.9
️✔️latest
️✔️3.12
️✔️3.9

Copy link

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

Copy link

azure-client-tools-bot-prd bot commented Jan 2, 2025

⚠️AzureCLI-BreakingChangeTest
⚠️appservice
rule cmd_name rule_message suggest_message
⚠️ 1006 - ParaAdd functionapp create cmd functionapp create added parameter configure_networking_later

Copy link

github-actions bot commented Jan 2, 2025

⚠️Your changes in this PR will be released on Jan 14, 2025 due to CCOA (extend to Jan 6, 2025)

@yonzhan
Copy link
Collaborator

yonzhan commented Jan 2, 2025

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

@kamperiadis kamperiadis force-pushed the networkrestrictedstorage branch from d4417f0 to 1f976d5 Compare January 7, 2025 19:29
@kamperiadis
Copy link
Contributor Author

I notice that the assertion for tests fail if there are resources that we create on customers' behalf. Does it mean we can only run those tests in live mode instead of relying on recordings? @zhoxing-ms

@zhoxing-ms
Copy link
Contributor

I notice that the assertion for tests fail if there are resources that we create on customers' behalf. Does it mean we can only run those tests in live mode instead of relying on recordings?

Why can't these resources be dynamically created in the tests?

@kamperiadis
Copy link
Contributor Author

I notice that the assertion for tests fail if there are resources that we create on customers' behalf. Does it mean we can only run those tests in live mode instead of relying on recordings?

Why can't these resources be dynamically created in the tests?

The intention is for the command to create those resources in behalf of the customer, as opposed to the customer (or tests) to create them separately.

@zhoxing-ms
Copy link
Contributor

If the resource is dynamically created through CLI commands in the test code, the create request will also be recorded in the recording file, so it supports execution in replay mode

@kamperiadis
Copy link
Contributor Author

@zhoxing-ms The resources that are internally created by the command (not in the test code but in the command itself), the tool has trouble determining that it is the same call.

For instance, in the changes I made, I am creating a new file share resource (e.g. fileServices/default/shares/functionapp000002092f77bfe918) when the az functionapp create command is run. And the tool has trouble with that file share resource that got created internally on behalf of the customer by the az functionapp create command:

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/appservice/tests/latest/recordings/test_functionapp_elastic_premium_restricted_public_network_access_storage_vnet.yaml') in your current record mode ('once').
E No match for the request (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/funcstorage000003/fileServices/default/shares/functionapp000002092f77bfe918?api-version=2023-05-01>) was found.
E Found 2 similar requests with 1 different matcher(s) :
E
E 1 - (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/funcstorage000003?api-version=2023-05-01>)..)
E Matchers succeeded : ['method', 'scheme', 'host', 'port', '_custom_request_query_matcher']
E Matchers failed :
E path - assertion failure :
E /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/funcstorage000003/fileServices/default/shares/functionapp000002092f77bfe918 != /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/funcstorage000003
E
E 2 - (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/funcstorage000003/fileServices/default/shares/functionapp00000215a2c24cb746?api-version=2023-05-01>)..)
E Matchers succeeded : ['method', 'scheme', 'host', 'port', '_custom_request_query_matcher']
E Matchers failed :
E path - assertion failure :
E /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/funcstorage000003/fileServices/default/shares/functionapp000002092f77bfe918 != /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Storage/storageAccounts/funcstorage000003/fileServices/default/shares/functionapp00000215a2c24cb746

@zhoxing-ms
Copy link
Contributor

The resources that are internally created by the command (not in the test code but in the command itself), the tool has trouble determining that it is the same call.

Could you please show me the related code link?

@kamperiadis
Copy link
Contributor Author

@zhoxing-ms This is where we create a file share when the customer runs az functionapp create with a network restricted storage account:

create_file_share(cmd.cli_ctx, resource_group_name, storage_account, content_share_name)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot Functions az functionapp Network az network vnet/lb/nic/dns/etc... Storage az storage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants