Skip to content

[Cognitive Services] Upgrade azure-mgmt-cognitiveservices to 15.0.0b1 and add managed-network commands#33132

Open
M-Hietala wants to merge 4 commits intoAzure:devfrom
M-Hietala:M-Hietala/managed-network-clean
Open

[Cognitive Services] Upgrade azure-mgmt-cognitiveservices to 15.0.0b1 and add managed-network commands#33132
M-Hietala wants to merge 4 commits intoAzure:devfrom
M-Hietala:M-Hietala/managed-network-clean

Conversation

@M-Hietala
Copy link
Copy Markdown
Member

Related command
az cognitiveservices account managed-network
az cognitiveservices account managed-network outbound-rule

Description
Add managed network and outbound rule CLI commands for Azure Cognitive Services (AI Foundry) accounts. These commands enable users to configure network isolation and control egress traffic from managed networks.

Testing Guide

New commands (all marked is_preview=True):

Managed Network:

az cognitiveservices account managed-network create — Create a managed network with isolation mode (allow_internet_outbound / allow_only_approved_outbound) and optional firewall SKU
az cognitiveservices account managed-network update — Update managed network settings
az cognitiveservices account managed-network show — Show managed network settings
az cognitiveservices account managed-network provision-network — Provision the managed network
Outbound Rules:

az cognitiveservices account managed-network outbound-rule list — List outbound rules
az cognitiveservices account managed-network outbound-rule show — Show a specific outbound rule
az cognitiveservices account managed-network outbound-rule remove — Delete an outbound rule
az cognitiveservices account managed-network outbound-rule set — Create/update an outbound rule (FQDN, PrivateEndpoint, or ServiceTag)
az cognitiveservices account managed-network outbound-rule bulk-set — Bulk create/update outbound rules from a YAML or JSON file
SDK dependency: Requires azure-mgmt-cognitiveservices~=15.0.0b1 (API version 2026-01-15-preview). The SDK PR is Azure/azure-sdk-for-python#45942. setup.py has been updated but CI will fail until the SDK is published to PyPI.

Testing Guide

Create a managed network with internet outbound access

az cognitiveservices account managed-network create
-g myResourceGroup -n myAccount
--managed-network allow_internet_outbound

Create with approved outbound only and standard firewall

az cognitiveservices account managed-network create
-g myResourceGroup -n myAccount
--managed-network allow_only_approved_outbound
--firewall-sku Standard

Show managed network settings

az cognitiveservices account managed-network show
-g myResourceGroup -n myAccount

Provision the managed network

az cognitiveservices account managed-network provision-network
-g myResourceGroup -n myAccount

Create an FQDN outbound rule

az cognitiveservices account managed-network outbound-rule set
-g myResourceGroup -n myAccount
--rule my-fqdn-rule --type fqdn
--destination "*.openai.azure.com"

Create a ServiceTag outbound rule

az cognitiveservices account managed-network outbound-rule set
-g myResourceGroup -n myAccount
--rule my-servicetag-rule --type servicetag
--destination '{"serviceTag":"Storage","protocol":"TCP","portRanges":"443"}'

List outbound rules

az cognitiveservices account managed-network outbound-rule list
-g myResourceGroup -n myAccount

Bulk set rules from a YAML file

az cognitiveservices account managed-network outbound-rule bulk-set
-g myResourceGroup -n myAccount
--file rules.yaml

Remove an outbound rule

az cognitiveservices account managed-network outbound-rule remove
-g myResourceGroup -n myAccount
--rule my-fqdn-rule


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

Copilot AI review requested due to automatic review settings April 3, 2026 17:21
@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd bot commented Apr 3, 2026

❌AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.13
️✔️acs
️✔️latest
️✔️3.12
️✔️3.13
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.13
️✔️ams
️✔️latest
️✔️3.12
️✔️3.13
️✔️apim
️✔️latest
️✔️3.12
️✔️3.13
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.13
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️aro
️✔️latest
️✔️3.12
️✔️3.13
️✔️backup
️✔️latest
️✔️3.12
️✔️3.13
️✔️batch
️✔️latest
️✔️3.12
️✔️3.13
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.13
️✔️billing
️✔️latest
️✔️3.12
️✔️3.13
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.13
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.13
❌cognitiveservices
❌latest
❌3.12
Type Test Case Error Message Line
Failed test_project_connections_from_file self = <azure.cli.testsdk.base.ExecutionResult object at 0x7fbee1b8f5c0>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7fbee223a7b0>
command = 'cognitiveservices account project delete -n cog000002 -g clitest.rg000001 --project-name prj000003'
expect_failure = False

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

src/azure-cli-testsdk/azure/cli/testsdk/base.py:303: 
                                        
env/lib/python3.12/site-packages/knack/cli.py:245: in invoke
    exit_code = self.exception_handler(ex)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/init.py:157: in exception_handler
    return handle_exception(ex)
           ^^^^^^^^^^^^^^^^^^^^
                                        

ex = HttpResponseError("Operation returned an invalid status 'OK'"), 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 HttpResponseError 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.cognitiveservices.tests.latest.test_project_connections.CognitiveServicesProjectConnectionsTests testMethod=test_project_connections_from_file>
resource_group = 'clitest.rg000001'

    @ResourceGroupPreparer()
    def test_project_connections_from_file(self, resource_group):
    
        sname = self.create_random_name(prefix='cog', length=12)
        pname = self.create_random_name(prefix='prj', length=12)
        connname = self.create_random_name(prefix='conn', length=12)
        customdomain = self.create_random_name(prefix='csclitest', length=16)
    
        conn_file = os.path.join(self.INPUT_DATA_PATH, 'cogsvc_connection_container_registry_managed_identity.yaml')
        self.kwargs.update({
            'sname': sname,
            'connname': connname,
            'kind': 'AIServices',
            'sku': 'S0',
            'location': 'eastus',
            'pname': pname,
            'customdomain': customdomain,
            'projdisplayname': 'CLI Test Project',
            'connfile': conn_file
        })
    
        # test to create cognitive services account
        self.cmd('az cognitiveservices account create -n {sname} -g {rg} --kind {kind} --sku {sku} -l {location} --yes --assign-identity --allow-project-management true --custom-domain {customdomain}',
                 checks=[self.check('name', '{sname}'),
                         self.check('location', '{location}'),
                         self.check('sku.name', '{sku}'),
                         self.check('properties.allowProjectManagement', True),
                         self.check('properties.customSubDomainName', '{customdomain}')])
    
        prj = self.cmd('az cognitiveservices account project create -n {sname} -g {rg} --project-name {pname} --location {location} --assign-identity --display-name "{projdisplayname}"',
                            checks=[self.check('properties.provisioningState', 'Succeeded'),
                                    self.check('properties.displayName', '{projdisplayname}')]).get_output_in_json()
    
        acctprojs = self.cmd('az cognitiveservices account project list -n {sname} -g {rg}', checks=[
            self.check('length(@)', 1),
            self.check('[0].name', '{sname}/{pname}')
        ]).get_output_in_json()
    
        prj = self.cmd('az cognitiveservices account project update -n {sname} -g {rg} --project-name {pname} --description "{projdisplayname}"',
                            checks=[self.check('properties.provisioningState', 'Succeeded'),
                                    self.check('properties.description', '{projdisplayname}')]).get_output_in_json()
    
        acctconn = self.cmd('az cognitiveservices account project connection create -n {sname} -g {rg} --project-name {pname} --connection-name {connname} --file {connfile}',
                           checks=[
                               self.check('properties.authType', 'ManagedIdentity'),
                               self.check('properties.category', "ContainerRegistry"),
                               self.check('name', '{connname}')]).get_output_in_json()
    
        ret= self.cmd('az cognitiveservices account project connection list -n {sname} -g {rg} --project-name {pname}',
                                checks=[
                                    self.check('length(@)', 1)
                                ])
        self.assertEqual(ret.exit_code, 0)
    
        ret= self.cmd('az cognitiveservices account project connection show -n {sname} -g {rg} --project-name {pname} --connection-name {connname}')
        self.assertEqual(ret.exit_code, 0)
    
        # delete the cognitive services account
        ret= self.cmd('az cognitiveservices account project connection delete -n {sname} -g {rg} --project-name {pname} --connection-name {connname}')
        self.assertEqual(ret.exit_code, 0)
>       ret= self.cmd('az cognitiveservices account project delete -n {sname} -g {rg} --project-name {pname}')
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/test_project_connections.py:78: 
 
                                       
src/azure-cli-testsdk/azure/cli/testsdk/base.py:177: in cmd
    return execute(self.cli_ctx, command, expect_failure=expect_failure).assert_with_checks(checks)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-testsdk/azure/cli/testsdk/base.py:252: in init
    self.in_process_execute(cli_ctx, command, expect_failure=expect_failure)
src/azure-cli-testsdk/azure/cli/testsdk/base.py:315: in in_process_execute
    raise ex.exception
env/lib/python3.12/site-packages/knack/cli.py:233: in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/commands/init.py:677: in execute
    raise ex
src/azure-cli-core/azure/cli/core/commands/init.py:820: in run_jobs_serially
    results.append(self.run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/commands/init.py:789: in run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/commands/init.py:335: 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)
           ^^^^^^^^^^^^^^^^^^
env/lib/python3.12/site-packages/azure/core/tracing/decorator.py:119: in wrapper_use_tracer
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.12/site-packages/azure/mgmt/cognitiveservices/operations/operations.py:15223: in begin_delete
    raw_result = self.delete_initial(
 
 
 
 
 
 
                                 _ 

self = <azure.mgmt.cognitiveservices.operations._operations.ProjectsOperations object at 0x7fbee1bbb830>
resource_group_name = 'clitest.rg000001', account_name = 'cog000002'
project_name = 'prj000003', kwargs = {}
error_map = {304: <class 'azure.core.exceptions.ResourceNotModifiedError'>, 401: <class 'azure.core.exceptions.ClientAuthenticatio..., 404: <class 'azure.core.exceptions.ResourceNotFoundError'>, 409: <class 'azure.core.exceptions.ResourceExistsError'>}
_headers = {}, _params = {}
cls = <function ProjectsOperations.begin_delete.. at 0x7fbee1b7b100>
_request = <HttpRequest [DELETE], url: 'https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceG...t.rg000001/providers/Microsoft.CognitiveServices/accounts/cog000002/projects/prj000003?api-version=2026-01-15-preview'>
path_format_arguments = {'endpoint': 'https://management.azure.com/'}
_decompress = True

    def _delete_initial(
        self, resource_group_name: str, account_name: str, project_name: str, **kwargs: Any
    ) -> Iterator[bytes]:
        error_map: MutableMapping = {
            401: ClientAuthenticationError,
            404: ResourceNotFoundError,
            409: ResourceExistsError,
            304: ResourceNotModifiedError,
        }
        error_map.update(kwargs.pop("error_map", {}) or {})
    
        _headers = kwargs.pop("headers", {}) or {}
        _params = kwargs.pop("params", {}) or {}
    
        cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
    
        _request = build_projects_delete_request(
            resource_group_name=resource_group_name,
            account_name=account_name,
            project_name=project_name,
            subscription_id=self._config.subscription_id,
            api_version=self._config.api_version,
            headers=_headers,
            params=_params,
        )
        path_format_arguments = {
            "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
        }
        _request.url = self._client.format_url(_request.url, **path_format_arguments)
    
        _decompress = kwargs.pop("decompress", True)
        _stream = True
        pipeline_response: PipelineResponse = self._client._pipeline.run(  # pylint: disable=protected-access
            _request, stream=_stream, **kwargs
        )
    
        response = pipeline_response.http_response
    
        if response.status_code not in [202, 204]:
            try:
                response.read()  # Load the body in memory and close the socket
            except (StreamConsumedError, StreamClosedError):
                pass
            map_error(status_code=response.status_code, response=response, error_map=error_map)
            error = _failsafe_deserialize(
                _models.ErrorResponse,
                response,
            )
>           raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
E           azure.core.exceptions.HttpResponseError: Operation returned an invalid status 'OK'

env/lib/python3.12/site-packages/azure/mgmt/cognitiveservices/operations/_operations.py:15184: HttpResponseError
azure/cli/command_modules/cognitiveservices/tests/latest/test_project_connections.py:17
❌3.13
Type Test Case Error Message Line
Failed test_project_connections_from_file self = <azure.cli.testsdk.base.ExecutionResult object at 0x7f7064997150>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7f7065096fd0>
command = 'cognitiveservices account project delete -n cog000002 -g clitest.rg000001 --project-name prj000003'
expect_failure = False

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

src/azure-cli-testsdk/azure/cli/testsdk/base.py:303: 
                                        
env/lib/python3.13/site-packages/knack/cli.py:245: in invoke
    exit_code = self.exception_handler(ex)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/init.py:157: in exception_handler
    return handle_exception(ex)
           ^^^^^^^^^^^^^^^^^^^^
                                        

ex = HttpResponseError("Operation returned an invalid status 'OK'"), 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 HttpResponseError 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.cognitiveservices.tests.latest.test_project_connections.CognitiveServicesProjectConnectionsTests testMethod=test_project_connections_from_file>
resource_group = 'clitest.rg000001'

    @ResourceGroupPreparer()
    def test_project_connections_from_file(self, resource_group):
    
        sname = self.create_random_name(prefix='cog', length=12)
        pname = self.create_random_name(prefix='prj', length=12)
        connname = self.create_random_name(prefix='conn', length=12)
        customdomain = self.create_random_name(prefix='csclitest', length=16)
    
        conn_file = os.path.join(self.INPUT_DATA_PATH, 'cogsvc_connection_container_registry_managed_identity.yaml')
        self.kwargs.update({
            'sname': sname,
            'connname': connname,
            'kind': 'AIServices',
            'sku': 'S0',
            'location': 'eastus',
            'pname': pname,
            'customdomain': customdomain,
            'projdisplayname': 'CLI Test Project',
            'connfile': conn_file
        })
    
        # test to create cognitive services account
        self.cmd('az cognitiveservices account create -n {sname} -g {rg} --kind {kind} --sku {sku} -l {location} --yes --assign-identity --allow-project-management true --custom-domain {customdomain}',
                 checks=[self.check('name', '{sname}'),
                         self.check('location', '{location}'),
                         self.check('sku.name', '{sku}'),
                         self.check('properties.allowProjectManagement', True),
                         self.check('properties.customSubDomainName', '{customdomain}')])
    
        prj = self.cmd('az cognitiveservices account project create -n {sname} -g {rg} --project-name {pname} --location {location} --assign-identity --display-name "{projdisplayname}"',
                            checks=[self.check('properties.provisioningState', 'Succeeded'),
                                    self.check('properties.displayName', '{projdisplayname}')]).get_output_in_json()
    
        acctprojs = self.cmd('az cognitiveservices account project list -n {sname} -g {rg}', checks=[
            self.check('length(@)', 1),
            self.check('[0].name', '{sname}/{pname}')
        ]).get_output_in_json()
    
        prj = self.cmd('az cognitiveservices account project update -n {sname} -g {rg} --project-name {pname} --description "{projdisplayname}"',
                            checks=[self.check('properties.provisioningState', 'Succeeded'),
                                    self.check('properties.description', '{projdisplayname}')]).get_output_in_json()
    
        acctconn = self.cmd('az cognitiveservices account project connection create -n {sname} -g {rg} --project-name {pname} --connection-name {connname} --file {connfile}',
                           checks=[
                               self.check('properties.authType', 'ManagedIdentity'),
                               self.check('properties.category', "ContainerRegistry"),
                               self.check('name', '{connname}')]).get_output_in_json()
    
        ret= self.cmd('az cognitiveservices account project connection list -n {sname} -g {rg} --project-name {pname}',
                                checks=[
                                    self.check('length(@)', 1)
                                ])
        self.assertEqual(ret.exit_code, 0)
    
        ret= self.cmd('az cognitiveservices account project connection show -n {sname} -g {rg} --project-name {pname} --connection-name {connname}')
        self.assertEqual(ret.exit_code, 0)
    
        # delete the cognitive services account
        ret= self.cmd('az cognitiveservices account project connection delete -n {sname} -g {rg} --project-name {pname} --connection-name {connname}')
        self.assertEqual(ret.exit_code, 0)
>       ret= self.cmd('az cognitiveservices account project delete -n {sname} -g {rg} --project-name {pname}')
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/test_project_connections.py:78: 
 
                                       
src/azure-cli-testsdk/azure/cli/testsdk/base.py:177: in cmd
    return execute(self.cli_ctx, command, expect_failure=expect_failure).assert_with_checks(checks)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-testsdk/azure/cli/testsdk/base.py:252: in init
    self.in_process_execute(cli_ctx, command, expect_failure=expect_failure)
src/azure-cli-testsdk/azure/cli/testsdk/base.py:315: in in_process_execute
    raise ex.exception
env/lib/python3.13/site-packages/knack/cli.py:233: in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/commands/init.py:677: in execute
    raise ex
src/azure-cli-core/azure/cli/core/commands/init.py:820: in run_jobs_serially
    results.append(self.run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/commands/init.py:789: in run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/commands/init.py:335: 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)
           ^^^^^^^^^^^^^^^^^^
env/lib/python3.13/site-packages/azure/core/tracing/decorator.py:119: in wrapper_use_tracer
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.13/site-packages/azure/mgmt/cognitiveservices/operations/operations.py:15223: in begin_delete
    raw_result = self.delete_initial(
 
 
 
 
 
 
                                 _ 

self = <azure.mgmt.cognitiveservices.operations._operations.ProjectsOperations object at 0x7f70648c5a50>
resource_group_name = 'clitest.rg000001', account_name = 'cog000002'
project_name = 'prj000003', kwargs = {}
error_map = {304: <class 'azure.core.exceptions.ResourceNotModifiedError'>, 401: <class 'azure.core.exceptions.ClientAuthenticatio..., 404: <class 'azure.core.exceptions.ResourceNotFoundError'>, 409: <class 'azure.core.exceptions.ResourceExistsError'>}
_headers = {}, _params = {}
cls = <function ProjectsOperations.begin_delete.. at 0x7f70648c00e0>
_request = <HttpRequest [DELETE], url: 'https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceG...t.rg000001/providers/Microsoft.CognitiveServices/accounts/cog000002/projects/prj000003?api-version=2026-01-15-preview'>
path_format_arguments = {'endpoint': 'https://management.azure.com/'}
_decompress = True

    def _delete_initial(
        self, resource_group_name: str, account_name: str, project_name: str, **kwargs: Any
    ) -> Iterator[bytes]:
        error_map: MutableMapping = {
            401: ClientAuthenticationError,
            404: ResourceNotFoundError,
            409: ResourceExistsError,
            304: ResourceNotModifiedError,
        }
        error_map.update(kwargs.pop("error_map", {}) or {})
    
        _headers = kwargs.pop("headers", {}) or {}
        _params = kwargs.pop("params", {}) or {}
    
        cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
    
        _request = build_projects_delete_request(
            resource_group_name=resource_group_name,
            account_name=account_name,
            project_name=project_name,
            subscription_id=self._config.subscription_id,
            api_version=self._config.api_version,
            headers=_headers,
            params=_params,
        )
        path_format_arguments = {
            "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
        }
        _request.url = self._client.format_url(_request.url, **path_format_arguments)
    
        _decompress = kwargs.pop("decompress", True)
        _stream = True
        pipeline_response: PipelineResponse = self._client._pipeline.run(  # pylint: disable=protected-access
            _request, stream=_stream, **kwargs
        )
    
        response = pipeline_response.http_response
    
        if response.status_code not in [202, 204]:
            try:
                response.read()  # Load the body in memory and close the socket
            except (StreamConsumedError, StreamClosedError):
                pass
            map_error(status_code=response.status_code, response=response, error_map=error_map)
            error = _failsafe_deserialize(
                _models.ErrorResponse,
                response,
            )
>           raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
E           azure.core.exceptions.HttpResponseError: Operation returned an invalid status 'OK'

env/lib/python3.13/site-packages/azure/mgmt/cognitiveservices/operations/_operations.py:15184: HttpResponseError
azure/cli/command_modules/cognitiveservices/tests/latest/test_project_connections.py:17
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.13
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.13
️✔️config
️✔️latest
️✔️3.12
️✔️3.13
️✔️configure
️✔️latest
️✔️3.12
️✔️3.13
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.13
️✔️container
️✔️latest
️✔️3.12
️✔️3.13
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.13
️✔️core
️✔️latest
️✔️3.12
️✔️3.13
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.13
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.13
️✔️dls
️✔️latest
️✔️3.12
️✔️3.13
️✔️dms
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.13
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.13
️✔️find
️✔️latest
️✔️3.12
️✔️3.13
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.13
️✔️identity
️✔️latest
️✔️3.12
️✔️3.13
️✔️iot
️✔️latest
️✔️3.12
️✔️3.13
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.13
️✔️lab
️✔️latest
️✔️3.12
️✔️3.13
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️maps
️✔️latest
️✔️3.12
️✔️3.13
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.13
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.13
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.13
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.13
️✔️network
️✔️latest
️✔️3.12
️✔️3.13
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.13
️✔️postgresql
️✔️latest
️✔️3.12
️✔️3.13
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.13
️✔️profile
️✔️latest
️✔️3.12
️✔️3.13
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.13
️✔️redis
️✔️latest
️✔️3.12
️✔️3.13
️✔️relay
️✔️latest
️✔️3.12
️✔️3.13
️✔️resource
️✔️latest
️✔️3.12
️✔️3.13
️✔️role
️✔️latest
️✔️3.12
️✔️3.13
️✔️search
️✔️latest
️✔️3.12
️✔️3.13
️✔️security
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.13
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.13
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.13
️✔️sql
️✔️latest
️✔️3.12
️✔️3.13
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.13
️✔️storage
️✔️latest
️✔️3.12
️✔️3.13
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.13
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.13
️✔️util
️✔️latest
️✔️3.12
️✔️3.13
️✔️vm
️✔️latest
️✔️3.12
️✔️3.13

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

azure-client-tools-bot-prd bot commented Apr 3, 2026

⚠️AzureCLI-BreakingChangeTest
⚠️cognitiveservices
rule cmd_name rule_message suggest_message
⚠️ 1011 - SubgroupAdd cognitiveservices account managed-network sub group cognitiveservices account managed-network added

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Apr 3, 2026

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

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 3, 2026

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds preview CLI support for configuring Cognitive Services (AI Foundry) managed networks and outbound rules, alongside upgrading the azure-mgmt-cognitiveservices SDK dependency to the 15.0.0b1 (2026-01-15-preview) API surface.

Changes:

  • Bump azure-mgmt-cognitiveservices dependency to 15.0.0b1 across setup and OS-specific requirements.
  • Add new preview command groups: az cognitiveservices account managed-network and ... outbound-rule with corresponding client factories, params, help, and custom implementations.
  • Update existing test recordings to the 2026-01-15-preview API version; add (currently skipped) scenario tests plus YAML/JSON bulk-set sample inputs.

Reviewed changes

Copilot reviewed 33 out of 39 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/azure-cli/setup.py Update SDK dependency version for Cognitive Services management plane.
src/azure-cli/requirements.py3.windows.txt Pin upgraded Cognitive Services management SDK version for Windows builds.
src/azure-cli/requirements.py3.Linux.txt Pin upgraded Cognitive Services management SDK version for Linux builds.
src/azure-cli/requirements.py3.Darwin.txt Pin upgraded Cognitive Services management SDK version for macOS builds.
src/azure-cli/azure/cli/command_modules/cognitiveservices/custom.py Implement managed-network and outbound-rule custom commands; adjust API properties deserialization; add regenerate key wrapper.
src/azure-cli/azure/cli/command_modules/cognitiveservices/commands.py Wire new preview command groups and route keys regenerate to custom implementation.
src/azure-cli/azure/cli/command_modules/cognitiveservices/_client_factory.py Add client factories for managed network settings/provisioning and outbound rule operations.
src/azure-cli/azure/cli/command_modules/cognitiveservices/_params.py Define CLI arguments for managed-network and outbound-rule commands.
src/azure-cli/azure/cli/command_modules/cognitiveservices/_help.py Add help entries and examples for the new managed-network command groups.
src/azure-cli/azure/cli/command_modules/cognitiveservices/_utils.py Remap renamed credential parameter keys for SDK 15.x when loading connection definitions.
src/azure-cli/azure/cli/command_modules/cognitiveservices/linter_exclusions.yml Add linter exclusions for managed-network parameter test coverage.
src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/test_managed_network.py Add scenario tests for managed-network and outbound-rule flows (currently class-level skipped).
src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/data/managed_network/managed_network_outbound_rules.yaml Add YAML input example for outbound-rule bulk-set tests.
src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/data/managed_network/managed_network_outbound_rules.json Add JSON input example for outbound-rule bulk-set tests.
src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/recordings/test_cognitiveservices_user_owned_storage.yaml Re-record to use 2026-01-15-preview api-version.
src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/recordings/test_cognitiveservices_private_endpoint.yaml Re-record to use 2026-01-15-preview api-version.
src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/recordings/test_cognitiveservices_private_endpoint_connection.yaml Re-record to use 2026-01-15-preview api-version.
src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/recordings/test_cognitiveservices_model.yaml Re-record to use 2026-01-15-preview api-version.
src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/recordings/test_cognitiveservices_list_usages.yaml Re-record to use 2026-01-15-preview api-version.
src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/recordings/test_cognitiveservices_list_models.yaml Re-record to use 2026-01-15-preview api-version.
src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/recordings/test_cognitiveservices_identity_assign_when_create.yaml Re-record to use 2026-01-15-preview api-version.
src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/recordings/test_cognitiveservices_deployment.yaml Re-record to use 2026-01-15-preview api-version.
src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/recordings/test_cognitiveservices_crud.yaml Re-record to use 2026-01-15-preview api-version.
src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/recordings/test_cognitiveservices_create_api_properties.yaml Re-record to use 2026-01-15-preview api-version.
src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/recordings/test_cognitiveservices_account_public_network_access.yaml Re-record to use 2026-01-15-preview api-version.
src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/recordings/test_cognitiveservices_account_list_usage.yaml Re-record to use 2026-01-15-preview api-version.
src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/recordings/test_cognitiveservices_account_list_skus_legacy.yaml Re-record to use 2026-01-15-preview api-version.
src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/recordings/test_cognitiveservices_account_capabilities.yaml Re-record to use 2026-01-15-preview api-version.

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

@yonzhan yonzhan assigned necusjz and unassigned kairu-ms Apr 3, 2026
@necusjz
Copy link
Copy Markdown
Member

necusjz commented Apr 7, 2026

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@microsoft-github-policy-service
Copy link
Copy Markdown
Contributor

🔔 Routing this PR to @act-quality-productivity-squad.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants