Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ARM template error A nested resource type must have identical number of segments as its resource name

Hope somebody can help to resolve the error. Please the link below for the template

https://drive.google.com/open?id=15NYD-4Ghh3-DQV46ydfXgFg_VC0hdTSh

Thanks

At line:1 char:1 + new-azResourceGroupDeployment -ResourceGroupName $ServerResourceGroup ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [New-AzResourceGroupDeployment], Exception + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet

new-azResourceGroupDeployment : 13:33:59 - Error: Code=InvalidTemplate; Message=Deployment template validation failed: 'The template resource 'diukwestdbuk1/storageAccounts' for type 'Microsoft.Storage/storageAccounts' at line '0' and column '0' has incorrect segment lengths. A nested resource type must have identical number of segments as its resource name. A root resource type must have segment length one greater than its resource name. Please see https://aka.ms/arm-template/#resources for usage details.'.

At line:1 char:1 + new-azResourceGroupDeployment -ResourceGroupName $ServerResourceGroup ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [New-AzResourceGroupDeployment], Exception + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet

new-azResourceGroupDeployment : 13:33:59 - Error: Code=InvalidTemplate; Message=Deployment template validation failed: 'The template resource 'diagnosticst1/storageAccounts' for type 'Microsoft.Storage/storageAccounts' at line '0' and column '0' has incorrect segment lengths. A nested resource type must have identical number of segments as its resource name. A root resource type must have segment length one greater than its resource name. Please see https://aka.ms/arm-template/#resources for usage details.'.

like image 298
user1716729 Avatar asked Dec 18 '22 18:12

user1716729


1 Answers

this bit is wrong:

concat( variables('vardiagstorageName'),copyIndex(1),'/storageAccounts')

what the error is trying to suggest you: / is used to delimit resource types, so if you use something like xxx/yyy when you declare the resource name it implies you are looking to create\update subresource called yyy under resource called xxx. you need to remove the / from your name declation, because in this case you are just creating the storage account.

like image 175
4c74356b41 Avatar answered Dec 31 '22 01:12

4c74356b41