Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type 'diagnosticSettings' is not available to Bicep #924

Closed
dgard1981 opened this issue Nov 16, 2020 · 2 comments
Closed

Type 'diagnosticSettings' is not available to Bicep #924

dgard1981 opened this issue Nov 16, 2020 · 2 comments

Comments

@dgard1981
Copy link

Bicep version

  • Bicep CLI version 0.2.14 (0a0f974)
  • VS Code extension v0.2.3

Describe the bug

I'm unable to declare a resource of type Microsoft.DocumentDB/databaseAccounts/providers/diagnosticSettings through Bicep.

Attempting to do so results in a warning for the type -

Resource type "Microsoft.DocumentDB/databaseAccounts/providers/diagnosticSettings@2017-05-01-preview" does not have types available. bicep(BCP081)

And adding required properties such as workspaceId and metrics results in an error for each property -

The property "workspaceId" is not allowed on objects of type "Microsoft.DocumentDB/databaseAccounts/providers/diagnosticSettings@2017-05-01-preview". Permissible properties include "dependsOn", "eTag", "extendedLocation", "identity", "kind", "location", "managedBy", "managedByExtended", "plan", "properties", "scale", "sku", "tags", "zones". bicep(BCP038)

To Reproduce

Include the following resource in the bicep file.

resource cosmosDbAccountDiagnosticsResource 'Microsoft.DocumentDB/databaseAccounts/providers/diagnosticSettings@2017-05-01-preview' = {
  name: '${cosmosDb.name}/Microsoft.Insights/${cosmosDb.name}'
  workspaceId: '/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/my-rg/providers/microsoft.operationalinsights/workspaces/my-loganalytics'
  metrics: [
    {
      category: 'AllMetrics'
      enabled: true
    }
  ]
}

Additional context

The following equivalent ARM template resource deploys as expected.

{
    "type": "Microsoft.DocumentDB/databaseAccounts/providers/diagnosticSettings",
    "name": "[format('{0}/Microsoft.Insights/{0}', parameters('cosmosDb').name)]",
    "apiVersion": "2017-05-01-preview",
    "properties": {
        "name": "[parameters('cosmosDb').name]",
        "workspaceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/my-rg/providers/microsoft.operationalinsights/workspaces/my-loganalytics",
        "metrics": [
            {
                "category": "AllMetrics",
                "enabled": true
            }
        ]
    },
    "dependsOn": [
        "[resourceId('Microsoft.DocumentDB/databaseAccounts', parameters('cosmosDb').name)]"
    ]
}
@ghost ghost added the Needs: Triage 🔍 label Nov 16, 2020
@alex-frankel
Copy link
Collaborator

Two separate issues:

  1. the type is indeed missing. Can you add it to the pinned issue Missing type validation / inaccuracies #784?
  2. The error is because you are missing the properties property as a top level property. Both workspaceId and metrics should be declared inside the properties object.

@dgard1981
Copy link
Author

  1. Of course, I've done that.
  2. 🤦‍♂️ Copy and paste from ARM template is clearly to difficult for me!

Thanks.

@ghost ghost locked as resolved and limited conversation to collaborators May 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants