This article describes the ParentResourceNotFound error you might get when deploying a resource that's dependent on a parent resource. The error occurs when you deploy resources with a Bicep file or Azure Resource Manager template (ARM template).
Symptom
When you deploy a resource that's a child to another resource, you might receive the following error:
Code=ParentResourceNotFound,
Message=Can not perform requested operation on nested resource. Parent resource 'exampleserver' not found."
Cause
When one resource is a child to another resource, the parent resource must exist before the child resource is created. The name of the child resource defines the connection with the parent resource. The name of the child resource is in the format <parent-resource-name>/<child-resource-name>. For example, a SQL Database might be defined as:
If you deploy the server and the database in the same template, but don't specify a dependency on the server, the database deployment might start before the server has deployed. That causes the database deployment to fail with the ParentResourceNotFound error.
If the parent resource already exists and isn't deployed in the same template, you get the ParentResourceNotFound error when Resource Manager can't associate the child resource with a parent. This error might happen when the child resource isn't in the correct format. Or if the child resource is deployed to a resource group that's different than the resource group for parent resource.
Solution 1: Deployed in same template
To resolve this error when parent and child resources are deployed in the same template, use a dependency.
This example uses a nested child resource within the parent resource and that creates the dependency. The child gets the resource type and API version from the parent resource.
To resolve this error when the parent resource was deployed in a different template, don't set a dependency. Instead, deploy the child to the same resource group and provide the name of the parent resource.
This example uses the existing keyword to reference a parent that was deployed in a separate file. The child resource uses the parent element and the parent resource's symbolic name.
Administer an SQL Server database infrastructure for cloud, on-premises and hybrid relational databases using the Microsoft PaaS relational database offerings.