Azure/template-analyzer

[BUG] listKeys function is not supported

VeraBE opened this issue · 0 comments

Describe the bug

A user reported getting this warning in their output:

Warning: An exception occurred while evaluating the properties of a resource. Properties: "CacheConnection": "[concat(variables('cacheName'),'.redis.cache.windows.net,abortConnect=false,ssl=true,password=', listKeys(resourceId('Microsoft.Cache/Redis', variables('cacheName')), '2020-12-01').primaryKey)]"
Exception details:
Azure.Deployments.Core.Exceptions.ExpressionException: The language expression property 'primaryKey' can't be evaluated.
   at Azure.Deployments.Expression.Expressions.FunctionExpression.SelectProperty(JToken root, JToken property, TemplateErrorAdditionalInfo additionalInfo)
   at Azure.Deployments.Expression.Expressions.FunctionExpression.EvaluateExpression(ExpressionEvaluationContext context, TemplateErrorAdditionalInfo additionalInfo)
   at Azure.Deployments.Expression.Expressions.FunctionExpression.<>c__DisplayClass23_0.<EvaluateParameters>b__0(LanguageExpression parameter)       
   at System.Array.ConvertAll[TInput,TOutput](TInput[] array, Converter`2 converter)
   at Microsoft.WindowsAzure.ResourceStack.Common.Extensions.IEnumerableExtensions.SelectArray[TSource,TElement](TSource[] source, Converter`2 elementSelector)
   at Azure.Deployments.Expression.Expressions.FunctionExpression.EvaluateParameters(ExpressionEvaluationContext context, TemplateErrorAdditionalInfo additionalInfo)
   at Azure.Deployments.Expression.Expressions.FunctionExpression.EvaluateExpression(ExpressionEvaluationContext context, TemplateErrorAdditionalInfo additionalInfo)
   at Azure.Deployments.Expression.Engines.ExpressionsEngine.EvaluateLanguageExpressionsInternal(JToken root, ExpressionEvaluationContext evaluationContext, Boolean ignoreExceptions, TemplateErrorAdditionalInfo additionalInfo, InsensitiveHashSet skipEvaluationPaths)
   at Azure.Deployments.Expression.Engines.ExpressionsEngine.EvaluateLanguageExpressionsRecursive(JToken root, ExpressionEvaluationContext evaluationContext, TemplateErrorAdditionalInfo additionalInfo, InsensitiveHashSet skipEvaluationPaths)
   at Microsoft.Azure.Templates.Analyzer.TemplateProcessor.ArmTemplateProcessor.ProcessTemplateResourceLanguageExpressions(TemplateResource templateResource, TemplateExpressionEvaluationHelper evaluationHelper) in C:\Users\wilbug1\source\repos\template-analyzer\src\Analyzer.TemplateProcessor\ArmTemplateProcessor.cs:line 390

Expected behavior

Template properties that use the listKeys function should be processed

Reproduction Steps

Analyze a template that uses the listKeys function

Environment

No response