Skip to content

[Cognitive Services] az cognitiveservices account update: Add support for setting cost-control-connections - #34453

Draft
Darren Cohen (dargilco) wants to merge 13 commits into
Azure:devfrom
dargilco:dargilco/cost-control-dec-release
Draft

Darren Cohen (dargilco) wants to merge 13 commits into
Azure:devfrom
dargilco:dargilco/cost-control-dec-release

Conversation

@dargilco

@dargilco Darren Cohen (dargilco) commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

🤖 PR Validation — ❌ Action needed

Breaking Changes Tests Suppressions
⚠️ None ❌ 128/130 ️✔️ None
⚠️AzureCLI-BreakingChangeTest
⚠️cognitiveservices
rule cmd_name rule_message suggest_message
⚠️ 1006 - ParaAdd cognitiveservices account update cmd cognitiveservices account update added parameter cost_control_connections
❌AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.14
️✔️acs
️✔️latest
️✔️3.12
️✔️3.14
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.14
️✔️ams
️✔️latest
️✔️3.12
️✔️3.14
️✔️apim
️✔️latest
️✔️3.12
️✔️3.14
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.14
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.14
️✔️aro
️✔️latest
️✔️3.12
️✔️3.14
️✔️backup
️✔️latest
️✔️3.12
️✔️3.14
️✔️batch
️✔️latest
️✔️3.12
️✔️3.14
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.14
️✔️billing
️✔️latest
️✔️3.12
️✔️3.14
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.14
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.14
❌cognitiveservices
❌latest
❌3.12
Type Test Case Error Message Line
Failed test_cognitiveservices_project_costcontrol_crud self = <azure.cli.testsdk.base.ExecutionResult object at 0x7fda92269400>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7fda92a31eb0>
command = 'cognitiveservices account project create --resource-group dcohen-az-cli-project-costcontrol-rg-000001 --name test-acc...000002 --project-name test-project-000003 --location westus2 --assign-identity --display-name "Cost control CRUD test"'
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:304: 
                                        
env/lib/python3.12/site-packages/knack/cli.py:245: in invoke
    exit_code = self.exception_handler(ex)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/init.py:153: in exception_handler
    return handle_exception(ex)
           ^^^^^^^^^^^^^^^^^^^^
                                        

ex = HttpResponseError("Operation returned an invalid status 'Created'")
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:37: CliExecutionError

During handling of the above exception, another exception occurred:

self = <azure.cli.command_modules.cognitiveservices.tests.latest.test_costcontrol.CognitiveServicesCostControlScenarioTests testMethod=test_cognitiveservices_project_costcontrol_crud>
resource_group = 'dcohen-az-cli-project-costcontrol-rg-000001'

    @ResourceGroupPreparer(
        name_prefix='dcohen-az-cli-project-costcontrol-rg-',
        location='westus2',
        random_name_length=47,
    )
    def test_cognitiveservices_project_costcontrol_crud(self, resource_group):
        self.prepare_test_parameters(resource_group)
        self.kwargs.update({
            'project_name': self.create_random_name('test-project-', 23),
            'custom_domain': self.create_random_name('cli-costcontrol-', 26),
        })
    
        self.cmd(
            'cognitiveservices account create '
            '--resource-group {resource_group} --name {account_name} '
            '--kind AIServices --sku S0 --location {location} --yes '
            '--assign-identity --allow-project-management true --custom-domain {custom_domain}',
            checks=[
                self.check('name', '{account_name}'),
                self.check('properties.allowProjectManagement', True),
            ],
        )
>       self.cmd(
            'cognitiveservices account project create '
            '--resource-group {resource_group} --name {account_name} '
            '--project-name {project_name} --location {location} '
            '--assign-identity --display-name "Cost control CRUD test"',
            checks=[
                self.check('properties.provisioningState', 'Succeeded'),
                self.check('properties.displayName', 'Cost control CRUD test'),
            ],
        )

src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/test_costcontrol.py:187: 
 
 
                                      
src/azure-cli-testsdk/azure/cli/testsdk/base.py:178: 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:253: in init
    self.in_process_execute(cli_ctx, command, expect_failure=expect_failure)
src/azure-cli-testsdk/azure/cli/testsdk/base.py:316: 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)
           ^^^^^^^^^^^^^^^^^^
src/azure-cli/azure/cli/command_modules/cognitiveservices/custom.py:2719: in project_create
    return client.begin_create(resource_group_name, account_name, project_name, project, polling=no_wait)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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:18828: in begin_create
    raw_result = self.create_initial(
 
 
 
 
 
 
 
                                 

self = <azure.mgmt.cognitiveservices.operations._operations.ProjectsOperations object at 0x7fda91f1de80>
resource_group_name = 'dcohen-az-cli-project-costcontrol-rg-000001'
account_name = 'test-account-000002', project_name = 'test-project-000003'
project = {'properties': {'displayName': 'Cost control CRUD test'}, 'location': 'westus2', 'identity': {'type': 'SystemAssigned'}}
kwargs = {}

    def _create_initial(
        self,
        resource_group_name: str,
        account_name: str,
        project_name: str,
        project: Union[_models.Project, _types.Project, IO[bytes]],
        **kwargs: Any
    ) -> Iterator[bytes]:
        error_map: MutableMapping = {
            401: ClientAuthenticationError,
            404: ResourceNotFoundError,
            409: ResourceExistsError,
            304: ResourceNotModifiedError,
        }
        error_map.update(kwargs.pop("error_map", {}) or {})
    
        _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
        _params = kwargs.pop("params", {}) or {}
    
        content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
        cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
    
        content_type = content_type or "application/json"
        _content = None
        if isinstance(project, (IOBase, bytes)):
            _content = project
        else:
            _content = json.dumps(project, cls=SdkJSONEncoder, exclude_readonly=True)  # type: ignore
    
        _request = build_projects_create_request(
            resource_group_name=resource_group_name,
            account_name=account_name,
            project_name=project_name,
            subscription_id=self._config.subscription_id,
            content_type=content_type,
            api_version=self._config.api_version,
            content=_content,
            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 [200, 202]:
            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 'Created'
E           Content: {"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dcohen-az-cli-project-costcontrol-rg-000001/providers/Microsoft.CognitiveServices/accounts/test-account-000002/projects/test-project-000003","name":"test-account-000002/test-project-000003","type":"Microsoft.CognitiveServices/accounts/projects","etag":""2b00c793-0000-0800-0000-6aea5f2e0000"","location":"westus2","kind":"AIServices","properties":{"endpoints":{"AI Foundry API":"https://cli-costcontrol-000004.services.ai.azure.com/api/projects/test-project-000003"},"displayName":"Cost&nbsp;control&nbsp;CRUD&nbsp;test","amlWorkspace":{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dcohen-az-cli-project-costcontrol-rg-000001/providers/Microsoft.MachineLearningServices/workspaces/test-account-000002@test-project-000003@AML","internalId":"617acfa2-065c-4fe0-a23c-ccd51c02163e","amlWorkspace":"test-account-000002@test-project-000003@AML"},"isDefault":true,"internalId":"617acfa2065c4fe0a23cccd51c02163e","provisioningState":"Succeeded"},"identity":{"principalId":"aa89c813-17f1-4f24-822d-cfbdd7d57714","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","type":"SystemAssigned"},"systemData":{"createdBy":"test@example.com","createdByType":"User","createdAt":"2026-11-03T22:24:44.4337555Z","lastModifiedBy":"test@example.com","lastModifiedByType":"User","lastModifiedAt":"2026-11-03T22:24:44.4337555Z"}}

env/lib/python3.12/site-packages/azure/mgmt/cognitiveservices/operations/_operations.py:18678: HttpResponseError
azure/cli/command_modules/cognitiveservices/tests/latest/test_costcontrol.py:164
Failed test_project_connections_from_file self = <azure.cli.testsdk.base.ExecutionResult object at 0x7fda924dd2e0>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7fda92a071a0>
command = 'cognitiveservices account project create -n cog000002 -g clitest.rg000001 --project-name prj000003 --location eastus --assign-identity --display-name "CLI Test Project"'
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:304: 
                                        
env/lib/python3.12/site-packages/knack/cli.py:245: in invoke
    exit_code = self.exception_handler(ex)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/init.py:153: in exception_handler
    return handle_exception(ex)
           ^^^^^^^^^^^^^^^^^^^^
                                        

ex = HttpResponseError("Operation returned an invalid status 'Created'")
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:37: 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()

src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/test_project_connections.py:47: 
 
                                       
src/azure-cli-testsdk/azure/cli/testsdk/base.py:178: 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:253: in init
    self.in_process_execute(cli_ctx, command, expect_failure=expect_failure)
src/azure-cli-testsdk/azure/cli/testsdk/base.py:316: 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)
           ^^^^^^^^^^^^^^^^^^
src/azure-cli/azure/cli/command_modules/cognitiveservices/custom.py:2719: in project_create
    return client.begin_create(resource_group_name, account_name, project_name, project, polling=no_wait)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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:18828: in begin_create
    raw_result = self.create_initial(
 
 
 
 
 
 
                                 _ 

self = <azure.mgmt.cognitiveservices.operations._operations.ProjectsOperations object at 0x7fda92309b80>
resource_group_name = 'clitest.rg000001', account_name = 'cog000002'
project_name = 'prj000003'
project = {'properties': {'displayName': 'CLI Test Project'}, 'location': 'eastus', 'identity': {'type': 'SystemAssigned'}}
kwargs = {}

    def _create_initial(
        self,
        resource_group_name: str,
        account_name: str,
        project_name: str,
        project: Union[_models.Project, _types.Project, IO[bytes]],
        **kwargs: Any
    ) -> Iterator[bytes]:
        error_map: MutableMapping = {
            401: ClientAuthenticationError,
            404: ResourceNotFoundError,
            409: ResourceExistsError,
            304: ResourceNotModifiedError,
        }
        error_map.update(kwargs.pop("error_map", {}) or {})
    
        _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
        _params = kwargs.pop("params", {}) or {}
    
        content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
        cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
    
        content_type = content_type or "application/json"
        _content = None
        if isinstance(project, (IOBase, bytes)):
            _content = project
        else:
            _content = json.dumps(project, cls=SdkJSONEncoder, exclude_readonly=True)  # type: ignore
    
        _request = build_projects_create_request(
            resource_group_name=resource_group_name,
            account_name=account_name,
            project_name=project_name,
            subscription_id=self._config.subscription_id,
            content_type=content_type,
            api_version=self._config.api_version,
            content=_content,
            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 [200, 202]:
            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 'Created'
E           Content: {"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.CognitiveServices/accounts/cog000002/projects/prj000003","name":"cog000002/prj000003","type":"Microsoft.CognitiveServices/accounts/projects","etag":""0f00c318-0000-0100-0000-6900d8ca0000"","location":"eastus","kind":"AIServices","properties":{"endpoints":{"AI Foundry API":"https://csclitest000005.services.ai.azure.com/api/projects/prj000003"},"displayName":"CLI&nbsp;Test&nbsp;Project","isDefault":true,"internalId":"729a191a437b438f9577ecb92956c0e3","provisioningState":"Succeeded"},"identity":{"principalId":"4a55556e-73ea-4b30-b09f-4ef469ae1d0f","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","type":"SystemAssigned"},"systemData":{"createdBy":"test@example.com","createdByType":"User","createdAt":"2025-10-28T14:52:50.6820074Z","lastModifiedBy":"test@example.com","lastModifiedByType":"User","lastModifiedAt":"2025-10-28T14:52:50.6820074Z"}}

env/lib/python3.12/site-packages/azure/mgmt/cognitiveservices/operations/_operations.py:18678: HttpResponseError
azure/cli/command_modules/cognitiveservices/tests/latest/test_project_connections.py:17
❌3.14
Type Test Case Error Message Line
Failed test_cognitiveservices_project_costcontrol_crud self = <azure.cli.testsdk.base.ExecutionResult object at 0x7f10101b74d0>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7f100fcb8cd0>
command = 'cognitiveservices account project create --resource-group dcohen-az-cli-project-costcontrol-rg-000001 --name test-acc...000002 --project-name test-project-000003 --location westus2 --assign-identity --display-name "Cost control CRUD test"'
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:304: 
                                        
env/lib/python3.14/site-packages/knack/cli.py:245: in invoke
    exit_code = self.exception_handler(ex)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/init.py:153: in exception_handler
    return handle_exception(ex)
           ^^^^^^^^^^^^^^^^^^^^
                                        

ex = HttpResponseError("Operation returned an invalid status 'Created'")
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:37: CliExecutionError

During handling of the above exception, another exception occurred:

self = <azure.cli.command_modules.cognitiveservices.tests.latest.test_costcontrol.CognitiveServicesCostControlScenarioTests testMethod=test_cognitiveservices_project_costcontrol_crud>
resource_group = 'dcohen-az-cli-project-costcontrol-rg-000001'

    @ResourceGroupPreparer(
        name_prefix='dcohen-az-cli-project-costcontrol-rg-',
        location='westus2',
        random_name_length=47,
    )
    def test_cognitiveservices_project_costcontrol_crud(self, resource_group):
        self.prepare_test_parameters(resource_group)
        self.kwargs.update({
            'project_name': self.create_random_name('test-project-', 23),
            'custom_domain': self.create_random_name('cli-costcontrol-', 26),
        })
    
        self.cmd(
            'cognitiveservices account create '
            '--resource-group {resource_group} --name {account_name} '
            '--kind AIServices --sku S0 --location {location} --yes '
            '--assign-identity --allow-project-management true --custom-domain {custom_domain}',
            checks=[
                self.check('name', '{account_name}'),
                self.check('properties.allowProjectManagement', True),
            ],
        )
>       self.cmd(
            'cognitiveservices account project create '
            '--resource-group {resource_group} --name {account_name} '
            '--project-name {project_name} --location {location} '
            '--assign-identity --display-name "Cost control CRUD test"',
            checks=[
                self.check('properties.provisioningState', 'Succeeded'),
                self.check('properties.displayName', 'Cost control CRUD test'),
            ],
        )

src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/test_costcontrol.py:187: 
 
 
                                      
src/azure-cli-testsdk/azure/cli/testsdk/base.py:178: 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:253: in init
    self.in_process_execute(cli_ctx, command, expect_failure=expect_failure)
src/azure-cli-testsdk/azure/cli/testsdk/base.py:316: in in_process_execute
    raise ex.exception
env/lib/python3.14/site-packages/knack/cli.py:233: in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/commands/init.py:677: in execute
    raise ex
src/azure-cli-core/azure/cli/core/commands/init.py:820: in run_jobs_serially
    results.append(self.run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/commands/init.py:789: in run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/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)
           ^^^^^^^^^^^^^^^^^^
src/azure-cli/azure/cli/command_modules/cognitiveservices/custom.py:2719: in project_create
    return client.begin_create(resource_group_name, account_name, project_name, project, polling=no_wait)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/tracing/decorator.py:119: in wrapper_use_tracer
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/mgmt/cognitiveservices/operations/operations.py:18828: in begin_create
    raw_result = self.create_initial(
 
 
 
 
 
 
 
                                 

self = <azure.mgmt.cognitiveservices.operations._operations.ProjectsOperations object at 0x7f100fe74550>
resource_group_name = 'dcohen-az-cli-project-costcontrol-rg-000001'
account_name = 'test-account-000002', project_name = 'test-project-000003'
project = {'properties': {'displayName': 'Cost control CRUD test'}, 'location': 'westus2', 'identity': {'type': 'SystemAssigned'}}
kwargs = {}

    def _create_initial(
        self,
        resource_group_name: str,
        account_name: str,
        project_name: str,
        project: Union[_models.Project, _types.Project, IO[bytes]],
        **kwargs: Any
    ) -> Iterator[bytes]:
        error_map: MutableMapping = {
            401: ClientAuthenticationError,
            404: ResourceNotFoundError,
            409: ResourceExistsError,
            304: ResourceNotModifiedError,
        }
        error_map.update(kwargs.pop("error_map", {}) or {})
    
        _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
        _params = kwargs.pop("params", {}) or {}
    
        content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
        cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
    
        content_type = content_type or "application/json"
        _content = None
        if isinstance(project, (IOBase, bytes)):
            _content = project
        else:
            _content = json.dumps(project, cls=SdkJSONEncoder, exclude_readonly=True)  # type: ignore
    
        _request = build_projects_create_request(
            resource_group_name=resource_group_name,
            account_name=account_name,
            project_name=project_name,
            subscription_id=self._config.subscription_id,
            content_type=content_type,
            api_version=self._config.api_version,
            content=_content,
            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 [200, 202]:
            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 'Created'
E           Content: {"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dcohen-az-cli-project-costcontrol-rg-000001/providers/Microsoft.CognitiveServices/accounts/test-account-000002/projects/test-project-000003","name":"test-account-000002/test-project-000003","type":"Microsoft.CognitiveServices/accounts/projects","etag":""2b00c793-0000-0800-0000-6aea5f2e0000"","location":"westus2","kind":"AIServices","properties":{"endpoints":{"AI Foundry API":"https://cli-costcontrol-000004.services.ai.azure.com/api/projects/test-project-000003"},"displayName":"Cost&nbsp;control&nbsp;CRUD&nbsp;test","amlWorkspace":{"resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dcohen-az-cli-project-costcontrol-rg-000001/providers/Microsoft.MachineLearningServices/workspaces/test-account-000002@test-project-000003@AML","internalId":"617acfa2-065c-4fe0-a23c-ccd51c02163e","amlWorkspace":"test-account-000002@test-project-000003@AML"},"isDefault":true,"internalId":"617acfa2065c4fe0a23cccd51c02163e","provisioningState":"Succeeded"},"identity":{"principalId":"aa89c813-17f1-4f24-822d-cfbdd7d57714","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","type":"SystemAssigned"},"systemData":{"createdBy":"test@example.com","createdByType":"User","createdAt":"2026-11-03T22:24:44.4337555Z","lastModifiedBy":"test@example.com","lastModifiedByType":"User","lastModifiedAt":"2026-11-03T22:24:44.4337555Z"}}

env/lib/python3.14/site-packages/azure/mgmt/cognitiveservices/operations/_operations.py:18678: HttpResponseError
azure/cli/command_modules/cognitiveservices/tests/latest/test_costcontrol.py:164
Failed test_project_connections_from_file self = <azure.cli.testsdk.base.ExecutionResult object at 0x7f10101b7890>
cli_ctx = <azure.cli.core.mock.DummyCli object at 0x7f1011604f50>
command = 'cognitiveservices account project create -n cog000002 -g clitest.rg000001 --project-name prj000003 --location eastus --assign-identity --display-name "CLI Test Project"'
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:304: 
                                        
env/lib/python3.14/site-packages/knack/cli.py:245: in invoke
    exit_code = self.exception_handler(ex)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/init.py:153: in exception_handler
    return handle_exception(ex)
           ^^^^^^^^^^^^^^^^^^^^
                                        

ex = HttpResponseError("Operation returned an invalid status 'Created'")
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:37: 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()

src/azure-cli/azure/cli/command_modules/cognitiveservices/tests/latest/test_project_connections.py:47: 
 
                                       
src/azure-cli-testsdk/azure/cli/testsdk/base.py:178: 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:253: in init
    self.in_process_execute(cli_ctx, command, expect_failure=expect_failure)
src/azure-cli-testsdk/azure/cli/testsdk/base.py:316: in in_process_execute
    raise ex.exception
env/lib/python3.14/site-packages/knack/cli.py:233: in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/commands/init.py:677: in execute
    raise ex
src/azure-cli-core/azure/cli/core/commands/init.py:820: in run_jobs_serially
    results.append(self.run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/commands/init.py:789: in run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
src/azure-cli-core/azure/cli/core/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)
           ^^^^^^^^^^^^^^^^^^
src/azure-cli/azure/cli/command_modules/cognitiveservices/custom.py:2719: in project_create
    return client.begin_create(resource_group_name, account_name, project_name, project, polling=no_wait)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/core/tracing/decorator.py:119: in wrapper_use_tracer
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
env/lib/python3.14/site-packages/azure/mgmt/cognitiveservices/operations/operations.py:18828: in begin_create
    raw_result = self.create_initial(
 
 
 
 
 
 
                                 _ 

self = <azure.mgmt.cognitiveservices.operations._operations.ProjectsOperations object at 0x7f100fe74550>
resource_group_name = 'clitest.rg000001', account_name = 'cog000002'
project_name = 'prj000003'
project = {'properties': {'displayName': 'CLI Test Project'}, 'location': 'eastus', 'identity': {'type': 'SystemAssigned'}}
kwargs = {}

    def _create_initial(
        self,
        resource_group_name: str,
        account_name: str,
        project_name: str,
        project: Union[_models.Project, _types.Project, IO[bytes]],
        **kwargs: Any
    ) -> Iterator[bytes]:
        error_map: MutableMapping = {
            401: ClientAuthenticationError,
            404: ResourceNotFoundError,
            409: ResourceExistsError,
            304: ResourceNotModifiedError,
        }
        error_map.update(kwargs.pop("error_map", {}) or {})
    
        _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
        _params = kwargs.pop("params", {}) or {}
    
        content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
        cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
    
        content_type = content_type or "application/json"
        _content = None
        if isinstance(project, (IOBase, bytes)):
            _content = project
        else:
            _content = json.dumps(project, cls=SdkJSONEncoder, exclude_readonly=True)  # type: ignore
    
        _request = build_projects_create_request(
            resource_group_name=resource_group_name,
            account_name=account_name,
            project_name=project_name,
            subscription_id=self._config.subscription_id,
            content_type=content_type,
            api_version=self._config.api_version,
            content=_content,
            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 [200, 202]:
            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 'Created'
E           Content: {"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.CognitiveServices/accounts/cog000002/projects/prj000003","name":"cog000002/prj000003","type":"Microsoft.CognitiveServices/accounts/projects","etag":""0f00c318-0000-0100-0000-6900d8ca0000"","location":"eastus","kind":"AIServices","properties":{"endpoints":{"AI Foundry API":"https://csclitest000005.services.ai.azure.com/api/projects/prj000003"},"displayName":"CLI&nbsp;Test&nbsp;Project","isDefault":true,"internalId":"729a191a437b438f9577ecb92956c0e3","provisioningState":"Succeeded"},"identity":{"principalId":"4a55556e-73ea-4b30-b09f-4ef469ae1d0f","tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","type":"SystemAssigned"},"systemData":{"createdBy":"test@example.com","createdByType":"User","createdAt":"2025-10-28T14:52:50.6820074Z","lastModifiedBy":"test@example.com","lastModifiedByType":"User","lastModifiedAt":"2025-10-28T14:52:50.6820074Z"}}

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

Related command
az cognitiveservices account update

Description
ARM SDK package azure-mgmt-cognitiveservices 15.1.0b1 was recently released, which added support for setting Cost Control Connections during an Account update operations. The az cognitiveservices account update command is handwritten on top of SDK calls. Update this hand-written code to also enable setting of Cost Control Connections.

Testing Guide

History Notes

[cognitiveservices account update] Add support for setting cost-control-connections during account update


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

Copilot AI balanced review requested due to automatic review settings November 18, 2026 07:13
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

All four cost-control create/update templates reject valid Event Grid connection IDs, breaking account and project commands when notifications supply those connections.

2 open issues
What changed in this PR

The PR targets Cognitive Services cost-control support in Azure CLI. The supplied changes update generated account and project cost-control commands, rather than the handwritten account-update command named in the description.

Changes:

  • Expand budget, notification, and blocking examples and revise shorthand argument keys.
  • Correct project cost-control help text.
  • Modify Event Grid connection resource-ID validation templates.
File Description
src/​azure-cli/​azure/​cli/​command_modules/​cognitiveservices/​aaz/​latest/​cognitiveservices/​account/​project/​costcontrol/​_update.py Corrects help text, revises the example, and changes connection-ID validation.
src/​azure-cli/​azure/​cli/​command_modules/​cognitiveservices/​aaz/​latest/​cognitiveservices/​account/​project/​costcontrol/​_create.py Expands token-budget examples, corrects help text, and changes connection-ID validation.
src/​azure-cli/​azure/​cli/​command_modules/​cognitiveservices/​aaz/​latest/​cognitiveservices/​account/​costcontrol/​_update.py Revises example argument keys and changes connection-ID validation.
src/​azure-cli/​azure/​cli/​command_modules/​cognitiveservices/​aaz/​latest/​cognitiveservices/​account/​costcontrol/​_create.py Adds monthly-budget examples and changes connection-ID validation.

Review effort: Balanced

@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

@x-engineering-agent

Copy link
Copy Markdown
Contributor

Hi Darren Cohen (@dargilco),
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

@dargilco Darren Cohen (dargilco) changed the title [cognitiveservices account update] cognitiveservices account update: Add support for setting cost-control-connections [Cognitive Services] az cognitiveservices account update: Add support for setting cost-control-connections Nov 18, 2026
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

…nd Fix Function App scenario recordings (Azure#34448)

Co-authored-by: xinyu pang <xinyupang@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

@dargilco
Darren Cohen (dargilco) marked this pull request as draft November 18, 2026 19:36

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants