question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

An exception occurred while analyzing template.

See original GitHub issue

Describe the bug

We receive this error when we analyze bicep templates containing the metadata keyword. Removing the metadata keyword solves this problem, but we need this keyword for documentation and information purposes.

Information regarding this can be found in the reproduction steps.

We get the following errors: image

Expected behavior

Template files are analyzed with the metadata section.

Reproduction Steps

Sample bicep

`metadata info = { name: ‘RBAC Module’ description: ‘This module deploys a Role Based Access assignments’ version: ‘1.0.0’ author: ‘Maik van der Gaag’ }

param principalId string param roleDefinitionResourceId string

@description(‘This is the built-in Contributor role. See https://docs.microsoft.com/azure/role-based-access-control/built-in-roles#contributor’) resource roleDefinition ‘Microsoft.Authorization/roleDefinitions@2018-01-01-preview’ existing = { scope: subscription() name: roleDefinitionResourceId }

resource roleAssignment ‘Microsoft.Authorization/roleAssignments@2020-04-01-preview’ = { name: guid(resourceGroup().id, principalId, roleDefinition.id) properties: { roleDefinitionId: roleDefinition.id principalId: principalId principalType: ‘ServicePrincipal’ } scope: resourceGroup() }`

When we analyze this with ‘.\TemplateAnalyzer.exe analyze-template D:\source\rbac.bicep -v’

Environment

  • Local and on Microsoft build agents
  • .Net 6

Issue Analytics

  • State:open
  • Created 6 months ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
maikvandergaagcommented, Jun 17, 2023

Any updates on this?

0reactions
juju4commented, Jul 1, 2023

It’s more the exception/warning that are noisy and not actionable. may be an option to redirect those to a separate log that can be reported to project?

Full output on https://github.com/juju4/azure-search-openai-demo/actions/runs/5299769415/jobs/9592934762#step:11:694

    Running ARM Template Best Practice Analyzer 0.5.1
    ------------------------------------------------------------------------------
    /home/runner/work/_msdo/packages/nuget/Azure.Templates.Analyzer.CommandLine.linux-x64.0.5.1/tools/TemplateAnalyzer analyze-directory /home/runner/work/azure-search-openai-demo/azure-search-openai-demo --report-format sarif --output-file-path /home/runner/work/azure-search-openai-demo/azure-search-openai-demo/.gdn/.r/templateanalyzer/001/templateanalyzer.sarif
    Discovered 14 template-parameter pairs to analyze
    
    
    Directory: /home/runner/work/azure-search-openai-demo/azure-search-openai-demo
    Warning: An exception occurred while evaluating the properties of the resource named web
    Warning: An exception occurred while evaluating the properties of the resource named openai-role-backend
    Warning: An exception occurred while evaluating the properties of the resource named storage-role-backend
    Warning: An exception occurred while evaluating the properties of the resource named search-role-backend
    Warning: The parsing of the template output named AZURE_OPENAI_SERVICE failed
    Warning: The parsing of the template output named AZURE_FORMRECOGNIZER_SERVICE failed
    Warning: The parsing of the template output named AZURE_SEARCH_SERVICE failed
    Warning: The parsing of the template output named AZURE_STORAGE_ACCOUNT failed
    Warning: The parsing of the template output named BACKEND_URI failed
    Warning: The parsing of the template output named identityPrincipalId failed
    Warning: The parsing of the template output named uri failed
    Warning: The parsing of the template output named endpoint failed
    Warning: The parsing of the template output named endpoint failed
    Warning: The parsing of the template output named primaryEndpoints failed
    Warning: The parsing of the template output named endpoint failed
    Warning: The parsing of the template output named uri failed
    Warning: The parsing of the template output named primaryEndpoints failed
    Warning: An exception occurred while evaluating the properties of the resource named web
    Warning: An exception occurred while evaluating the properties of the resource named openai-role-backend
    Warning: An exception occurred while evaluating the properties of the resource named storage-role-backend
    Warning: An exception occurred while evaluating the properties of the resource named search-role-backend
    Warning: The parsing of the template output named AZURE_OPENAI_SERVICE failed
    Warning: The parsing of the template output named AZURE_FORMRECOGNIZER_SERVICE failed
    Warning: The parsing of the template output named AZURE_SEARCH_SERVICE failed
    Warning: The parsing of the template output named AZURE_STORAGE_ACCOUNT failed
    Warning: The parsing of the template output named BACKEND_URI failed
    Warning: The parsing of the template output named identityPrincipalId failed
    Warning: The parsing of the template output named uri failed
    Warning: The parsing of the template output named endpoint failed
    Warning: The parsing of the template output named endpoint failed
    Warning: The parsing of the template output named primaryEndpoints failed
    Warning: The parsing of the template output named endpoint failed
    Warning: The parsing of the template output named uri failed
    Warning: The parsing of the template output named primaryEndpoints failed
    
    Analyzed 14 files in the directory specified.
    
    Execution summary:
    	The verbose mode (option -v or --verbose) can be used to obtain even more information about the execution.
    
    	Summary of the warnings:
    		2 instances of: An exception occurred while evaluating the properties of the resource named web
    		2 instances of: An exception occurred while evaluating the properties of the resource named openai-role-backend
    		2 instances of: An exception occurred while evaluating the properties of the resource named storage-role-backend
    		2 instances of: An exception occurred while evaluating the properties of the resource named search-role-backend
    		2 instances of: The parsing of the template output named AZURE_OPENAI_SERVICE failed
    		2 instances of: The parsing of the template output named AZURE_FORMRECOGNIZER_SERVICE failed
    		2 instances of: The parsing of the template output named AZURE_SEARCH_SERVICE failed
    		2 instances of: The parsing of the template output named AZURE_STORAGE_ACCOUNT failed
    		2 instances of: The parsing of the template output named BACKEND_URI failed
    		2 instances of: The parsing of the template output named identityPrincipalId failed
    		4 instances of: The parsing of the template output named uri failed
    		6 instances of: The parsing of the template output named endpoint failed
    		4 instances of: The parsing of the template output named primaryEndpoints failed
    
    	34 Warnings
    	0 Errors
    
    Wrote 31 results to /home/runner/work/azure-search-openai-demo/azure-search-openai-demo/.gdn/.r/templateanalyzer/001/templateanalyzer.sarif
    Tool run time: 28.7612185 seconds
    ------------------------------------------------------------------------------
    ARM Template Best Practice Analyzer completed with exit code 20
    ------------------------------------------------------------------------------
    
    Running ESLint 7.32.0.2
    ------------------------------------------------------------------------------
    /home/runner/work/_msdo/packages/node_modules/eslint/bin/eslint --no-eslintrc --config /home/runner/work/_msdo/packages/node_modules/eslint/lib/node_modules/@microsoft/eslint-plugin-sdl/config/required.js --ext .js --ext .ts --ignore-pattern *.d.ts --format /home/runner/work/_msdo/packages/node_modules/eslint/lib/node_modules/@microsoft/eslint-formatter-sarif/sarif.js --output-file /home/runner/work/azure-search-openai-demo/azure-search-openai-demo/.gdn/.r/eslint/001/eslint.sarif **/*.{js,ts}
    Tool run time: 0.7665677 seconds
    ------------------------------------------------------------------------------
    ESLint completed with exit code 1
    ------------------------------------------------------------------------------
    
  Process:
    Convert:
      Converting any raw tool logs to Sarif format ...
      Completed converting raw tool logs to Sarif format.
    Import:
      Importing results to the Guardian result repository...
      Saved file /home/runner/work/azure-search-openai-demo/azure-search-openai-demo/.gdn/r/.gdntoolsdata
      This file does not contain identifying data. It is safe to check into your repo. To hydrate this file with identifying data, run `guardian hydrate --help` and follow the guidance.
      Saved file /home/runner/work/azure-search-openai-demo/azure-search-openai-demo/.gdn/internal.gdnhistory
      Completed importing results to the Guardian result repository. 9 result file(s) were created in /home/runner/work/azure-search-openai-demo/azure-search-openai-demo/.gdn/r
  Break:
    Guardian is searching for results that meet the given criteria to break the build.
    Results Query Summary:
      Tool Filters (Include): bandit, terrascan, templateanalyzer, eslint
      Baselines: default
      Suppression Sets: default
      Policy: GitHub
Error:      1. TemplateAnalyzer Error TA-000017 - File: infra/main.json. Line: 549. Column 0. 
    Tool: TemplateAnalyzer: Rule: TA-000017 (AppServiceWebApp.UseLatestTLS). https://github.com/Azure/template-analyzer/blob/main/docs/built-in-rules.md/#ta-000017-latest-tls-version-should-be-used-in-your-web-app
    Web apps should require the latest TLS version.
Error:      2. TemplateAnalyzer Error TA-000017 - File: infra/main.json. Line: 558. Column 0. 
    Tool: TemplateAnalyzer: Rule: TA-000017 (AppServiceWebApp.UseLatestTLS). https://github.com/Azure/template-analyzer/blob/main/docs/built-in-rules.md/#ta-000017-latest-tls-version-should-be-used-in-your-web-app
    Web apps should require the latest TLS version.
Error:      3. TemplateAnalyzer Error TA-000017 - File: infra/main.json. Line: 592. Column 0. 
    Tool: TemplateAnalyzer: Rule: TA-000017 (AppServiceWebApp.UseLatestTLS). https://github.com/Azure/template-analyzer/blob/main/docs/built-in-rules.md/#ta-000017-latest-tls-version-should-be-used-in-your-web-app
    Web apps should require the latest TLS version.
Error:      4. TemplateAnalyzer Error AZR-000280 - File: infra/main.json. Line: 868. Column 0. 
    Tool: TemplateAnalyzer: Rule: AZR-000280 (Azure.Cognitive.PublicAccess). https://azure.github.io/PSRule.Rules.Azure/en/rules/Azure.Cognitive.PublicAccess/
    By default, public network access is enabled for a Cognitive Service account. Service Endpoints and Private Link can be leveraged to restrict access to PaaS endpoints. When access is restricted, access by malicious actor is from an unauthorized virtual network is mitigated.
Configure service endpoints and private links where appropriate.
Error:      5. TemplateAnalyzer Error AZR-000280 - File: infra/main.json. Line: 866. Column 0. 
    Tool: TemplateAnalyzer: Rule: AZR-000280 (Azure.Cognitive.PublicAccess). https://azure.github.io/PSRule.Rules.Azure/en/rules/Azure.Cognitive.PublicAccess/
    By default, public network access is enabled for a Cognitive Service account. Service Endpoints and Private Link can be leveraged to restrict access to PaaS endpoints. When access is restricted, access by malicious actor is from an unauthorized virtual network is mitigated.
Configure service endpoints and private links where appropriate.
Error:      6. TemplateAnalyzer Error AZR-000281 - File: infra/main.json. Line: 859. Column 0. 
    Tool: TemplateAnalyzer: Rule: AZR-000281 (Azure.Cognitive.ManagedIdentity). https://azure.github.io/PSRule.Rules.Azure/en/rules/Azure.Cognitive.ManagedIdentity/
    Cognitive Services must authenticate to Azure resources such storage accounts. To authenticate to Azure resources, Cognitive Services can use managed identities.
Using Azure managed identities have the following benefits:
Read more comments on GitHub >

github_iconTop Results From Across the Web

An exception occurred: Error while processing template. ...
i wanted to run the tool on a bicep created ARM template: PS C:\Users\f.moeller\Downloads\TemplateAnalyzer> .\TemplateAnalyzer.exe analyze- ...
Read more >
Error while deploying an Azure VM using ARM templa...
I'm getting this error while deploying the Azure VM using the ARM template from Cloud User Portal (Cloud Provisioning and Governance).
Read more >
Error loading the template for the - how to solve related ...
How to troubleshoot Elasticsearch/OpenSearch log "Error loading the template for the" ... It will analyze your templates to detect issues and improve search ......
Read more >
ARM Template cannot deploy over a paused Azure ...
If you try to deploy an Azure Analysis Services resource over an existing resource that is paused within the DevOps Azure Resource Group ......
Read more >
ARM template editing slow and unreliable : IDEA-249624
Editing Azure Resource Manager JSON templates within a .deployproj project in Rider 2020.2.1 causes continuous high CPU usage when the file is open...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found