microsoft.insights diagnosticSettings 2017-05-01-preview

Remarks

For guidance on deploying monitoring solutions, see Create monitoring resources by using Bicep.

Bicep resource definition

The diagnosticSettings resource type can be deployed with operations that target:

For a list of changed properties in each API version, see change log.

Resource format

To create a microsoft.insights/diagnosticSettings resource, add the following Bicep to your template.

resource symbolicname 'microsoft.insights/diagnosticSettings@2017-05-01-preview' = {
  scope: resourceSymbolicName or scope
  location: 'string'
  name: 'string'
  properties: {
    eventHubAuthorizationRuleId: 'string'
    eventHubName: 'string'
    logs: [
      {
        category: 'string'
        enabled: bool
      }
    ]
    serviceBusRuleId: 'string'
    storageAccountId: 'string'
    workspaceId: 'string'
  }
}

Property Values

microsoft.insights/diagnosticSettings

Name Description Value
location Location of the resource string
name The resource name string (required)
properties Properties of a Subscription Diagnostic Settings Resource. SubscriptionDiagnosticSettings
scope Use when creating a resource at a scope that is different than the deployment scope. Set this property to the symbolic name of a resource to apply the extension resource.

SubscriptionDiagnosticSettings

Name Description Value
eventHubAuthorizationRuleId The resource Id for the event hub authorization rule. string
eventHubName The name of the event hub. If none is specified, the default event hub will be selected. string
logs The list of logs settings. SubscriptionLogSettings[]
serviceBusRuleId The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. string
storageAccountId The resource ID of the storage account to which you would like to send Diagnostic Logs. string
workspaceId The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 string

SubscriptionLogSettings

Name Description Value
category Name of a Subscription Diagnostic Log category for a resource type this setting is applied to. string
enabled a value indicating whether this log is enabled. bool (required)

Usage Examples

Azure Verified Modules

The following Azure Verified Modules can be used to deploy this resource type.

Module Description
Diagnostic Setting AVM Resource Module for Diagnostic Setting

Azure Quickstart Samples

The following Azure Quickstart templates contain Bicep samples for deploying this resource type.

Bicep File Description
AKS Cluster with a NAT Gateway and an Application Gateway This sample shows how to a deploy an AKS cluster with NAT Gateway for outbound connections and an Application Gateway for inbound connections.
AKS cluster with the Application Gateway Ingress Controller This sample shows how to deploy an AKS cluster with Application Gateway, Application Gateway Ingress Controller, Azure Container Registry, Log Analytics and Key Vault
Application Gateway with internal API Management and Web App Application Gateway routing Internet traffic to a virtual network (internal mode) API Management instance which services a web API hosted in an Azure Web App.
Application Gateway with WAF and firewall policy This template creates an Application Gateway with WAF configured along with a firewall policy
Azure Container Registry with Policies and Diagnostics Azure Container Registry with Policies and Diagnostics (bicep)
Azure Data Factory with Git and managed vnet configuration This template creates Azure Data Factory with Git configuration and managed virtual network.
Azure Game Developer Virtual Machine Azure Game Developer Virtual Machine includes Licencsed Engines like Unreal.
Azure SQL Server with Auditing written to Log Analytics This template allows you to deploy an Azure SQL server with Auditing enabled to write audit logs to Log Analytics (OMS workspace)
Create a Premium Redis Cache with clustering This template shows how to configure clustering in a premium Azure Redis Cache instance.
Create a Redis Cache using a template This template creates an Azure Redis Cache with diagnostics data kept in a storage account.
Create API Management in Internal VNet with App Gateway This template demonstrates how to Create a instance of Azure API Management on a private network protected by Azure Application Gateway.
Create Key Vault with logging enabled This template creates an Azure Key Vault and an Azure Storage account that is used for logging. It optionally creates resource locks to protect your Key Vault and storage resources.
Create Premium Redis Cache with data persistence This template shows how to configure persistence in a premium Azure Redis Cache instance.
Create Recovery Services Vault and Enable Diagnostics This template creates a Recovery Services Vault and enables diagnostics for Azure Backup. This also deploys storage account and oms workspace.
Create Recovery Services Vault with backup policies This template creates a Recovery Services Vault with backup policies and configure optional features such system identity, backup storage type, cross region restore and diagnostics logs and a delete lock.
Deploy a simple Azure Spring Apps microservice application This template deploys a simple Azure Spring Apps microservice application to run on Azure.
Deploy Secure Azure AI Studio with a managed virtual network This template creates a secure Azure AI Studio environment with robust network and identity security restrictions.
Front Door Premium with WAF and Microsoft-managed rule sets This template creates a Front Door Premium including a web application firewall with the Microsoft-managed default and bot protection rule sets.
Front Door Standard/Premium with WAF and custom rule This template creates a Front Door Standard/Premium including a web application firewall with a custom rule.
FrontDoor CDN with WAF, Domains and Logs to EventHub This template creates a new Azure FrontDoor cdn profile. Create WAF with custom and managed rules, cdn routes, origin and groups with their association with WAF and routes, configures custom domains, create event hub and diagnostic settings for sending CDN access logs using event hub.
Log Analytics workspace with solutions and data sources Deploys a Log Analytics workspace with specified solutions and data sources
Log Analytics workspace with VM Insights, Container Insights Deploys a Log Analytics workspace with VM Insights, Container Insights solutions and diagnostics.
Network Security Group with diagnostic logs This template creates a Network Security Group with diagnostic logs and a resource lock
Use Azure Firewall as a DNS Proxy in a Hub & Spoke topology This sample show how to deploy a hub-spoke topology in Azure using the Azure Firewall. The hub virtual network acts as a central point of connectivity to many spoke virtual networks that are connected to hub virtual network via virtual network peering.
Virtual Network with diagnostic logs This template creates a Virtual Network with diagnostic logs and allows optional features to be added to each subnet

ARM template resource definition

The diagnosticSettings resource type can be deployed with operations that target:

For a list of changed properties in each API version, see change log.

Resource format

To create a microsoft.insights/diagnosticSettings resource, add the following JSON to your template.

{
  "type": "microsoft.insights/diagnosticSettings",
  "apiVersion": "2017-05-01-preview",
  "name": "string",
  "location": "string",
  "properties": {
    "eventHubAuthorizationRuleId": "string",
    "eventHubName": "string",
    "logs": [
      {
        "category": "string",
        "enabled": "bool"
      }
    ],
    "serviceBusRuleId": "string",
    "storageAccountId": "string",
    "workspaceId": "string"
  }
}

Property Values

microsoft.insights/diagnosticSettings

Name Description Value
apiVersion The api version '2017-05-01-preview'
location Location of the resource string
name The resource name string (required)
properties Properties of a Subscription Diagnostic Settings Resource. SubscriptionDiagnosticSettings
type The resource type 'microsoft.insights/diagnosticSettings'

SubscriptionDiagnosticSettings

Name Description Value
eventHubAuthorizationRuleId The resource Id for the event hub authorization rule. string
eventHubName The name of the event hub. If none is specified, the default event hub will be selected. string
logs The list of logs settings. SubscriptionLogSettings[]
serviceBusRuleId The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. string
storageAccountId The resource ID of the storage account to which you would like to send Diagnostic Logs. string
workspaceId The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 string

SubscriptionLogSettings

Name Description Value
category Name of a Subscription Diagnostic Log category for a resource type this setting is applied to. string
enabled a value indicating whether this log is enabled. bool (required)

Usage Examples

Azure Quickstart Templates

The following Azure Quickstart templates deploy this resource type.

Template Description
AKS Cluster with a NAT Gateway and an Application Gateway

Deploy to Azure
This sample shows how to a deploy an AKS cluster with NAT Gateway for outbound connections and an Application Gateway for inbound connections.
AKS cluster with the Application Gateway Ingress Controller

Deploy to Azure
This sample shows how to deploy an AKS cluster with Application Gateway, Application Gateway Ingress Controller, Azure Container Registry, Log Analytics and Key Vault
Application Gateway with internal API Management and Web App

Deploy to Azure
Application Gateway routing Internet traffic to a virtual network (internal mode) API Management instance which services a web API hosted in an Azure Web App.
Application Gateway with WAF and firewall policy

Deploy to Azure
This template creates an Application Gateway with WAF configured along with a firewall policy
Azure Container Registry with Policies and Diagnostics

Deploy to Azure
Azure Container Registry with Policies and Diagnostics (bicep)
Azure Data Factory with Git and managed vnet configuration

Deploy to Azure
This template creates Azure Data Factory with Git configuration and managed virtual network.
Azure Game Developer Virtual Machine

Deploy to Azure
Azure Game Developer Virtual Machine includes Licencsed Engines like Unreal.
Azure SQL Server with Auditing written to Log Analytics

Deploy to Azure
This template allows you to deploy an Azure SQL server with Auditing enabled to write audit logs to Log Analytics (OMS workspace)
Create a Premium Redis Cache with clustering

Deploy to Azure
This template shows how to configure clustering in a premium Azure Redis Cache instance.
Create a Redis Cache using a template

Deploy to Azure
This template creates an Azure Redis Cache with diagnostics data kept in a storage account.
Create API Management in Internal VNet with App Gateway

Deploy to Azure
This template demonstrates how to Create a instance of Azure API Management on a private network protected by Azure Application Gateway.
Create Key Vault with logging enabled

Deploy to Azure
This template creates an Azure Key Vault and an Azure Storage account that is used for logging. It optionally creates resource locks to protect your Key Vault and storage resources.
Create Premium Redis Cache with data persistence

Deploy to Azure
This template shows how to configure persistence in a premium Azure Redis Cache instance.
Create Recovery Services Vault and Enable Diagnostics

Deploy to Azure
This template creates a Recovery Services Vault and enables diagnostics for Azure Backup. This also deploys storage account and oms workspace.
Create Recovery Services Vault with backup policies

Deploy to Azure
This template creates a Recovery Services Vault with backup policies and configure optional features such system identity, backup storage type, cross region restore and diagnostics logs and a delete lock.
Create SQL MI with configured sending of logs and metrics

Deploy to Azure
This template allows you to deploy SQL MI and additional resources used for storing logs and metrics (diagnostic workspace, storage account, event hub).
Deploy a simple Azure Spring Apps microservice application

Deploy to Azure
This template deploys a simple Azure Spring Apps microservice application to run on Azure.
Deploy Secure Azure AI Studio with a managed virtual network

Deploy to Azure
This template creates a secure Azure AI Studio environment with robust network and identity security restrictions.
Front Door Premium with WAF and Microsoft-managed rule sets

Deploy to Azure
This template creates a Front Door Premium including a web application firewall with the Microsoft-managed default and bot protection rule sets.
Front Door Standard/Premium with WAF and custom rule

Deploy to Azure
This template creates a Front Door Standard/Premium including a web application firewall with a custom rule.
FrontDoor CDN with WAF, Domains and Logs to EventHub

Deploy to Azure
This template creates a new Azure FrontDoor cdn profile. Create WAF with custom and managed rules, cdn routes, origin and groups with their association with WAF and routes, configures custom domains, create event hub and diagnostic settings for sending CDN access logs using event hub.
Log Analytics workspace with solutions and data sources

Deploy to Azure
Deploys a Log Analytics workspace with specified solutions and data sources
Log Analytics workspace with VM Insights, Container Insights

Deploy to Azure
Deploys a Log Analytics workspace with VM Insights, Container Insights solutions and diagnostics.
Network Security Group with diagnostic logs

Deploy to Azure
This template creates a Network Security Group with diagnostic logs and a resource lock
Use Azure Firewall as a DNS Proxy in a Hub & Spoke topology

Deploy to Azure
This sample show how to deploy a hub-spoke topology in Azure using the Azure Firewall. The hub virtual network acts as a central point of connectivity to many spoke virtual networks that are connected to hub virtual network via virtual network peering.
Virtual Network with diagnostic logs

Deploy to Azure
This template creates a Virtual Network with diagnostic logs and allows optional features to be added to each subnet

Terraform (AzAPI provider) resource definition

The diagnosticSettings resource type can be deployed with operations that target:

For a list of changed properties in each API version, see change log.

Resource format

To create a microsoft.insights/diagnosticSettings resource, add the following Terraform to your template.

resource "azapi_resource" "symbolicname" {
  type = "microsoft.insights/diagnosticSettings@2017-05-01-preview"
  name = "string"
  parent_id = "string"
  location = "string"
  body = jsonencode({
    properties = {
      eventHubAuthorizationRuleId = "string"
      eventHubName = "string"
      logs = [
        {
          category = "string"
          enabled = bool
        }
      ]
      serviceBusRuleId = "string"
      storageAccountId = "string"
      workspaceId = "string"
    }
  })
}

Property Values

microsoft.insights/diagnosticSettings

Name Description Value
location Location of the resource string
name The resource name string (required)
parent_id The ID of the resource to apply this extension resource to. string (required)
properties Properties of a Subscription Diagnostic Settings Resource. SubscriptionDiagnosticSettings
type The resource type "microsoft.insights/diagnosticSettings@2017-05-01-preview"

SubscriptionDiagnosticSettings

Name Description Value
eventHubAuthorizationRuleId The resource Id for the event hub authorization rule. string
eventHubName The name of the event hub. If none is specified, the default event hub will be selected. string
logs The list of logs settings. SubscriptionLogSettings[]
serviceBusRuleId The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. string
storageAccountId The resource ID of the storage account to which you would like to send Diagnostic Logs. string
workspaceId The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 string

SubscriptionLogSettings

Name Description Value
category Name of a Subscription Diagnostic Log category for a resource type this setting is applied to. string
enabled a value indicating whether this log is enabled. bool (required)