aks-baseline-automation icon indicating copy to clipboard operation
aks-baseline-automation copied to clipboard

Diagnostics - Retention policy causing resource creation failure

Open gstevens-kyriba opened this issue 5 months ago • 1 comments

It seems many of the CARML modules enable Diagnostic Logging on the resources created. However, it seems this has changed and several resources won't create due to the retention policy setting. The error is:

Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="BadRequest" Message="Diagnostic settings does not support retention for new diagnostic settings."

I'm working around it by commenting out the retentionPolicy on various resources to get them to create.
I've commented out the retention policy on:

bicep\CARML\Microsoft.ContainerRegistry\registries\deploy.bicep bicep\CARML\Microsoft.Network\applicationGateways\deploy.bicep bicep\CARML\Microsoft.Network\azureFirewalls\deploy.bicep bicep\CARML\Microsoft.Network\bastionHosts\deploy.bicep bicep\CARML\Microsoft.Network\networkSecurityGroups\deploy.bicep bicep\CARML\Microsoft.Network\virtualNetworks\deploy.bicep

var diagnosticsLogsSpecified = [for category in filter(diagnosticLogCategoriesToEnable, item => item != 'allLogs'): { category: category enabled: true // retentionPolicy: { // enabled: true // days: diagnosticLogsRetentionInDays // } }]

var diagnosticsLogs = contains(diagnosticLogCategoriesToEnable, 'allLogs') ? [ { categoryGroup: 'allLogs' enabled: true // retentionPolicy: { // enabled: true // days: diagnosticLogsRetentionInDays // } } ] : diagnosticsLogsSpecified

var diagnosticsMetrics = [for metric in diagnosticMetricsToEnable: { category: metric timeGrain: null enabled: true // retentionPolicy: { // enabled: true // days: diagnosticLogsRetentionInDays // } }]

gstevens-kyriba avatar Sep 13 '24 17:09 gstevens-kyriba