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.

Diagnostic Settings schema

See original GitHub issue

It doesn’t look like diagnosticSettings is supported in schemas for the available types. I get a warning when I put diagnosticSettings on a resource. It doesn’t seem to be a part of 2017-05-01-preview like the docs suggest.

{
    "type": "providers/diagnosticSettings",
    "name": "[concat('Microsoft.Insights/', parameters('appserviceName'), 'diagnostics')]",
    "dependsOn": [
        "[resourceId('Microsoft.Web/sites/slots', parameters('appserviceName'), 'Staging')]"
    ],
    "apiVersion": "2017-05-01-preview",
    "properties": {
        "name": "[concat('Microsoft.Insights/', parameters('appserviceName'), '-staging', 'diagnostics')]",
        "workspaceId": "[variables('omsWorkspaceId')]",
        "logs": [
            {
                "category": "FunctionExecutionLogs",
                "enabled": true,
                "retentionPolicy": {
                    "days": 30,
                    "enabled": true
                }
            }
        ],
        "metrics": [
            {
                "category": "AllMetrics",
                "enabled": true,
                "retentionPolicy": {
                    "enabled": true,
                    "days": 30
                }
            }
        ]
    }
}

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
anthony-c-martincommented, Sep 3, 2021

@reijoh - it’ll require some fairly significant changes to schema generation to support natively in JSON schema, so I’ll have to discuss with the team w.r.t prioritization. You’re right though - the “scope” property which was added since the issue was raised does make this MUCH easier to solve within JSON schema than it would have been back in 2018.

This is a scenario we’re actively trying to provide better validation for in Bicep - for example, here’s your template converted:

resource server 'Microsoft.Sql/servers@2021-02-01-preview' = {
  name: 'server'
  location: 'westeurope'
  properties: {
    version: '12.0'
  }
}

resource workspace 'Microsoft.OperationalInsights/workspaces@2021-06-01' existing = {
  scope: resourceGroup('15df4cd3-5085-498a-b9b8-10a7b67c3fdf', 'p-mgt-mon')
  name: 'p-mgt-montmdhdmbcxm-ws'
}

resource settings 'Microsoft.Insights/diagnosticsettings@2021-05-01-preview' = {
  scope: server
  name: 'settings'
  properties: {
    workspaceId: workspace.id
    logs: []
    metrics: [
      {
        category: 'AllMetrics'
        enabled: true
      }
    ]
  }
}
1reaction
msftbot[bot]commented, Sep 24, 2021

Hello @apclouds, @anthony-c-martin, @jorgecotillo! It looks like there is a schemas issue that needs your attention. Please investigate and confirm it is on your end. Thanks 😄

Issue Details

It doesn’t look like diagnosticSettings is supported in schemas for the available types. I get a warning when I put diagnosticSettings on a resource. It doesn’t seem to be a part of 2017-05-01-preview like the docs suggest.

{
    "type": "providers/diagnosticSettings",
    "name": "[concat('Microsoft.Insights/', parameters('appserviceName'), 'diagnostics')]",
    "dependsOn": [
        "[resourceId('Microsoft.Web/sites/slots', parameters('appserviceName'), 'Staging')]"
    ],
    "apiVersion": "2017-05-01-preview",
    "properties": {
        "name": "[concat('Microsoft.Insights/', parameters('appserviceName'), '-staging', 'diagnostics')]",
        "workspaceId": "[variables('omsWorkspaceId')]",
        "logs": [
            {
                "category": "FunctionExecutionLogs",
                "enabled": true,
                "retentionPolicy": {
                    "days": 30,
                    "enabled": true
                }
            }
        ],
        "metrics": [
            {
                "category": "AllMetrics",
                "enabled": true,
                "retentionPolicy": {
                    "enabled": true,
                    "days": 30
                }
            }
        ]
    }
}
Author: migolfi
Assignees: -
Labels:

ARM, RP Fix

Milestone: -
Read more comments on GitHub >

github_iconTop Results From Across the Web

Common and service-specific schemas for Azure resource logs
Understand the supported services and event schemas for Azure resource logs. ... Azure Analysis Services: Set up diagnostic logging.
Read more >
Deploy Diagnostic Settings for Subscription to Log Analytics ...
Deploy Diagnostic Settings for Subscription to Log Analytics workspace - Deploys the diagnostic settings for a Subscription to stream to a ...
Read more >
How to handle diagnostic logs from different resources of ...
Azure diagnostics: All data is written to the AzureDiagnostics table. Because multiple resource types send data to the same table, its schema is ......
Read more >
Diagnostic Setting captures appropriate categories
Go to Azure Monitor · Click Activity log · Click on Diagnostic settings · Click on Edit Settings for the diagnostic settings entry...
Read more >
Enable Azure Resource Diagnostic Settings to Event Hub ...
In this example, we need to set the diagnostics settings to stream ... "$schema": "https://schema.management.azure.com/schemas/2019-04-01/ ...
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