-
Notifications
You must be signed in to change notification settings - Fork 567
Open
Labels
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
- Configure ARM template deployment with Application Insights parameter
- Set the "deploy application insights" parameter to
false - Attempt to deploy the template
- 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:
- Identify the resource with the null identifier
- Add proper conditional logic to handle the case when Application Insights is disabled
- Use conditional expressions like
if()to provide alternative values or skip dependencies when Application Insights is not deployed - Ensure all references to Application Insights resources are wrapped in appropriate conditionals