#Bicep - App Insights Private Link Scoped Resource

1 messages · Page 1 of 1 (latest)

noble ibex
#

I have an existing Private Link Scope and App Insights workspace. I want to link them together using bicep

Here is my test main

param _hubSubscriptionId string = 'bdea0f7a-8006-4ae4-9baa-xxx'

param _appSubscriptionId string = 'efa02ec2-8f61-47c2-ab4b-xxx'

param appInsight string = 'appi-hlrpos-ci-a-uks-01'

param appInsghtRg string = 'rg-hlrpos-ci-a-uks-01'

param hubPlatformLogsRg string = 'rg-platformlogs-dev-h-uks-01'

resource existingLinkScope 'microsoft.insights/privateLinkScopes@2021-07-01-preview' existing = {
name: 'pls-log-platformlogs-dev-h-uks-01'
scope: resourceGroup(_hubSubscriptionId, hubPlatformLogsRg)
}

module AzureMonitorPrivateLinkConnection 'insights.privateLinkScopesScopedResources.bicep' = {
name: '${appInsight}-connection'
params: {
name: '${existingLinkScope.name}/${appInsight}-connection'
linkedResourceId: resourceId(_appSubscriptionId, 'microsoft.operationalinsights/workspaces', appInsight)
}
}

And this is the module

param linkedResourceId string

param name string

resource privateLinkScopes 'Microsoft.Insights/privateLinkScopes/scopedResources@2021-07-01-preview' = {
name: name
properties: {
linkedResourceId: linkedResourceId
}
}

I get this error

New-AzDeployment: 11:08:49 - Error: Code=InvalidDeployment; Message=The 'location' property must be specified for 'appi-hlrpos-ci-a-uks-01-connection'. Please see https://aka.ms/arm-deployment-subscription for usage details.

But I can't see anywhere this can be specified

Can someone help please

pure cloak
#

It means where you have name: '${appInsight}-connection' you need to declare a location under that line, for where it gets geographically deployed.

If you use the following it will get deployed to the same place as the resource group it lives in:
location: resourceGroup().location

noble ibex
#

Hi @pure cloak
I've tried that - and also in the module
Any other ideas?

pure cloak
noble ibex
junior root
#

isnt it a child or extension resource type?

pure cloak
#

That was my next question. But if it's not have you just tried running it? I've seen threads where this kind of thing shows as an error but it's false and the template deploys just fine (although those issues may have been fixed since then)

#

@noble ibex if you were following an example it looks like it might have been this one, and maybe you just got off track a bit. If it's not a child try reverting the name back to this one if it works.
https://learn.microsoft.com/en-us/azure/templates/microsoft.insights/privatelinkscopes?pivots=deployment-language-bicep

noble ibex
#

It doesn't like me dropping it in - I've tried running it out

I'm not sure what difference it would make to be a child resource/extension??

pure cloak
#

If it's a child then it means you're likely missing the location in the parent I would assume

noble ibex
#

Given that I am looking up an existing resource, what would that mean?

pure cloak
#

I'm more of an ARM user than Bicep at the moment so I don't entirely know what it would look like, but it means it sits inside another resource, which would be in a different file from the looks of it if that's the case.

@junior root may be able to offer more specific insight on this than I am able to.

noble ibex
#

If you have any ideas @junior root ?

junior root
#

probably, can you zip your bicep and module and send them over please

noble ibex
junior root
#

ok, so why the module at all? - what error do you get if you just leave out the location and dont use a module?