how to fix error "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"

Kandi Rohith 20 Reputation points
2024-03-20T17:53:21.2933333+00:00

Hello everyone,

I am trying to create an ARM template to deploy secrets to key vault without manually adding them from portal. Attached are my parameters.json and main.json files. when deploying I am getting below error. Additionally, did anyone implemented this automation and were able to add multiple secrets to the vault suing json files? If so, please help me. Thank you in advance.

'The template resource '[parameters('adminusername')' for type 'Microsoft.KeyVault/vaults/secrets' at line '1' and column '1811' 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
Azure Key Vault
Azure Key Vault
An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.
1,313 questions
Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,258 questions
Windows Server Infrastructure
Windows Server Infrastructure
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Infrastructure: A Microsoft solution area focused on providing organizations with a cloud solution that supports their real-world needs and meets evolving regulatory requirements.
553 questions
{count} votes

Accepted answer
  1. Stanislav Zhelyazkov 24,686 Reputation points MVP
    2024-03-21T08:17:44.2+00:00

    Hi,

    There are no files attached but the error is clear. Resource Microsoft.KeyVault/vaults/secrets is not defined correctly. Add parent property to resource Microsoft.KeyVault/vaults/secrets. The parent resource should be of type Microsoft.KeyVault/vaults.

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.