Feature Request
azd env new and azd init should handle --no-prompt mode more gracefully by providing sensible defaults instead of failing when optional arguments are omitted.
Current behavior
azd env new --no-prompt without <name> argument: prompts interactively (fails in CI/non-interactive)
azd init --no-prompt --template <t> without --environment: returns error requiring --environment
- No subscription auto-selection from
defaults.subscription config or single-subscription accounts
Proposed behavior
1. Auto-generate environment name from working directory
When --no-prompt is passed without an explicit environment name, default to filepath.Base(cwd) (sanitized for valid env name characters), matching how azd init already generates name suggestions interactively.
2. Auto-select subscription
When --no-prompt is passed without --subscription:
- First check
azd config for defaults.subscription
- If not set and only one subscription exists, auto-select it
- If multiple subscriptions and no default, return clear error with guidance
Motivation
Extensions (e.g. azure.ai.agents) need non-interactive init flows for CI/CD. Currently each extension must implement its own --no-prompt logic for env naming and subscription selection, which is inconsistent and duplicative. This should be a core capability.
See discussion in #6823 (PR feedback from Travis Angevine (@trangevi), Victor Vazquez (@vhvb1989), Kristen Womack (@kristenwomack)).
Feature Request
azd env newandazd initshould handle--no-promptmode more gracefully by providing sensible defaults instead of failing when optional arguments are omitted.Current behavior
azd env new --no-promptwithout<name>argument: prompts interactively (fails in CI/non-interactive)azd init --no-prompt --template <t>without--environment: returns error requiring--environmentdefaults.subscriptionconfig or single-subscription accountsProposed behavior
1. Auto-generate environment name from working directory
When
--no-promptis passed without an explicit environment name, default tofilepath.Base(cwd)(sanitized for valid env name characters), matching howazd initalready generates name suggestions interactively.2. Auto-select subscription
When
--no-promptis passed without--subscription:azd configfordefaults.subscriptionMotivation
Extensions (e.g.
azure.ai.agents) need non-interactive init flows for CI/CD. Currently each extension must implement its own--no-promptlogic for env naming and subscription selection, which is inconsistent and duplicative. This should be a core capability.See discussion in #6823 (PR feedback from Travis Angevine (@trangevi), Victor Vazquez (@vhvb1989), Kristen Womack (@kristenwomack)).