azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

{AD} Migrate `lab` and `servicefabric` command modules to Microsoft Graph

Open jiasli opened this issue 1 year ago • 3 comments

Related command az lab az sf

Description lab and servicefabric command modules directly use azure-graphrbac SDK to call AD Graph. This PR migrates them to call Microsoft Graph.

jiasli avatar Dec 28 '23 10:12 jiasli

❌AzureCLI-FullTest
️✔️acr
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️acs
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️advisor
️✔️latest
️✔️3.11
️✔️3.9
️✔️ams
️✔️latest
️✔️3.11
️✔️3.9
️✔️apim
️✔️latest
️✔️3.11
️✔️3.9
️✔️appconfig
️✔️latest
️✔️3.11
️✔️3.9
️✔️appservice
️✔️latest
️✔️3.11
️✔️3.9
️✔️aro
️✔️latest
️✔️3.11
️✔️3.9
️✔️backup
️✔️latest
️✔️3.11
️✔️3.9
️✔️batch
️✔️latest
️✔️3.11
️✔️3.9
️✔️batchai
️✔️latest
️✔️3.11
️✔️3.9
️✔️billing
️✔️latest
️✔️3.11
️✔️3.9
️✔️botservice
️✔️latest
️✔️3.11
️✔️3.9
️✔️cdn
️✔️latest
️✔️3.11
️✔️3.9
️✔️cloud
️✔️latest
️✔️3.11
️✔️3.9
️✔️cognitiveservices
️✔️latest
️✔️3.11
️✔️3.9
️✔️config
️✔️latest
️✔️3.11
️✔️3.9
️✔️configure
️✔️latest
️✔️3.11
️✔️3.9
️✔️consumption
️✔️latest
️✔️3.11
️✔️3.9
️✔️container
️✔️latest
️✔️3.11
️✔️3.9
️✔️containerapp
️✔️latest
️✔️3.11
️✔️3.9
️✔️core
️✔️2018-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️cosmosdb
️✔️latest
️✔️3.11
️✔️3.9
️✔️databoxedge
️✔️2019-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️dla
️✔️latest
️✔️3.11
️✔️3.9
️✔️dls
️✔️latest
️✔️3.11
️✔️3.9
️✔️dms
️✔️latest
️✔️3.11
️✔️3.9
️✔️eventgrid
️✔️latest
️✔️3.11
️✔️3.9
️✔️eventhubs
️✔️latest
️✔️3.11
️✔️3.9
️✔️feedback
️✔️latest
️✔️3.11
️✔️3.9
️✔️find
️✔️latest
️✔️3.11
️✔️3.9
️✔️hdinsight
️✔️latest
️✔️3.11
️✔️3.9
️✔️identity
️✔️latest
️✔️3.11
️✔️3.9
️✔️iot
️✔️2019-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️keyvault
️✔️2018-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️kusto
️✔️latest
️✔️3.11
️✔️3.9
️✔️lab
️✔️latest
️✔️3.11
️✔️3.9
️✔️managedservices
️✔️latest
️✔️3.11
️✔️3.9
️✔️maps
️✔️latest
️✔️3.11
️✔️3.9
️✔️marketplaceordering
️✔️latest
️✔️3.11
️✔️3.9
️✔️monitor
️✔️latest
️✔️3.11
️✔️3.9
️✔️mysql
️✔️latest
️✔️3.11
️✔️3.9
️✔️netappfiles
️✔️latest
️✔️3.11
️✔️3.9
️✔️network
️✔️2018-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️policyinsights
️✔️latest
️✔️3.11
️✔️3.9
️✔️privatedns
️✔️latest
️✔️3.11
️✔️3.9
️✔️profile
️✔️latest
️✔️3.11
️✔️3.9
️✔️rdbms
️✔️latest
️✔️3.11
️✔️3.9
️✔️redis
️✔️latest
️✔️3.11
️✔️3.9
️✔️relay
️✔️latest
️✔️3.11
️✔️3.9
️✔️resource
️✔️2018-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️role
️✔️latest
️✔️3.11
️✔️3.9
️✔️search
️✔️latest
️✔️3.11
️✔️3.9
️✔️security
️✔️latest
️✔️3.11
️✔️3.9
️✔️servicebus
️✔️latest
️✔️3.11
️✔️3.9
️✔️serviceconnector
️✔️latest
️✔️3.11
️✔️3.9
❌servicefabric
❌latest
❌3.11
Type Test Case Error Message Line
Failed test_application_related self = <azure.cli.testsdk.base.ExecutionResult object at 0x7f18a42d6c10>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7f189ff62dd0>
command = 'sf cluster create -g clitest.rg000001 -c sfrp-cli-000004 -l westus --secret-identifier https://sfrp-cli-kv-000002.vault.azure.net/secrets/sfrp-cli-000003/d4ea98b8bd784e8b9cd0d5126280ad24 --vm-password "Pass@000005" --cluster-size 3'
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:301: 
                                        
env/lib/python3.11/site-packages/knack/cli.py:245: in invoke
    exit_code = self.exception_handler(ex)
src/azure-cli-core/azure/cli/core/init.py:127: in exception_handler
    return handle_exception(ex)
                                        

ex = ModuleNotFoundError("No module named 'azure.graphrbac'"), args = ()
kwargs = {}

    def handle_main_exception(ex, *args, **kwargs):  # pylint: disable=unused-argument
        if isinstance(ex, CannotOverwriteExistingCassetteException):
            # This exception usually caused by a no match HTTP request. This is a product error
            # that is caused by change of SDK invocation.
            raise ex
    
>       raise CliExecutionError(ex)
E       azure.cli.testsdk.exceptions.CliExecutionError: The CLI throws exception ModuleNotFoundError during execution and fails the command.

src/azure-cli-testsdk/azure/cli/testsdk/patches.py:35: CliExecutionError

During handling of the above exception, another exception occurred:

self = <azure.cli.command_modules.servicefabric.tests.latest.test_sf_application.ServiceFabricApplicationTests testMethod=test_application_related>
key_vault = 'sfrp-cli-kv-000002', resource_group = 'clitest.rg000001'

    @ResourceGroupPreparer()
    @KeyVaultPreparer(name_prefix='sfrp-cli-kv-', additional_params='--enabled-for-deployment --enabled-for-template-deployment')
    def test_application_related(self, key_vault, resource_group):
        self.kwargs.update({
            'kv_name': key_vault,
            'loc': 'westus',
            'cert_name': self.create_random_name('sfrp-cli-', 24),
            'cluster_name': self.create_random_name('sfrp-cli-', 24),
            'vm_password': self.create_random_name('Pass@', 9),
            'app_type_name': 'CalcServiceApp',
            'v1': '1.0',
            'app_package_v1': 'https://sfrpserviceclienttesting.blob.core.windows.net/test-apps/CalcApp_1.0.sfpkg',
            'v2': '1.2',
            'app_package_v2': 'https://sfrpserviceclienttesting.blob.core.windows.net/test-apps/CalcApp_1.2.sfpkg',
            'app_name': self.create_random_name('testApp', 11),
            'service_type': 'CalcServiceType'
        })
    
>       create_cluster_with_separate_kv(self, self.kwargs)

src/azure-cli/azure/cli/command_modules/servicefabric/tests/latest/test_sf_application.py:108: 
 
 
                                      
src/azure-cli/azure/cli/command_modules/servicefabric/tests/latest/test_util.py:33: in create_cluster_with_separate_kv
    test.cmd('az sf cluster create -g {rg} -c {cluster_name} -l {loc} --secret-identifier {cert_secret_id} --vm-password "{vm_password}" --cluster-size 3')
src/azure-cli-testsdk/azure/cli/testsdk/base.py:175: 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:250: in init
    self.in_process_execute(cli_ctx, command, expect_failure=expect_failure)
src/azure-cli-testsdk/azure/cli/testsdk/base.py:313: in in_process_execute
    raise ex.exception
env/lib/python3.11/site-packages/knack/cli.py:233: in invoke
    cmd_result = self.invocation.execute(args)
src/azure-cli-core/azure/cli/core/commands/init.py:561: in execute
    self.commands_loader.load_arguments(command)
src/azure-cli-core/azure/cli/core/init.py:521: in load_arguments
    self.command_table[command].load_arguments()  # this loads the arguments via reflection
src/azure-cli-core/azure/cli/core/commands/init.py:318: in load_arguments
    super(AzCliCommand, self).load_arguments()
env/lib/python3.11/site-packages/knack/commands.py:104: in load_arguments
    cmd_args = self.arguments_loader()
src/azure-cli-core/azure/cli/core/commands/command_operation.py:125: in arguments_loader
    op = self.get_op_handler(self.op_path)
src/azure-cli-core/azure/cli/core/commands/command_operation.py:59: in get_op_handler
    handler = import_module(mod_to_import)
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/importlib/init.py:126: in import_module
    return bootstrap.gcd_import(name[level:], package, level)
<frozen importlib.bootstrap>:1204: in gcd_import
    ???
<frozen importlib.bootstrap>:1176: in find_and_load
    ???
<frozen importlib.bootstrap>:1147: in find_and_load_unlocked
    ???
<frozen importlib.bootstrap>:690: in load_unlocked
    ???
<frozen importlib.bootstrap_external>:940: in exec_module
    ???
<frozen importlib.bootstrap>:241: in call_with_frames_removed
    ???
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
                       _ 

    # --------------------------------------------------------------------------------------------
    # Copyright (c) Microsoft Corporation. All rights reserved.
    # Licensed under the MIT License. See License.txt in the project root for license information.
    # --------------------------------------------------------------------------------------------
    
    # pylint: disable=line-too-long,too-many-lines
    
    import os
    import time
    
    from OpenSSL import crypto
    
    try:
        from urllib.parse import urlparse
    except ImportError:
        from urlparse import urlparse  # pylint: disable=import-error
    
    from msrestazure.azure_exceptions import CloudError
    
    from azure.cli.core.util import CLIError, get_file_json, b64_to_hex, sdk_no_wait
    from azure.cli.core.commands import LongRunningOperation
>   from azure.graphrbac import GraphRbacManagementClient
E   ModuleNotFoundError: No module named 'azure.graphrbac'

src/azure-cli/azure/cli/command_modules/servicefabric/custom.py:22: ModuleNotFoundError
azure/cli/command_modules/servicefabric/tests/latest/test_sf_application.py:89
Failed test_create_cluster_with_separate_kv self = <azure.cli.testsdk.base.ExecutionResult object at 0x7f189eca9550>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7f18a42c2b50>
command = 'sf cluster create -g clitest.rg000001 -c sfrp-cli-000004 -l westus --secret-identifier https://sfrp-cli-kv-000002.vault.azure.net/secrets/sfrp-cli-000003/a3edab8a2fc14e51b58fb12ed71a64b0 --vm-password "Pass123!@#" --cluster-size 3'
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:301: 
                                        
env/lib/python3.11/site-packages/knack/cli.py:245: in invoke
    exit_code = self.exception_handler(ex)
src/azure-cli-core/azure/cli/core/init.py:127: in exception_handler
    return handle_exception(ex)
                                        

ex = ModuleNotFoundError("No module named 'azure.graphrbac'"), args = ()
kwargs = {}

    def handle_main_exception(ex, *args, **kwargs):  # pylint: disable=unused-argument
        if isinstance(ex, CannotOverwriteExistingCassetteException):
            # This exception usually caused by a no match HTTP request. This is a product error
            # that is caused by change of SDK invocation.
            raise ex
    
>       raise CliExecutionError(ex)
E       azure.cli.testsdk.exceptions.CliExecutionError: The CLI throws exception ModuleNotFoundError during execution and fails the command.

src/azure-cli-testsdk/azure/cli/testsdk/patches.py:35: CliExecutionError

During handling of the above exception, another exception occurred:

self = <azure.cli.command_modules.servicefabric.tests.latest.test_sf_cluster.ServiceFabricClusterTests testMethod=test_create_cluster_with_separate_kv>
key_vault = 'sfrp-cli-kv-000002', resource_group = 'clitest.rg000001'

    @ResourceGroupPreparer()
    @KeyVaultPreparer(name_prefix='sfrp-cli-kv-', additional_params='--enabled-for-deployment --enabled-for-template-deployment')
    def test_create_cluster_with_separate_kv(self, key_vault, resource_group):
        self.kwargs.update({
            'kv_name': key_vault,
            'loc': 'westus',
            'cert_name': self.create_random_name('sfrp-cli-', 24),
            'cluster_name': self.create_random_name('sfrp-cli-', 24),
            'vm_password': "Pass123!@#",
            'policy_path': os.path.join(TEST_DIR, 'policy.json')
        })
>       create_cluster_with_separate_kv(self, self.kwargs)

src/azure-cli/azure/cli/command_modules/servicefabric/tests/latest/test_sf_cluster.py:29: 
 
 
                                      
src/azure-cli/azure/cli/command_modules/servicefabric/tests/latest/test_util.py:33: in create_cluster_with_separate_kv
    test.cmd('az sf cluster create -g {rg} -c {cluster_name} -l {loc} --secret-identifier {cert_secret_id} --vm-password "{vm_password}" --cluster-size 3')
src/azure-cli-testsdk/azure/cli/testsdk/base.py:175: 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:250: in init
    self.in_process_execute(cli_ctx, command, expect_failure=expect_failure)
src/azure-cli-testsdk/azure/cli/testsdk/base.py:313: in in_process_execute
    raise ex.exception
env/lib/python3.11/site-packages/knack/cli.py:233: in invoke
    cmd_result = self.invocation.execute(args)
src/azure-cli-core/azure/cli/core/commands/init.py:561: in execute
    self.commands_loader.load_arguments(command)
src/azure-cli-core/azure/cli/core/init.py:521: in load_arguments
    self.command_table[command].load_arguments()  # this loads the arguments via reflection
src/azure-cli-core/azure/cli/core/commands/init.py:318: in load_arguments
    super(AzCliCommand, self).load_arguments()
env/lib/python3.11/site-packages/knack/commands.py:104: in load_arguments
    cmd_args = self.arguments_loader()
src/azure-cli-core/azure/cli/core/commands/command_operation.py:125: in arguments_loader
    op = self.get_op_handler(self.op_path)
src/azure-cli-core/azure/cli/core/commands/command_operation.py:59: in get_op_handler
    handler = import_module(mod_to_import)
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/importlib/init.py:126: in import_module
    return bootstrap.gcd_import(name[level:], package, level)
<frozen importlib.bootstrap>:1204: in gcd_import
    ???
<frozen importlib.bootstrap>:1176: in find_and_load
    ???
<frozen importlib.bootstrap>:1147: in find_and_load_unlocked
    ???
<frozen importlib.bootstrap>:690: in load_unlocked
    ???
<frozen importlib.bootstrap_external>:940: in exec_module
    ???
<frozen importlib.bootstrap>:241: in call_with_frames_removed
    ???
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
                       _ 

    # --------------------------------------------------------------------------------------------
    # Copyright (c) Microsoft Corporation. All rights reserved.
    # Licensed under the MIT License. See License.txt in the project root for license information.
    # --------------------------------------------------------------------------------------------
    
    # pylint: disable=line-too-long,too-many-lines
    
    import os
    import time
    
    from OpenSSL import crypto
    
    try:
        from urllib.parse import urlparse
    except ImportError:
        from urlparse import urlparse  # pylint: disable=import-error
    
    from msrestazure.azure_exceptions import CloudError
    
    from azure.cli.core.util import CLIError, get_file_json, b64_to_hex, sdk_no_wait
    from azure.cli.core.commands import LongRunningOperation
>   from azure.graphrbac import GraphRbacManagementClient
E   ModuleNotFoundError: No module named 'azure.graphrbac'

src/azure-cli/azure/cli/command_modules/servicefabric/custom.py:22: ModuleNotFoundError
azure/cli/command_modules/servicefabric/tests/latest/test_sf_cluster.py:17
Failed test_update_settings_and_reliability self = <azure.cli.testsdk.base.ExecutionResult object at 0x7f189fb41990>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7f18a42c1210>
command = 'sf cluster create -g clitest.rg000001 -c sfrp-cli-000004 -l westus --certificate-subject-name sfrp-cli-000004 --vm-password "Pass123!@#" --cluster-size 5'
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:301: 
                                        
env/lib/python3.11/site-packages/knack/cli.py:245: in invoke
    exit_code = self.exception_handler(ex)
src/azure-cli-core/azure/cli/core/init.py:127: in exception_handler
    return handle_exception(ex)
                                        

ex = ModuleNotFoundError("No module named 'azure.graphrbac'"), args = ()
kwargs = {}

    def handle_main_exception(ex, *args, **kwargs):  # pylint: disable=unused-argument
        if isinstance(ex, CannotOverwriteExistingCassetteException):
            # This exception usually caused by a no match HTTP request. This is a product error
            # that is caused by change of SDK invocation.
            raise ex
    
>       raise CliExecutionError(ex)
E       azure.cli.testsdk.exceptions.CliExecutionError: The CLI throws exception ModuleNotFoundError during execution and fails the command.

src/azure-cli-testsdk/azure/cli/testsdk/patches.py:35: CliExecutionError

During handling of the above exception, another exception occurred:

self = <azure.cli.command_modules.servicefabric.tests.latest.test_sf_cluster.ServiceFabricClusterTests testMethod=test_update_settings_and_reliability>

    @ResourceGroupPreparer()
    def test_update_settings_and_reliability(self):
        self.kwargs.update({
            'kv_name': self.create_random_name('sfrp-cli-kv-', 24),
            'loc': 'westus',
            'cert_name': self.create_random_name('sfrp-cli-', 24),
            'cluster_name': self.create_random_name('sfrp-cli-', 24),
            'vm_password': "Pass123!@#",
            'primary_node_type': 'nt1vm',
            'new_node_type': 'nt2',
            'cluster_size': '5'
        })
>       create_cluster(self, self.kwargs)

src/azure-cli/azure/cli/command_modules/servicefabric/tests/latest/test_sf_cluster.py:44: 
 
 
                                      
src/azure-cli/azure/cli/command_modules/servicefabric/tests/latest/test_util.py:50: in create_cluster
    test.cmd('az sf cluster create -g {rg} -c {cluster_name} -l {loc} --certificate-subject-name {cluster_name} --vm-password "{vm_password}" --cluster-size {cluster_size}')
src/azure-cli-testsdk/azure/cli/testsdk/base.py:175: 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:250: in init
    self.in_process_execute(cli_ctx, command, expect_failure=expect_failure)
src/azure-cli-testsdk/azure/cli/testsdk/base.py:313: in in_process_execute
    raise ex.exception
env/lib/python3.11/site-packages/knack/cli.py:233: in invoke
    cmd_result = self.invocation.execute(args)
src/azure-cli-core/azure/cli/core/commands/init.py:561: in execute
    self.commands_loader.load_arguments(command)
src/azure-cli-core/azure/cli/core/init.py:521: in load_arguments
    self.command_table[command].load_arguments()  # this loads the arguments via reflection
src/azure-cli-core/azure/cli/core/commands/init.py:318: in load_arguments
    super(AzCliCommand, self).load_arguments()
env/lib/python3.11/site-packages/knack/commands.py:104: in load_arguments
    cmd_args = self.arguments_loader()
src/azure-cli-core/azure/cli/core/commands/command_operation.py:125: in arguments_loader
    op = self.get_op_handler(self.op_path)
src/azure-cli-core/azure/cli/core/commands/command_operation.py:59: in get_op_handler
    handler = import_module(mod_to_import)
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/importlib/init.py:126: in import_module
    return bootstrap.gcd_import(name[level:], package, level)
<frozen importlib.bootstrap>:1204: in gcd_import
    ???
<frozen importlib.bootstrap>:1176: in find_and_load
    ???
<frozen importlib.bootstrap>:1147: in find_and_load_unlocked
    ???
<frozen importlib.bootstrap>:690: in load_unlocked
    ???
<frozen importlib.bootstrap_external>:940: in exec_module
    ???
<frozen importlib.bootstrap>:241: in call_with_frames_removed
    ???
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
                       _ 

    # --------------------------------------------------------------------------------------------
    # Copyright (c) Microsoft Corporation. All rights reserved.
    # Licensed under the MIT License. See License.txt in the project root for license information.
    # --------------------------------------------------------------------------------------------
    
    # pylint: disable=line-too-long,too-many-lines
    
    import os
    import time
    
    from OpenSSL import crypto
    
    try:
        from urllib.parse import urlparse
    except ImportError:
        from urlparse import urlparse  # pylint: disable=import-error
    
    from msrestazure.azure_exceptions import CloudError
    
    from azure.cli.core.util import CLIError, get_file_json, b64_to_hex, sdk_no_wait
    from azure.cli.core.commands import LongRunningOperation
>   from azure.graphrbac import GraphRbacManagementClient
E   ModuleNotFoundError: No module named 'azure.graphrbac'

src/azure-cli/azure/cli/command_modules/servicefabric/custom.py:22: ModuleNotFoundError
azure/cli/command_modules/servicefabric/tests/latest/test_sf_cluster.py:31
❌3.9
Type Test Case Error Message Line
Failed test_application_related self = <azure.cli.testsdk.base.ExecutionResult object at 0x7effac59f3a0>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7effac5b0f10>
command = 'sf cluster create -g clitest.rg000001 -c sfrp-cli-000004 -l westus --secret-identifier https://sfrp-cli-kv-000002.vault.azure.net/secrets/sfrp-cli-000003/d4ea98b8bd784e8b9cd0d5126280ad24 --vm-password "Pass@000005" --cluster-size 3'
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:301: 
                                        
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:127: in exception_handler
    return handle_exception(ex)
                                        

ex = ModuleNotFoundError("No module named 'azure.graphrbac'"), args = ()
kwargs = {}

    def handle_main_exception(ex, *args, **kwargs):  # pylint: disable=unused-argument
        if isinstance(ex, CannotOverwriteExistingCassetteException):
            # This exception usually caused by a no match HTTP request. This is a product error
            # that is caused by change of SDK invocation.
            raise ex
    
>       raise CliExecutionError(ex)
E       azure.cli.testsdk.exceptions.CliExecutionError: The CLI throws exception ModuleNotFoundError during execution and fails the command.

src/azure-cli-testsdk/azure/cli/testsdk/patches.py:35: CliExecutionError

During handling of the above exception, another exception occurred:

self = <azure.cli.command_modules.servicefabric.tests.latest.test_sf_application.ServiceFabricApplicationTests testMethod=test_application_related>
key_vault = 'sfrp-cli-kv-000002', resource_group = 'clitest.rg000001'

    @ResourceGroupPreparer()
    @KeyVaultPreparer(name_prefix='sfrp-cli-kv-', additional_params='--enabled-for-deployment --enabled-for-template-deployment')
    def test_application_related(self, key_vault, resource_group):
        self.kwargs.update({
            'kv_name': key_vault,
            'loc': 'westus',
            'cert_name': self.create_random_name('sfrp-cli-', 24),
            'cluster_name': self.create_random_name('sfrp-cli-', 24),
            'vm_password': self.create_random_name('Pass@', 9),
            'app_type_name': 'CalcServiceApp',
            'v1': '1.0',
            'app_package_v1': 'https://sfrpserviceclienttesting.blob.core.windows.net/test-apps/CalcApp_1.0.sfpkg',
            'v2': '1.2',
            'app_package_v2': 'https://sfrpserviceclienttesting.blob.core.windows.net/test-apps/CalcApp_1.2.sfpkg',
            'app_name': self.create_random_name('testApp', 11),
            'service_type': 'CalcServiceType'
        })
    
>       create_cluster_with_separate_kv(self, self.kwargs)

src/azure-cli/azure/cli/command_modules/servicefabric/tests/latest/test_sf_application.py:108: 
 
 
                                      
src/azure-cli/azure/cli/command_modules/servicefabric/tests/latest/test_util.py:33: in create_cluster_with_separate_kv
    test.cmd('az sf cluster create -g {rg} -c {cluster_name} -l {loc} --secret-identifier {cert_secret_id} --vm-password "{vm_password}" --cluster-size 3')
src/azure-cli-testsdk/azure/cli/testsdk/base.py:175: 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:250: in init
    self.in_process_execute(cli_ctx, command, expect_failure=expect_failure)
src/azure-cli-testsdk/azure/cli/testsdk/base.py:313: in in_process_execute
    raise ex.exception
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:561: in execute
    self.commands_loader.load_arguments(command)
src/azure-cli-core/azure/cli/core/init.py:521: in load_arguments
    self.command_table[command].load_arguments()  # this loads the arguments via reflection
src/azure-cli-core/azure/cli/core/commands/init.py:318: in load_arguments
    super(AzCliCommand, self).load_arguments()
env/lib/python3.9/site-packages/knack/commands.py:104: in load_arguments
    cmd_args = self.arguments_loader()
src/azure-cli-core/azure/cli/core/commands/command_operation.py:125: in arguments_loader
    op = self.get_op_handler(self.op_path)
src/azure-cli-core/azure/cli/core/commands/command_operation.py:59: in get_op_handler
    handler = import_module(mod_to_import)
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/importlib/init.py:127: in import_module
    return bootstrap.gcd_import(name[level:], package, level)
<frozen importlib.bootstrap>:1030: in gcd_import
    ???
<frozen importlib.bootstrap>:1007: in find_and_load
    ???
<frozen importlib.bootstrap>:986: in find_and_load_unlocked
    ???
<frozen importlib.bootstrap>:680: in load_unlocked
    ???
<frozen importlib.bootstrap_external>:850: in exec_module
    ???
<frozen importlib.bootstrap>:228: in call_with_frames_removed
    ???
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
                       _ 

    import os
    import time
    
    from OpenSSL import crypto
    
    try:
        from urllib.parse import urlparse
    except ImportError:
        from urlparse import urlparse  # pylint: disable=import-error
    
    from msrestazure.azure_exceptions import CloudError
    
    from azure.cli.core.util import CLIError, get_file_json, b64_to_hex, sdk_no_wait
    from azure.cli.core.commands import LongRunningOperation
>   from azure.graphrbac import GraphRbacManagementClient
E   ModuleNotFoundError: No module named 'azure.graphrbac'

src/azure-cli/azure/cli/command_modules/servicefabric/custom.py:22: ModuleNotFoundError
azure/cli/command_modules/servicefabric/tests/latest/test_sf_application.py:89
Failed test_create_cluster_with_separate_kv self = <azure.cli.testsdk.base.ExecutionResult object at 0x7effac3243d0>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7effac3c8490>
command = 'sf cluster create -g clitest.rg000001 -c sfrp-cli-000004 -l westus --secret-identifier https://sfrp-cli-kv-000002.vault.azure.net/secrets/sfrp-cli-000003/a3edab8a2fc14e51b58fb12ed71a64b0 --vm-password "Pass123!@#" --cluster-size 3'
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:301: 
                                        
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:127: in exception_handler
    return handle_exception(ex)
                                        

ex = ModuleNotFoundError("No module named 'azure.graphrbac'"), args = ()
kwargs = {}

    def handle_main_exception(ex, *args, **kwargs):  # pylint: disable=unused-argument
        if isinstance(ex, CannotOverwriteExistingCassetteException):
            # This exception usually caused by a no match HTTP request. This is a product error
            # that is caused by change of SDK invocation.
            raise ex
    
>       raise CliExecutionError(ex)
E       azure.cli.testsdk.exceptions.CliExecutionError: The CLI throws exception ModuleNotFoundError during execution and fails the command.

src/azure-cli-testsdk/azure/cli/testsdk/patches.py:35: CliExecutionError

During handling of the above exception, another exception occurred:

self = <azure.cli.command_modules.servicefabric.tests.latest.test_sf_cluster.ServiceFabricClusterTests testMethod=test_create_cluster_with_separate_kv>
key_vault = 'sfrp-cli-kv-000002', resource_group = 'clitest.rg000001'

    @ResourceGroupPreparer()
    @KeyVaultPreparer(name_prefix='sfrp-cli-kv-', additional_params='--enabled-for-deployment --enabled-for-template-deployment')
    def test_create_cluster_with_separate_kv(self, key_vault, resource_group):
        self.kwargs.update({
            'kv_name': key_vault,
            'loc': 'westus',
            'cert_name': self.create_random_name('sfrp-cli-', 24),
            'cluster_name': self.create_random_name('sfrp-cli-', 24),
            'vm_password': "Pass123!@#",
            'policy_path': os.path.join(TEST_DIR, 'policy.json')
        })
>       create_cluster_with_separate_kv(self, self.kwargs)

src/azure-cli/azure/cli/command_modules/servicefabric/tests/latest/test_sf_cluster.py:29: 
 
 
                                      
src/azure-cli/azure/cli/command_modules/servicefabric/tests/latest/test_util.py:33: in create_cluster_with_separate_kv
    test.cmd('az sf cluster create -g {rg} -c {cluster_name} -l {loc} --secret-identifier {cert_secret_id} --vm-password "{vm_password}" --cluster-size 3')
src/azure-cli-testsdk/azure/cli/testsdk/base.py:175: 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:250: in init
    self.in_process_execute(cli_ctx, command, expect_failure=expect_failure)
src/azure-cli-testsdk/azure/cli/testsdk/base.py:313: in in_process_execute
    raise ex.exception
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:561: in execute
    self.commands_loader.load_arguments(command)
src/azure-cli-core/azure/cli/core/init.py:521: in load_arguments
    self.command_table[command].load_arguments()  # this loads the arguments via reflection
src/azure-cli-core/azure/cli/core/commands/init.py:318: in load_arguments
    super(AzCliCommand, self).load_arguments()
env/lib/python3.9/site-packages/knack/commands.py:104: in load_arguments
    cmd_args = self.arguments_loader()
src/azure-cli-core/azure/cli/core/commands/command_operation.py:125: in arguments_loader
    op = self.get_op_handler(self.op_path)
src/azure-cli-core/azure/cli/core/commands/command_operation.py:59: in get_op_handler
    handler = import_module(mod_to_import)
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/importlib/init.py:127: in import_module
    return bootstrap.gcd_import(name[level:], package, level)
<frozen importlib.bootstrap>:1030: in gcd_import
    ???
<frozen importlib.bootstrap>:1007: in find_and_load
    ???
<frozen importlib.bootstrap>:986: in find_and_load_unlocked
    ???
<frozen importlib.bootstrap>:680: in load_unlocked
    ???
<frozen importlib.bootstrap_external>:850: in exec_module
    ???
<frozen importlib.bootstrap>:228: in call_with_frames_removed
    ???
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
                       _ 

    import os
    import time
    
    from OpenSSL import crypto
    
    try:
        from urllib.parse import urlparse
    except ImportError:
        from urlparse import urlparse  # pylint: disable=import-error
    
    from msrestazure.azure_exceptions import CloudError
    
    from azure.cli.core.util import CLIError, get_file_json, b64_to_hex, sdk_no_wait
    from azure.cli.core.commands import LongRunningOperation
>   from azure.graphrbac import GraphRbacManagementClient
E   ModuleNotFoundError: No module named 'azure.graphrbac'

src/azure-cli/azure/cli/command_modules/servicefabric/custom.py:22: ModuleNotFoundError
azure/cli/command_modules/servicefabric/tests/latest/test_sf_cluster.py:17
Failed test_update_settings_and_reliability self = <azure.cli.testsdk.base.ExecutionResult object at 0x7effac3c8940>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7effac3c8520>
command = 'sf cluster create -g clitest.rg000001 -c sfrp-cli-000004 -l westus --certificate-subject-name sfrp-cli-000004 --vm-password "Pass123!@#" --cluster-size 5'
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:301: 
                                        
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:127: in exception_handler
    return handle_exception(ex)
                                        

ex = ModuleNotFoundError("No module named 'azure.graphrbac'"), args = ()
kwargs = {}

    def handle_main_exception(ex, *args, **kwargs):  # pylint: disable=unused-argument
        if isinstance(ex, CannotOverwriteExistingCassetteException):
            # This exception usually caused by a no match HTTP request. This is a product error
            # that is caused by change of SDK invocation.
            raise ex
    
>       raise CliExecutionError(ex)
E       azure.cli.testsdk.exceptions.CliExecutionError: The CLI throws exception ModuleNotFoundError during execution and fails the command.

src/azure-cli-testsdk/azure/cli/testsdk/patches.py:35: CliExecutionError

During handling of the above exception, another exception occurred:

self = <azure.cli.command_modules.servicefabric.tests.latest.test_sf_cluster.ServiceFabricClusterTests testMethod=test_update_settings_and_reliability>

    @ResourceGroupPreparer()
    def test_update_settings_and_reliability(self):
        self.kwargs.update({
            'kv_name': self.create_random_name('sfrp-cli-kv-', 24),
            'loc': 'westus',
            'cert_name': self.create_random_name('sfrp-cli-', 24),
            'cluster_name': self.create_random_name('sfrp-cli-', 24),
            'vm_password': "Pass123!@#",
            'primary_node_type': 'nt1vm',
            'new_node_type': 'nt2',
            'cluster_size': '5'
        })
>       create_cluster(self, self.kwargs)

src/azure-cli/azure/cli/command_modules/servicefabric/tests/latest/test_sf_cluster.py:44: 
 
 
                                      
src/azure-cli/azure/cli/command_modules/servicefabric/tests/latest/test_util.py:50: in create_cluster
    test.cmd('az sf cluster create -g {rg} -c {cluster_name} -l {loc} --certificate-subject-name {cluster_name} --vm-password "{vm_password}" --cluster-size {cluster_size}')
src/azure-cli-testsdk/azure/cli/testsdk/base.py:175: 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:250: in init
    self.in_process_execute(cli_ctx, command, expect_failure=expect_failure)
src/azure-cli-testsdk/azure/cli/testsdk/base.py:313: in in_process_execute
    raise ex.exception
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:561: in execute
    self.commands_loader.load_arguments(command)
src/azure-cli-core/azure/cli/core/init.py:521: in load_arguments
    self.command_table[command].load_arguments()  # this loads the arguments via reflection
src/azure-cli-core/azure/cli/core/commands/init.py:318: in load_arguments
    super(AzCliCommand, self).load_arguments()
env/lib/python3.9/site-packages/knack/commands.py:104: in load_arguments
    cmd_args = self.arguments_loader()
src/azure-cli-core/azure/cli/core/commands/command_operation.py:125: in arguments_loader
    op = self.get_op_handler(self.op_path)
src/azure-cli-core/azure/cli/core/commands/command_operation.py:59: in get_op_handler
    handler = import_module(mod_to_import)
/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/importlib/init.py:127: in import_module
    return bootstrap.gcd_import(name[level:], package, level)
<frozen importlib.bootstrap>:1030: in gcd_import
    ???
<frozen importlib.bootstrap>:1007: in find_and_load
    ???
<frozen importlib.bootstrap>:986: in find_and_load_unlocked
    ???
<frozen importlib.bootstrap>:680: in load_unlocked
    ???
<frozen importlib.bootstrap_external>:850: in exec_module
    ???
<frozen importlib.bootstrap>:228: in call_with_frames_removed
    ???
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
                       _ 

    import os
    import time
    
    from OpenSSL import crypto
    
    try:
        from urllib.parse import urlparse
    except ImportError:
        from urlparse import urlparse  # pylint: disable=import-error
    
    from msrestazure.azure_exceptions import CloudError
    
    from azure.cli.core.util import CLIError, get_file_json, b64_to_hex, sdk_no_wait
    from azure.cli.core.commands import LongRunningOperation
>   from azure.graphrbac import GraphRbacManagementClient
E   ModuleNotFoundError: No module named 'azure.graphrbac'

src/azure-cli/azure/cli/command_modules/servicefabric/custom.py:22: ModuleNotFoundError
azure/cli/command_modules/servicefabric/tests/latest/test_sf_cluster.py:31
️✔️signalr
️✔️latest
️✔️3.11
️✔️3.9
️✔️sql
️✔️latest
️✔️3.11
️✔️3.9
️✔️sqlvm
️✔️latest
️✔️3.11
️✔️3.9
️✔️storage
️✔️2018-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️synapse
️✔️latest
️✔️3.11
️✔️3.9
️✔️telemetry
️✔️2018-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9
️✔️util
️✔️latest
️✔️3.11
️✔️3.9
️✔️vm
️✔️2018-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.11
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.11
️✔️3.9
️✔️latest
️✔️3.11
️✔️3.9

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

AD

yonzhan avatar Dec 28 '23 10:12 yonzhan

If az-cli isn't being updated to remove EOL libraries, I guess it means that it is effectively unsupported.

virtualjack avatar Jul 10 '24 20:07 virtualjack