microsoft / microsoft/fhir-server

ARM template validation fails when Application Insights deployment is disabled

Open
#5,216 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

arm-template Bug deployment
Dominant language
TSQL
Stars
1.4k
Forks
592
Avg merge
2d 7h
Merged PRs (30d)
41

Description

## Description

Deployment template validation fails with an `InvalidTemplate` error when the "deploy application insights" parameter is set to `false`.

## Error Message

```
Deployment template validation failed: 'The template resource 'myresource' at line '375' and column '9' is not valid: The resource identifier is null or empty. Please see https://aka.ms/arm-function-reference for usage details.. Please see https://aka.ms/arm-functions for usage details.'. (Code: InvalidTemplate)
```

## Steps to Reproduce

1. Configure ARM template deployment with Application Insights parameter
2. Set the "deploy application insights" parameter to `false`
3. Attempt to deploy the template
4. Validation fails at line 375, column 9

## Expected Behavior

The ARM template should validate successfully and deploy without Application Insights when the parameter is set to `false`. The template should handle conditional deployment properly.

## Actual Behavior

Template validation fails because a resource at line 375 has a null or empty resource identifier, likely due to a conditional dependency on Application Insights that isn't properly handled.

## Environment

- **Template**: ARM deployment template for FHIR server
- **Issue Location**: Line 375, column 9 in the template
- **Parameter**: "deploy application insights" set to `false`

## Root Cause

The error suggests that when Application Insights deployment is disabled, a resource identifier becomes null or empty. This typically occurs when:
- A resource has a dependency or reference to Application Insights
- The conditional logic doesn't properly handle the case when Application Insights is not deployed
- A `resourceId()` or similar function returns null/empty when the resource doesn't exist

## Suggested Fix

Review line 375 of the ARM template and:
1. Identify the resource with the null identifier
2. Add proper conditional logic to handle the case when Application Insights is disabled
3. Use conditional expressions like `if()` to provide alternative values or skip dependencies when Application Insights is not deployed
4. Ensure all references to Application Insights resources are wrapped in appropriate conditionals

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the ARM deployment template for the FHIR server and inspect the resource at line 375, then trace its Application Insights references and dependencies with the parameter set to false. Reproduce the validation failure using the documented deployment steps. Done means the template validates and deploys without Application Insights when that parameter is false.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.