Hi @VikaTiwari-2263
Looking at your ARM template, I can see you have declared a resource called "eventHubNamespaceName_eventHubName_Listen" which is a child of "eventHubNamespaceName_eventHubName" which in turn is a child of "eventHubNamespace". All of these must be in the same resource group as the children are dependant on the root parent, therefore you cannot declare a different scopes for these resources. They all must be declared as a resource (not an exisitng resource), even but all you need for resources deployed outside of the template is the resource name.
https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/child-resource-name-type#outside-parent-resource
Also when declaring a scope, you need to use a scope function e.g. resourceGroup("ResourceGroupName")
https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-functions-scope
Below is the first few resources which hopefully make sense
resource rawStorageAccount 'Microsoft.Storage/storageAccounts@2021-08-01' existing = {
name: 'mystorageaccount'
scope: resourceGroup('rg3')
}
resource eventHubNamespace 'Microsoft.EventHub/namespaces@2021-11-01' = {
name: 'myeventhub'
}
resource eventHubNamespaceName_eventHubName 'Microsoft.EventHub/namespaces/eventhubs@2021-11-01' = {
parent: eventHubNamespace
name: 'ehname'
}
resource eventHubNamespaceName_eventHubName_Listen 'Microsoft.EventHub/namespaces/eventhubs/authorizationRules@2021-11-01' = {
parent: eventHubNamespaceName_eventHubName
name: 'ConsumerListens'
properties: {
rights: [
'Listen'
]
}
}