Azure / Azure/static-web-apps

[Bug] Incorrect JSON template for linked app insights with ARM/Bicep

Open
#577 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

I'm trying to deploy a SWA with an App Insights instance connected from a Bicep template.
Looking at the JSON overview in the portal, it seems that the App Insight instance is linked using special tags:
```json
...
"hidden-link: /app-insights-resource-id": "/subscriptions/123...",
"hidden-link: /app-insights-instrmentation-key": "98765431..."
...
```

When I tried to set this in my Bicep template to reference the App Insight resource:
```
tags: {
'hidden-link: /app-insights-resource-id': appInsights.id
'hidden-link: /app-insights-instrmentation-key': reference(appInsights.id, appInsights.apiVersion).InstrumentationKey
}
```
I get this error: `This expression is being used in an assignment to the "tags" property of the "Microsoft.Web/staticSites" type, which requires a value that can be calculated at the start of the deployment`
![image](https://user-images.githubusercontent.com/593151/132718112-55582b11-5565-4e81-adeb-b9bb6c1d22fd.png)

It seems that the tags values must be statically defined, so it's not possible to reference the App Insights also created in the template.

Do you know a workaround about this? I think using a dedicated module for the SWA resource might be a way around, but I don't want to use modules.
Out of curiosity, what was the rationale for using tags instead of regular properties for these values?

Thanks.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.