question

ZviaAwasker-0801 avatar image
0 Votes"
ZviaAwasker-0801 asked srbhatta-msft answered

Deploy ARM template failed with error of "Resource name [concat('NSGSubnetData',parameters('envType'))] is invalid. The name can be up to 80 characters long.

Hi,

I have created an ARM template with parameter name envType that will get one of the following values : test, dev, ppr, prod
"envType": {
"type": "string",
"defaultValue": "Test",
"metadata": {
"description": "Type of the Environment: Dev, Test, Ppr, Prd "
},
"allowedValues": [
"Dev",
"Test",
"Ppr",
"Prd"
]
},
I wanted to use concat function to join environment parameter to all the resources name in suffix .

I created a template for network group security and it failed with following error:

"Resource name [concat('NSGSubnetData',parameters('envType'))] is invalid. The name can be up to 80 characters long. It must begin with a word character, and it must end with a word character or with ''. The name may contain word characters or '.', '-', ''."}

I do the deploy using azure devops pipeline.

What I did wrong.
Please advise how can I fix it.

Thanks,
Tzvia

azure-dtl-arm-enviorments
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

srbhatta-msft avatar image
0 Votes"
srbhatta-msft answered

Hi @ZviaAwasker-0801,
Thank you for contacting Microsoft QnA.
Could you please let us know if you are getting the same error when you are trying to create the template with some other network security group name?
I tested it at my end and it works fine. I have created a sample template were I am deploying a network security group and I am using the concat function to concat the 'networkSecurityGroupName' parameter and the 'envType' parameter. The deployment was successful. Please check the template here. I have also used the same NSG name of 'NSGSubnetData' and concatenated it with the suffix of 'Ppr' like you have done, and it did not throw me any such naming error. I would request you to check the template from this link.

If this does not help, then I would request you to please elaborate your problem a little more or you can also share your template so that we can help.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.