Azure / Azure/azure-cli

Need validation of project name length at the time it's specified

Open
#20,691 2 comments 0 reactions 1 assignee Claimed by @zhoxing-ms View on GitHub
act-identity-squad ARM feature-request
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### **This is autogenerated. Please review and update as needed.**

## Describe the bug
There was an error because my project name was too long. I incremented it after a previous failure from todo-python-mongo2 to todo-python-mongo*2* which exceeded the length limit.

We should check for this and error out as early as possible, like when we prompt the user for it. In addition, we should only suggest a name that will meeting the length (and other) requirements, regardless of what the parent folder is called.

**Command Name**
`az deployment sub create`

**Errors:**
```
{'code': 'InvalidTemplate', 'message': "Deployment template validation failed: 'The provided value for the template parameter 'basename' at line '17' and column '21' is not valid. Length of the value should be less than or equal to '17'. Please see https://aka.ms/arm-template/#parameters for usage details.'.", 'additionalInfo': [{'type': 'TemplateViolation', 'info': {'lineNumber': 17, 'linePosition': 21, 'path': 'properties.template.parameters.basename.maxLength'}}]}

```

## To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

- _Put any pre-requisite steps here..._
- `az deployment sub create --only-show-errors -n {} -l {} -f {} -p {} -o {}`

## Expected Behavior

## Environment Summary
```
Windows-10-10.0.22000-SP0
Python 3.8.9
Installer: MSI

azure-cli 2.31.0

Extensions:
azure-dev 0.0.1b70
rdbms-connect 0.1.4

```
## Additional Context

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.