Weird error message creating Azure Automation Account
I'm creating an Azure Automation Account named CAAA, but for some reason, I'm getting an exception that's essentially confirming that I've used a valid account name. What's wrong with my Automation Account name?
- It's not empty (specifically, it's four (4) characters)
- It starts with a letter or number (specifically, a letter)
- It does not exceed 50 characters (specifically, it's four (4) characters)
- The final character is a letter or number (specifically, it's a letter)
- It contains only letters, numbers, and dashes (specifically, it contains letters only)
PS C:> New-AzureRmAutomationAccount -ResourceGroupName CloudAcademyAA -Name CAAA -Location 'West Europe'; New-AzureRmAutomationAccount : BadRequest: {"Message":"The request is invalid.","ModelState":{"account.name":["The account name is invalid. The account name must not be empty, and must not exceed 50 characters in length. The account name must start with a letter or number. The account name can contain letters, numbers, and dashes. The final character must be a letter or a number."]}} At line:1 char:1
- New-AzureRmAutomationAccount -ResourceGroupName CloudAcademyAA -Name ...
- CategoryInfo : CloseError: (:) [New-AzureRmAutomationAccount], CloudException - FullyQualifiedErrorId : Microsoft.Azure.Commands.Automation.Cmdlet.NewAzureAutomationAccount
Cheers, Trevor Sullivan Microsoft MVP: PowerShell https://trevorsullivan.net https://twitter.com/pcgeek86
@ravbhatnagar @devigned @markcowl Thoughts? Fixes? Anything?
Hi Trevor I just ran into the same issue, using the GUI I found automation accounts have to be at least 6 characters, this solved it for me. Rgds Stu
@kewalaka Thanks for discovering this! It needs to be included in the ARM PowerShell built-in documentation as well.
@ravbhatnagar @devigned Please assign this issue to @jodoglevy.
Cheers, Trevor Sullivan
@vrdmr Can you ensure the right validation is being done around this? Please close if this is fixed.
Fix (the error message is incomplete)
The current code expects that the name is minimum 6 characters, that part is missing in the error message and also this is not from the client (Powershell) but the service itself. We are raising a request to fix the same.
This has been fixed.