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

Weird error message creating Azure Automation Account

Open pcgeek86 opened this issue 10 years ago • 7 comments

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
    
screen shot 2016-02-14 at 10 06 45 am

Cheers, Trevor Sullivan Microsoft MVP: PowerShell https://trevorsullivan.net https://twitter.com/pcgeek86

pcgeek86 avatar Feb 14 '16 17:02 pcgeek86

@ravbhatnagar @devigned @markcowl Thoughts? Fixes? Anything?

pcgeek86 avatar Feb 18 '16 20:02 pcgeek86

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 avatar Feb 28 '16 00:02 kewalaka

@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

pcgeek86 avatar Feb 29 '16 04:02 pcgeek86

@vrdmr Can you ensure the right validation is being done around this? Please close if this is fixed.

maddieclayton avatar Feb 27 '18 23:02 maddieclayton

Fix (the error message is incomplete)

csand-msft avatar Feb 26 '19 01:02 csand-msft

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.

RakeshMohanMSFT avatar Jan 04 '23 19:01 RakeshMohanMSFT

This has been fixed.

Jassingh819 avatar May 31 '23 16:05 Jassingh819