Skip to content

Commit 04cab88

Browse files
authored
Merge pull request #203577 from johndowns/bicep-scenario-monitoring-activity-log
Update Bicep monitoring scenarios - Add activity log diagnostic setting
2 parents fcc56ee + 5ea8d73 commit 04cab88

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

articles/azure-resource-manager/bicep/scenarios-monitoring.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Describes how to create monitoring resources by using Bicep.
44
author: willvelida
55
ms.author: willvelida
66
ms.topic: conceptual
7-
ms.date: 05/16/2022
7+
ms.date: 07/01/2022
88
---
99
# Create monitoring resources by using Bicep
1010

@@ -22,17 +22,27 @@ You can create Log Analytics workspaces with the resource type [Microsoft.Operat
2222

2323
## Diagnostic settings
2424

25+
Diagnostic settings enable you to configure Azure Monitor to export your logs and metrics to a number of destinations, including Log Analytics and Azure Storage.
26+
2527
When creating [diagnostic settings](../../azure-monitor/essentials/diagnostic-settings.md) in Bicep, remember that this resource is an [extension resource](scope-extension-resources.md), which means it's applied to another resource. You can create diagnostic settings in Bicep by using the resource type [Microsoft.Insights/diagnosticSettings](/azure/templates/microsoft.insights/diagnosticsettings?tabs=bicep).
2628

27-
When creating diagnostic settings in Bicep, you need to apply the scope of the diagnostic setting. The scope can be applied at the management, subscription, or resource group level. [Use the scope property on this resource to set the scope for this resource](../../azure-resource-manager/bicep/scope-extension-resources.md).
29+
When creating diagnostic settings in Bicep, you need to apply the scope of the diagnostic setting. The diagnostic setting can be applied at the management, subscription, or resource group level. [Use the scope property on this resource to set the scope for this resource](../../azure-resource-manager/bicep/scope-extension-resources.md).
2830

2931
Consider the following example:
3032

3133
::: code language="bicep" source="~/azure-docs-bicep-samples/samples/scenarios-monitoring/diagnostic-settings.bicep" :::
3234

3335
In the preceding example, you create a diagnostic setting for the App Service plan and send those diagnostics to Log Analytics. You can use the `scope` property to define your App Service plan as the scope for your diagnostic setting, and use the `workspaceId` property to define the Log Analytics workspace to send the diagnostic logs to. You can also export diagnostic settings to Event Hubs and Azure Storage Accounts.
3436

35-
Diagnostic settings differ between resources, so ensure that the diagnostic settings you want to create are applicable for the resource you're using.
37+
Log types differ between resources, so ensure that the logs you want to export are applicable for the resource you're using.
38+
39+
### Activity log diagnostic settings
40+
41+
To use Bicep to configure diagnostic settings to export the Azure activity log, deploy a diagnostic setting resource at the [subscription scope](deploy-to-subscription.md).
42+
43+
The following example shows how to export several activity log types to a Log Analytics workspace:
44+
45+
::: code language="bicep" source="~/azure-docs-bicep-samples/samples/scenarios-monitoring/diagnostic-settings-activity-log.bicep" :::
3646

3747
## Alerts
3848

0 commit comments

Comments
 (0)