Azure / Azure/azure-quickstart-templates

Getting `InvalidPolicyParameters` error when configuring logAnalyticsWorkspace retention days

Open
#13,181 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Bicep
Stars
14.9k
Forks
16.2k
Avg merge
6d 21h
Merged PRs (30d)
6

Description

[web-app-loganalytics](https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.web/web-app-loganalytics)

### Issue Details
My bicep:
```
resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2020-08-01' = {
name: logAnalyticsName
location: resourceGroup().location
properties: {
sku: {
name: 'PerGB2018'
}
retentionInDays: 365
features: {
enableLogAccessUsingOnlyResourcePermissions: true
}
}
}
```

This error disappeared after I remove `retentionInDays` property. How can I set this property with Bicep?

Detailed error messages:
```
{
"code": "InvalidPolicyParameters",
"message": "A function or parameter in policy assignment 'acat-custom-policy-set-assignment' associated with the policy definition 'log-analytics-workspace-retention' could not be validated. Please either fix the policy or remove the policy assignment to unblock. If using template functions, try following the tips in: https://aka.ms/policy-avoiding-template-failures. The inner error is 'The template language function 'length' expects its parameter to be an array, object, or a string. The provided value is of type 'Integer'. Please see https://aka.ms/arm-template-expressions/#length for usage details.'."
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the web-app-loganalytics quickstart and its Microsoft.OperationalInsights/workspaces resource, then trace the acat-custom-policy-set-assignment and log-analytics-workspace-retention names from the error. Confirm why retentionInDays: 365 reaches the policy's length call; done means the quickstart deploys with retentionInDays set and the policy validation error is gone.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.