Skip to content

Conversation

@jepetty
Copy link
Contributor

@jepetty jepetty commented Jan 15, 2026

Related command

az containerapp env create --name --resource-group --enable-workload-profiles false

Description

This is a small change to make the error message clearer for users when they try to create a ConsumptionOnly environment but an existing WorkloadProfiles environment with the same name already exists. The previous error was "At least 1 workload profile must be specified" - very confusing

Testing Guide

  1. Create a workload-profile enabled environment: az containerapp env create --name test --resource-group jepetty-week1 --enable-workload-profiles $true
  2. Run the same command, but with workload-profiles disabled: az containerapp env create --name test --resource-group jepetty-week1 --enable-workload-profiles $false

History Notes

[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change
[Component Name 2] az command b: Add some customer-facing feature


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 January 15, 2026 22:40
@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Jan 15, 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
️✔️3.13
️✔️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

azure-client-tools-bot-prd bot commented Jan 15, 2026

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

@yonzhan
Copy link
Collaborator

yonzhan commented Jan 15, 2026

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

@github-actions
Copy link

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
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

This PR improves the error message displayed when users attempt to create a Consumption-Only Container Apps environment with a name that matches an existing Workload Profiles environment. Previously, users would see a confusing error "At least 1 workload profile must be specified"; now they receive a clear message explaining that the existing environment uses workload profiles and suggesting they create a new one.

Changes:

  • Enhanced validation logic to detect when a Consumption-Only environment creation conflicts with an existing Workload Profiles environment
  • Added test coverage for the new validation error message
  • Removed unused imports from test files

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/azure-cli/azure/cli/command_modules/containerapp/containerapp_env_decorator.py Refactored workload profile setup to check for existing environments earlier and added validation for the Consumption-Only conflict scenario
src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/test_containerapp_env_commands.py Added test case to verify new error message and imported ValidationError exception
src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/test_containerapp_compose_registries.py Removed unused create_containerapp_env import
src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/test_containerapp_compose_environment.py Removed unused create_containerapp_env import
src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/test_containerapp_compose_basic.py Removed unused create_containerapp_env import

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

@Greedygre
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Greedygre
Greedygre previously approved these changes Jan 19, 2026
@yonzhan
Copy link
Collaborator

yonzhan commented Jan 19, 2026

Please fix CI issues

@Greedygre
Copy link
Contributor

About the CI failed , it is because in azure-cli env, it will not install containerapp extension, so the api-version for containerapp API should be 2025-07-01

Please remove az containerapp extension will command az extension remove -n containerapp before you run test for azure-cli:

E               vcr.errors.CannotOverwriteExistingCassetteException: Can't overwrite existing cassette ('/mnt/vss/_work/1/s/src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/recordings/test_containerapp_env_e2e.yaml') in your current record mode ('once').
E               No match for the request (<Request (GET) [https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.App/managedEnvironments/containerapp-e2e-env000003?api-version=2025-07-01>](https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.App/managedEnvironments/containerapp-e2e-env000003?api-version=2025-07-01%3E)) was found.
E               Found 5 similar requests with 1 different matcher(s) :
E               
E               1 - (<Request (GET) [https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.App/managedEnvironments/containerapp-e2e-env000003?api-version=2025-10-02-preview>).](https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.App/managedEnvironments/containerapp-e2e-env000003?api-version=2025-10-02-preview%3E).)
E               Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path']
E               Matchers failed :
E               _custom_request_query_matcher - assertion failure :
E               None

@Greedygre
Copy link
Contributor

These tests are failed. They relate to the PR's change. Recommend to update the tests:

FAILED src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/test_containerapp_env_commands.py::ContainerappEnvScenarioTest::test_containerapp_env_e2e
FAILED src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/test_containerapp_workload_profile_commands.py::ContainerAppWorkloadProfilesTest::test_containerapp_create_enable_workload_profiles_three_state_flag
FAILED src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/test_containerapp_workload_profile_commands.py::ContainerAppWorkloadProfilesTest::test_containerapp_env_enable_workload_profiles_infer_env_type_v1
FAILED src/azure-cli/azure/cli/command_modules/containerapp/tests/latest/test_containerapp_workload_profile_commands.py::ContainerAppWorkloadProfilesTest::test_containerapp_env_enable_workload_profiles_infer_env_type_v2

@jepetty jepetty changed the title [ContainerApp] az containerapp env create: Update the error display for CO environment creation [ContainerApp] az containerapp env create: Update the error display for CO environment creation Jan 21, 2026
@jepetty
Copy link
Contributor Author

jepetty commented Jan 21, 2026

/azp run

@azure-pipelines
Copy link

Commenter does not have sufficient privileges for PR 32648 in repo Azure/azure-cli

@jepetty
Copy link
Contributor Author

jepetty commented Jan 21, 2026

Thank you, @Greedygre for the helpful tips! I believe I have fixed these

@yonzhan
Copy link
Collaborator

yonzhan commented Jan 22, 2026

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@yanzhudd yanzhudd changed the title [ContainerApp] az containerapp env create: Update the error display for CO environment creation [Container app] az containerapp env create: Update the error display for CO environment creation Jan 23, 2026
@yanzhudd yanzhudd merged commit 7910b8b into Azure:dev Jan 23, 2026
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Auto-Assign Auto assign by bot ContainerApp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants