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/virtual-machines/extensions/diagnostics-template.md
+11-10Lines changed: 11 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,16 +7,17 @@ ms.subservice: extensions
7
7
ms.custom: devx-track-arm-template
8
8
ms.author: gabsta
9
9
author: GabstaMSFT
10
+
ms.reviewer: erd
10
11
ms.collection: windows
11
-
ms.date: 05/31/2017
12
+
ms.date: 04/21/2023
12
13
---
13
14
# Use monitoring and diagnostics with a Windows VM and Azure Resource Manager templates
14
15
The Azure Diagnostics Extension provides the monitoring and diagnostics capabilities on a Windows-based Azure virtual machine. You can enable these capabilities on the virtual machine by including the extension as part of the Azure Resource Manager template. See [Authoring Azure Resource Manager Templates with VM Extensions](../windows/template-description.md#extensions) for more information on including any extension as part of a virtual machine template. This article describes how you can add the Azure Diagnostics extension to a windows virtual machine template.
15
16
16
17
## Add the Azure Diagnostics extension to the VM resource definition
17
18
To enable the diagnostics extension on a Windows Virtual Machine, you need to add the extension as a VM resource in the Resource Manager template.
18
19
19
-
For a simple Resource Manager based Virtual Machine add the extension configuration to the *resources* array for the Virtual Machine:
20
+
For a simple Resource Manager based Virtual Machine, add the extension configuration to the *resources* array for the Virtual Machine:
20
21
21
22
```json
22
23
"resources": [
@@ -65,11 +66,11 @@ The *publisher* property with the value of **Microsoft.Azure.Diagnostics** and t
65
66
66
67
The value of the *name* property can be used to refer to the extension in the resource group. Setting it specifically to **Microsoft.Insights.VMDiagnosticsSettings** enables it to be easily identified by the Azure portal ensuring that the monitoring charts show up correctly in the Azure portal.
67
68
68
-
The *typeHandlerVersion* specifies the version of the extension you would like to use. Setting *autoUpgradeMinorVersion* minor version to **true** ensures that you get the latest Minor version of the extension that is available. It is highly recommended that you always set *autoUpgradeMinorVersion* to always be **true** so that you always get to use the latest available diagnostics extension with all the new features and bug fixes.
69
+
The *typeHandlerVersion* specifies the version of the extension you would like to use. Setting *autoUpgradeMinorVersion* minor version to **true** ensures that you get the latest Minor version of the extension that is available. It's highly recommended that you always set *autoUpgradeMinorVersion* to always be **true** so that you always get to use the latest available diagnostics extension with all the new features and bug fixes.
69
70
70
-
The *settings* element contains configurations properties for the extension that can be set and read back from the extension (sometimes referred to as public configuration). The *xmlcfg* property contains xml based configuration for the diagnostics logs, performance counters etc that are collected by the diagnostics agent. See [Diagnostics Configuration Schema](../../azure-monitor/agents/diagnostics-extension-schema-windows.md) for more information about the xml schema itself. A common practice is to store the actual xml configuration as a variable in the Azure Resource Manager template and then concatenate and base64 encode them to set the value for *xmlcfg*. See the section on [diagnostics configuration variables](#diagnostics-configuration-variables) to understand more about how to store the xml in variables. The *storageAccount* property specifies the name of the storage account to which diagnostics data is transferred.
71
+
The *settings* element contains configurations properties for the extension that can be set and read back from the extension (sometimes referred to as public configuration). The *xmlcfg* property contains xml based configuration for the diagnostics logs, performance counters etc. that are collected by the diagnostics agent. See [Diagnostics Configuration Schema](../../azure-monitor/agents/diagnostics-extension-schema-windows.md) for more information about the xml schema itself. A common practice is to store the actual xml configuration as a variable in the Azure Resource Manager template and then concatenate and base64 encode them to set the value for *xmlcfg*. See the section on [diagnostics configuration variables](#diagnostics-configuration-variables) to understand more about how to store the xml in variables. The *storageAccount* property specifies the name of the storage account to which diagnostics data is transferred.
71
72
72
-
The properties in *protectedSettings* (sometimes referred to as private configuration) can be set but cannot be read back after being set. The write-only nature of *protectedSettings* makes it useful for storing secrets like the storage account key where the diagnostics data is written.
73
+
The properties in *protectedSettings* (sometimes referred to as private configuration) can be set but can't be read back after being set. The write-only nature of *protectedSettings* makes it useful for storing secrets like the storage account key where the diagnostics data is written.
73
74
74
75
## Specifying diagnostics storage account as parameters
75
76
The diagnostics extension json snippet above assumes two parameters *existingdiagnosticsStorageAccountName* and
@@ -90,7 +91,7 @@ The diagnostics extension json snippet above assumes two parameters *existingdia
90
91
}
91
92
```
92
93
93
-
It is best practice to specify a diagnostics storage account in a different resource group than the resource group for the virtual machine. A resource group can be considered to be a deployment unit with its own lifetime, a virtual machine can be deployed and redeployed as new configurations updates are made it to it but you may want to continue storing the diagnostics data in the same storage account across those virtual machine deployments. Having the storage account in a different resource enables the storage account to accept data from various virtual machine deployments making it easy to troubleshoot issues across the various versions.
94
+
It's best practice to specify a diagnostics storage account in a different resource group than the resource group for the virtual machine. A resource group can be considered to be a deployment unit with its own lifetime, a virtual machine can be deployed and redeployed as new configurations updates are made it to it but you may want to continue storing the diagnostics data in the same storage account across those virtual machine deployments. Having the storage account in a different resource enables the storage account to accept data from various virtual machine deployments making it easy to troubleshoot issues across the various versions.
94
95
95
96
> [!NOTE]
96
97
> If you create a windows virtual machine template from Visual Studio, the default storage account might be set to use the same storage account where the virtual machine VHD is uploaded. This is to simplify initial setup of the VM. Re-factor the template to use a different storage account that can be passed in as a parameter.
@@ -133,9 +134,9 @@ The following example shows the xml for metrics definitions:
133
134
</Metrics>
134
135
```
135
136
136
-
The *resourceID* attribute uniquely identifies the virtual machine in your subscription. Make sure to use the subscription() and resourceGroup() functions so that the template automatically updates those values based on the subscription and resource group you are deploying to.
137
+
The *resourceID* attribute uniquely identifies the virtual machine in your subscription. Make sure to use the subscription() and resourceGroup() functions so that the template automatically updates those values based on the subscription and resource group you're deploying to.
137
138
138
-
If you are creating multiple Virtual Machines in a loop, you have to populate the *resourceID* value with an copyIndex() function to correctly differentiate each individual VM. The *xmlCfg* value can be updated to support this as follows:
139
+
If you're creating multiple Virtual Machines in a loop, you have to populate the *resourceID* value with an copyIndex() function to correctly differentiate each individual VM. The *xmlCfg* value can be updated to support this as follows:
@@ -148,7 +149,7 @@ The Metrics configuration above generates tables in your diagnostics storage acc
148
149
149
150
***WADMetrics**: Standard prefix for all WADMetrics tables
150
151
***PT1H** or **PT1M**: Signifies that the table contains aggregate data over 1 hour or 1 minute
151
-
***P10D**: Signifies the table will contain data for 10 days from when the table started collecting data
152
+
***P10D**: Signifies the table contains data for 10 days from when the table started collecting data
152
153
***V2S**: String constant
153
154
***yyyymmdd**: The date at which the table started collecting data
154
155
@@ -157,7 +158,7 @@ Example: *WADMetricsPT1HP10DV2S20151108* contains metrics data aggregated over a
157
158
Each WADMetrics table contains the following columns:
158
159
159
160
***PartitionKey**: The partition key is constructed based on the *resourceID* value to uniquely identify the VM resource. For example: `002Fsubscriptions:<subscriptionID>:002FresourceGroups:002F<ResourceGroupName>:002Fproviders:002FMicrosoft:002ECompute:002FvirtualMachines:002F<vmName>`
160
-
***RowKey**: Follows the format `<Descending time tick>:<Performance Counter Name>`. The descending time tick calculation is max time ticks minus the time of the beginning of the aggregation period. For example if the sample period started on 10-Nov-2015 and 00:00Hrs UTC then the calculation would be: `DateTime.MaxValue.Ticks - (new DateTime(2015,11,10,0,0,0,DateTimeKind.Utc).Ticks)`. For the memory available bytes performance counter the row key will look like: `2519551871999999999__:005CMemory:005CAvailable:0020Bytes`
161
+
***RowKey**: Follows the format `<Descending time tick>:<Performance Counter Name>`. The descending time tick calculation is max time ticks minus the time of the beginning of the aggregation period. For example if the sample period started on 10-Nov-2015 and 00:00Hrs UTC then the calculation would be: `DateTime.MaxValue.Ticks - (new DateTime(2015,11,10,0,0,0,DateTimeKind.Utc).Ticks)`. For the memory available bytes performance, counter the row key looks like: `2519551871999999999__:005CMemory:005CAvailable:0020Bytes`
161
162
***CounterName**: Is the name of the performance counter. This matches the *counterSpecifier* defined in the xml config.
162
163
***Maximum**: The maximum value of the performance counter over the aggregation period.
163
164
***Minimum**: The minimum value of the performance counter over the aggregation period.
0 commit comments