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

[Issue] `Azd env new` asks for environment name instead of using command line arg

Open KSchlobohm opened this issue 2 years ago • 3 comments

Output from azd version azd version 0.1.0-beta.4 (commit fd96b3e9b283598bc4dc736e893f1b47080fbf7d)

Output from az version { "azure-cli": "2.38.0", "azure-cli-core": "2.38.0", "azure-cli-telemetry": "1.0.6", "extensions": { "containerapp": "0.3.5", "log-analytics": "0.2.2", "rdbms-connect": "1.0.2" } }

Describe the bug When using the azd env new command it is prompting for an environment name from the command line rather than accepting my cli argument as the name to be used.

To Reproduce

azd env new $myNewEnvironmentName

Expected behavior Expected the CLI not to prompt and ask me for environment name

image

Environment Information on your environment: * Happens with PowerShell and Bash * command line experience

KSchlobohm avatar Aug 19 '22 21:08 KSchlobohm

@KSchlobohm can you try like below with -e option as called out in the reference docs - https://docs.microsoft.com/en-us/azure/developer/azure-developer-cli/reference#azd-env

azd env new -e staging
 Please select an Azure location to use: 38. (US) Central US (centralus)
 Please select an Azure Subscription to use: Other (enter manually)
 Enter an Azure Subscription to use: foo

Note: environment name should contain only alphanumeric characters and hyphens

rajeshkamal5050 avatar Aug 23 '22 05:08 rajeshkamal5050

That worked for me.

I think the help text says this should also work azd env new staging where staging is the same as azd env new <environment>

KSchlobohm avatar Aug 23 '22 14:08 KSchlobohm

"-e" means "use an environment that isn't the default"

the azd env new should create a new env w/ name and not depend on the -e

jongio avatar Aug 23 '22 16:08 jongio

This was fixed with #1105

weikanglim avatar Feb 13 '24 22:02 weikanglim