Azure / Azure/template-analyzer

[BUG] Template resources could have the same name and type for a different scope

Open
#258 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C#
Stars
143
Forks
47
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug

BPA assumes that in a template there are no multiple resources with the same name and type, but that could happen if they have different scopes

https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/scope-extension-resources?tabs=azure-cli

### Expected behavior

BPA should be able to analyze templates where there are resources with the same name and type but with different scope

### Reproduction Steps

This can be seen when trying to analyze templates like: https://github.com/Azure/azure-quickstart-templates/blob/b20394c2bf6dd7eea6c67e8c5c999a28cdb72fa9/quickstarts/microsoft.apimanagement/api-management-create-with-internal-vnet-application-gateway/azuredeploy.json

BPA exits with the following error: `An item with the same key has already been added. Key: logToAnalytics Microsoft.Insights/diagnosticSettings`

### Environment

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.