Azure / Azure/azure-cli-extensions

`containerapp env create` fails to validate name before creating resources, and provides unhelpful error message

Open
#5,555 3 comments 0 reactions 0 assignees View on GitHub
Auto-Assign ContainerApp needs-team-attention Service Attention
Dominant language
Python
Stars
454
Forks
1.7k
Avg merge
2d 19h
Merged PRs (30d)
64

Description

- If the issue is to do with Azure CLI 2.0 in-particular, create an issue here at [Azure/azure-cli](https://github.com/Azure/azure-cli/issues)

### Related command
containerapp

### Extension name (the extension in question)
az containerapp env create

### Description of issue (in as much detail as possible)

I attempted create a containerapp env with the name `charris_wagtail_bakery`. There were no immediate errors and the command spent 15 seconds or so creating the Log Analytics workspace before eventually failing with less than helpful error message.

### Repro
`az containerapp env create -g charris_wagtail_bakery -n charris_wagtail_bakery`

Parameter persistence is turned on. Its information is saved in working directory C:\git. You can run `az config param-persist off` to turn it off.
Command argument values from persistent parameters: --location: centralus
No Log Analytics workspace provided.
Generating a Log Analytics workspace with name "workspace-charriswagtailbakerybKUh"
(ManagedEnvironmentInvalidName) **The environment name charris_wagtail_bakery is invalid.**

### Desired behavior
1. The command should validate the name before creating anything and thereby leaving undesired resources behind
2. The error message should tell me specifically which part of the name is invalid. In this case, the underscores are invalid and a dash would works just fine.

-----

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.