0

I have a query pack bicep template like so:

resource QueryPack 'microsoft.operationalInsights/querypacks@2019-09-01' = {
  name: 'myQueryPack'
  location: '<location>'
  properties: {}
}

resource QueryPack_00000000_0000_0000_0000_000000000000 'microsoft.operationalInsights/querypacks/queries@2019-09-01' = {
  parent: QueryPack
  name: '00000000-0000-0000-0000-000000000000'
  properties: {
    displayName: 'Descriptive name for my query'
    description: 'Nice description with more info'
    body: '<query>'
    related: {
      categories: []
      resourceTypes: [
        'microsoft.insights/components'
      ]
    }
    tags: {
      labels: [
        '<label>'
      ]
    }
  }
}

I also have a separate template that deploys the resource group and other resources. The problem is this: when I deploy all of this and create a new resource group, when I access application insights the query packs from every single resource group in that subscription all show up. So I will have 5 similar resource groups deployed and I will have 5 duplicates for each query.

I suspect I am doing something wrong with scoping this query pack template. Any insight on this?

Oztaco
  • 3,399
  • 11
  • 45
  • 84
  • why not creating the query pack in a dedicated resource group ? – Thomas Jul 21 '22 at 02:42
  • @Thomas the deployment takes the name of the project as a parameter. If the name doesnt already exist, it creates a brand new resource group and puts all resources including the app insights into that resource group. We could have dozens of such deployments in one subscription, and each resource group does have its own dedicated query pack. But the query packs from all resource groups show up in all app insights by default for some reason – Oztaco Jul 25 '22 at 23:24

0 Answers0