You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/automation/automation-dsc-diagnostics.md
+48-51Lines changed: 48 additions & 51 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,118 +31,115 @@ With Azure Monitor logs you can:
31
31
To start sending your Automation State Configuration reports to Azure Monitor logs, you need:
32
32
33
33
- The November 2016 or later release of [Azure PowerShell](/powershell/azure/overview) (v2.3.0).
34
-
- An Azure Automation account. For more information, see [Getting Started with Azure Automation](automation-offering-get-started.md)
35
-
- A Log Analytics workspace with an **Automation & Control** service offering. For more information, see [Get started with Azure Monitor logs](../log-analytics/log-analytics-get-started.md).
36
-
- At least one Azure Automation State Configuration node. For more information, see [Onboarding machines for management by Azure Automation State Configuration](automation-dsc-onboarding.md)
37
-
- The [xDscDiagnostics](https://www.powershellgallery.com/packages/xDscDiagnostics/2.7.0.0) module, version 2.7.0.0 or greater. For installation steps, see [View DSC logs on your Node](./troubleshoot/desired-state-configuration.md#steps-to-troubleshoot-desired-state-configuration-dsc).
34
+
- An Azure Automation account. For more information, see [An introduction to Azure Automation](automation-intro.md).
35
+
- A Log Analytics workspace with an Automation & Control service offering. For more information, see [Get started with Log Analytics in Azure Monitor](https://docs.microsoft.com/azure/azure-monitor/log-query/get-started-portal).
36
+
- At least one Azure Automation State Configuration node. For more information, see [Onboarding machines for management by Azure Automation State Configuration](automation-dsc-onboarding.md).
37
+
- The [xDscDiagnostics](https://www.powershellgallery.com/packages/xDscDiagnostics/2.7.0.0) module, version 2.7.0.0 or greater. For installation steps, see [Troubleshoot Azure Automation Desired State Configuration](./troubleshoot/desired-state-configuration.md#steps-to-troubleshoot-desired-state-configuration-dsc).
38
38
39
39
## Set up integration with Azure Monitor logs
40
40
41
41
To begin importing data from Azure Automation DSC into Azure Monitor logs, complete the following steps:
42
42
43
-
1. Log in to your Azure account in PowerShell. See [Log in with Azure PowerShell](https://docs.microsoft.com/powershell/azure/authenticate-azureps)
44
-
1. Get the _ResourceId_ of your automation account by running the following PowerShell command:
45
-
(if you have more than one automation account, choose the _ResourceID_ for the account you want to configure).
43
+
1. Log in to your Azure account in PowerShell. See [Sign in with Azure PowerShell](https://docs.microsoft.com/powershell/azure/authenticate-azureps).
44
+
1. Get the resource ID of your Automation account by running the following PowerShell cmdlet. If you have more than one automation account, choose the resource ID for the account that you want to configure.
1. Get the _ResourceId_ of your Log Analytics workspace by running the following PowerShell command:
53
-
(if you have more than one workspace, choose the _ResourceID_ for the workspace you want to configure).
51
+
1. Get the resource ID of your Log Analytics workspace by running the following PowerShell cmdlet. If you have more than one workspace, choose the resource ID for the workspace that you want to configure.
54
52
55
53
```powershell
56
54
# Find the ResourceId for the Log Analytics workspace
1. Run the following PowerShell command, replacing `<AutomationResourceId>` and `<WorkspaceResourceId>` with the _ResourceId_ values from each of the previous steps:
58
+
1. Run the following PowerShell cmdlet, replacing `<AutomationResourceId>` and `<WorkspaceResourceId>` with the *ResourceId* values from each of the previous steps.
After you set up integration with Azure Monitor logs for your Automation State Configuration data, they can be viewed by selecting **Logs** in the **Monitoring** section in the left pane of the State Configuration (DSC) page.
72
+
After you set up integration with Azure Monitor logs for your Automation State Configuration data, you can view them by selecting **Logs** in the **Monitoring** section in the left pane of the State configuration (DSC) page.
The **Log Search** blade opens, and you see a **DscNodeStatusData** operation for each State
79
-
Configuration node, and a **DscResourceStatusData** operation for each [DSC
80
-
resource](/powershell/scripting/dsc/resources/resources) called in the Node configuration applied to that node.
81
-
82
-
The **DscResourceStatusData** operation contains error information for any DSC resources that failed.
76
+
The **Log Search** pane opens with a query region scoped to your Automation account resource. You can search the State Configuration logs for DSC operations by searching in Azure Monitor logs. The records for DSC operations are stored in the AzureDiagnostics table. For example, to find nodes that are not compliant, type the following query.
83
77
84
-
Click each operation in the list to see the data for that operation.
85
-
86
-
You can also view the logs by searching in Azure Monitor logs. See [Find data using log searches](https://docs.microsoft.com/azure/azure-monitor/log-query/log-query-overview). Type the following query to find your State Configuration logs.
87
-
88
-
```
89
-
AzureDiagnostics
78
+
```AzureDiagnostics
90
79
| where Category == 'DscNodeStatus'
91
80
| where OperationName contains 'DSCNodeStatusData'
92
81
| where ResultType != 'Compliant'
93
82
```
83
+
Filtering details:
84
+
85
+
* Filter on *DscNodeStatusData* to return operations for each State Configuration node.
86
+
* Filter on *DscResourceStatusData* to return operations for each DSC resource called in the node configuration applied to that resource.
87
+
* Filter on *DscResourceStatusData* to return error information for any DSC resources that fail.
88
+
89
+
To learn more about constructing log queries to find data, see [Overview of log queries in Azure Monitor](https://docs.microsoft.com/azure/azure-monitor/log-query/log-query-overview).
94
90
95
91
### Send an email when a State Configuration compliance check fails
96
92
97
-
One of our top customer requests is for the ability to send an email or a text when something goes
98
-
wrong with a DSC configuration.
93
+
One of our top customer requests is for the ability to send an email or a text when something goes wrong with a DSC configuration.
99
94
100
-
To create an alert rule, you start by creating a log search for the State Configuration report
101
-
records that should invoke the alert. Click the **+ New Alert Rule** button to create and configure
95
+
To create an alert rule, start by creating a log search for the State Configuration report records that should invoke the alert. Click the **+ New Alert Rule** button to create and configure
102
96
the alert rule.
103
97
104
98
1. From the Log Analytics workspace Overview page, click **Logs**.
105
99
1. Create a log search query for your alert by typing the following search into the query field: `Type=AzureDiagnostics Category='DscNodeStatus' NodeName_s='DSCTEST1' OperationName='DscNodeStatusData' ResultType='Failed'`
106
100
107
-
If you have set up logs from more than one Automation account or subscription to your workspace, you can group your alerts by subscription and Automation account.
108
-
Automation account name can be derived from the Resource field in the search of DscNodeStatusData.
109
-
1. To open the **Create rule** screen, click **+ New Alert Rule** at the top of the page. For more information on the options to configure the alert, see [Create an alert rule](../monitoring-and-diagnostics/monitor-alerts-unified-usage.md).
101
+
If you have set up logs from more than one Automation account or subscription to your workspace, you can group your alerts by subscription and Automation account. Derive the Automation account name from the Resource field in the search of DscNodeStatusData.
102
+
1. To open the **Create rule** screen, click **+ New Alert Rule** at the top of the page.
103
+
104
+
For more information on the options to configure the alert, see [Create an alert rule](../monitoring-and-diagnostics/monitor-alerts-unified-usage.md).
110
105
111
106
### Find failed DSC resources across all nodes
112
107
113
108
One advantage of using Azure Monitor logs is that you can search for failed checks across nodes.
114
-
To find all instances of DSC resources that failed.
109
+
To find all instances of DSC resources that have failed:
115
110
116
-
1.From the Log Analytics workspace Overview page, click **Logs**.
111
+
1.On the Log Analytics workspace Overview page, click **Logs**.
117
112
1. Create a log search query for your alert by typing the following search into the query field: `Type=AzureDiagnostics Category='DscNodeStatus' OperationName='DscResourceStatusData' ResultType='Failed'`
118
113
119
114
### View historical DSC node status
120
115
121
-
Finally, you may want to visualize your DSC node status history over time.
122
-
You can use this query to search for the status of your DSC node status over time.
116
+
To visualize your DSC node status history over time, you can use this query:
This will display a chart of the node status over time.
120
+
This query displays a chart of the node status over time.
127
121
128
122
## Azure Monitor logs records
129
123
130
-
Diagnostics from Azure Automation creates two categories of records in Azure Monitor logs.
124
+
Azure Automation diagnostics create two categories of records in Azure Monitor logs:
125
+
126
+
* Node status data (DscNodeStatusData)
127
+
* Resource status data (DscResourceStatusData)
131
128
132
129
### DscNodeStatusData
133
130
134
131
| Property | Description |
135
132
| --- | --- |
136
133
| TimeGenerated |Date and time when the compliance check ran. |
137
-
| OperationName |DscNodeStatusData |
134
+
| OperationName |DscNodeStatusData.|
138
135
| ResultType |Whether the node is compliant. |
139
136
| NodeName_s |The name of the managed node. |
140
137
| NodeComplianceStatus_s |Whether the node is compliant. |
141
138
| DscReportStatus |Whether the compliance check ran successfully. |
142
-
| ConfigurationMode | How the configuration is applied to the node. Possible values are __"ApplyOnly"__,__"ApplyandMonitior"__, and __"ApplyandAutoCorrect"__. <ul><li>__ApplyOnly__: DSC applies the configuration and does nothing further unless a new configuration is pushed to the target node or when a new configuration is pulled from a server. After initial application of a new configuration, DSC does not check for drift from a previously configured state. DSC attempts to apply the configuration until it is successful before __ApplyOnly__ takes effect. </li><li> __ApplyAndMonitor__: This is the default value. The LCM applies any new configurations. After initial application of a new configuration, if the target node drifts from the desired state, DSC reports the discrepancy in logs. DSC attempts to apply the configuration until it is successful before __ApplyAndMonitor__ takes effect.</li><li>__ApplyAndAutoCorrect__: DSC applies any new configurations. After initial application of a new configuration, if the target node drifts from the desired state, DSC reports the discrepancy in logs, and then reapplies the current configuration.</li></ul> |
139
+
| ConfigurationMode | How the configuration is applied to the node. Possible values are: <ul><li>*ApplyOnly*: DSC applies the configuration and does nothing further unless a new configuration is pushed to the target node or when a new configuration is pulled from a server. After initial application of a new configuration, DSC does not check for drift from a previously configured state. DSC attempts to apply the configuration until it is successful before the *ApplyOnly* value takes effect. </li><li>*ApplyAndMonitor*: This is the default value. The LCM applies any new configurations. After initial application of a new configuration, if the target node drifts from the desired state, DSC reports the discrepancy in logs. DSC attempts to apply the configuration until it is successful before the *ApplyAndMonitor* value takes effect.</li><li>*ApplyAndAutoCorrect*: DSC applies any new configurations. After initial application of a new configuration, if the target node drifts from the desired state, DSC reports the discrepancy in logs, and then reapplies the current configuration.</li></ul> |
143
140
| HostName_s | The name of the managed node. |
144
141
| IPAddress | The IPv4 address of the managed node. |
145
-
| Category | DscNodeStatus |
142
+
| Category | DscNodeStatus.|
146
143
| Resource | The name of the Azure Automation account. |
147
144
| Tenant_g | GUID that identifies the tenant for the Caller. |
148
145
| NodeId_g |GUID that identifies the managed node. |
@@ -151,14 +148,14 @@ Diagnostics from Azure Automation creates two categories of records in Azure Mon
151
148
| ReportStartTime_t |Date and time when the report was started. |
152
149
| ReportEndTime_t |Date and time when the report completed. |
153
150
| NumberOfResources_d |The number of DSC resources called in the configuration applied to the node. |
154
-
| SourceSystem | How Azure Monitor logs collected the data. Always *Azure* for Azure diagnostics. |
155
-
| ResourceId |Specifies the Azure Automation account. |
151
+
| SourceSystem | How Azure Monitor logs collected the data. Always "Azure" for Azure diagnostics. |
152
+
| ResourceId |Identifier of the Azure Automation account. |
156
153
| ResultDescription | The description for this operation. |
157
154
| SubscriptionId | The Azure subscription ID (GUID) for the Automation account. |
158
155
| ResourceGroup | Name of the resource group for the Automation account. |
159
-
| ResourceProvider | MICROSOFT.AUTOMATION |
160
-
| ResourceType | AUTOMATIONACCOUNTS |
161
-
| CorrelationId |GUID that is the Correlation ID of the compliance report. |
156
+
| ResourceProvider | MICROSOFT.AUTOMATION.|
157
+
| ResourceType | AUTOMATIONACCOUNTS.|
158
+
| CorrelationId |GUID that is the correlation identifier of the compliance report. |
162
159
163
160
### DscResourceStatusData
164
161
@@ -168,7 +165,7 @@ Diagnostics from Azure Automation creates two categories of records in Azure Mon
168
165
| OperationName |DscResourceStatusData|
169
166
| ResultType |Whether the resource is compliant. |
170
167
| NodeName_s |The name of the managed node. |
171
-
| Category | DscNodeStatus |
168
+
| Category | DscNodeStatus.|
172
169
| Resource | The name of the Azure Automation account. |
173
170
| Tenant_g | GUID that identifies the tenant for the Caller. |
174
171
| NodeId_g |GUID that identifies the managed node. |
@@ -187,8 +184,8 @@ Diagnostics from Azure Automation creates two categories of records in Azure Mon
187
184
| ResultDescription | The description for this operation. |
188
185
| SubscriptionId | The Azure subscription ID (GUID) for the Automation account. |
189
186
| ResourceGroup | Name of the resource group for the Automation account. |
190
-
| ResourceProvider | MICROSOFT.AUTOMATION |
191
-
| ResourceType | AUTOMATIONACCOUNTS |
187
+
| ResourceProvider | MICROSOFT.AUTOMATION.|
188
+
| ResourceType | AUTOMATIONACCOUNTS.|
192
189
| CorrelationId |GUID that is the Correlation ID of the compliance report. |
0 commit comments