Enable diagnostic by Azure REST API:
I'm using the Azure REST API to enable diagnostic. Below is the request that I send to Azure.
Method: PUT
HEADERS:
Authorization:Bearer {Access_token}
Content-Type:application/json
Request URI:
https://management.azure.com/subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/virtualMachines/{VMName}/extensions/IaaSDiagnostics?api-version=2016-04-30-preview
Request Body:
const reqBody = {
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-8cxxxxxxxxxx/resourceGroups/param/providers/Microsoft.Compute/virtualMachines/parwin/extensions/IaaSDiagnostics",
"name": "IaaSDiagnostics",
"type": "Microsoft.Compute/virtualMachines/extensions",
"location": "eastus",
"properties": {
"publisher": "Microsoft.Azure.Diagnostics",
"type": "IaaSDiagnostics",
"typeHandlerVersion": "1.5",
"autoUpgradeMinorVersion": true,
"settings": {
"StorageAccount": "paramstorage10",
"WadCfg": base64.encode('<?xml version="1.0" encoding="utf-8"?><PublicConfig xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration"><WadCfg><DiagnosticMonitorConfiguration overallQuotaInMB="5120"><PerformanceCounters scheduledTransferPeriod="PT1M"><PerformanceCounterConfiguration counterSpecifier="\Processor(_Total)\% Processor Time" sampleRate="PT1M" unit="percent"><annotation displayName="Processor - total processor time" locale="en-us"/></PerformanceCounterConfiguration></PerformanceCounters><WindowsEventLog scheduledTransferPeriod="PT1M"><DataSource name="System!*"/></WindowsEventLog><Metrics resourceId="/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-8cxxxxxxxxxx/resourceGroups/param/providers/Microsoft.Compute/virtualMachines/parwin"><MetricAggregation scheduledTransferPeriod="PT1H"/><MetricAggregation scheduledTransferPeriod="PT1M"/></Metrics></DiagnosticMonitorConfiguration></WadCfg></PublicConfig>')
}
}
};
Response:
{
"name": "IaaSDiagnostics",
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-8cxxxxxxxxxx/resourceGroups/param/providers/Microsoft.Compute/virtualMachines/parwin/extensions/IaaSDiagnostics",
"type": "Microsoft.Compute/virtualMachines/extensions",
"location": "eastus",
"properties": {
"autoUpgradeMinorVersion": true,
"provisioningState": "Creating",
"publisher": "Microsoft.Azure.Diagnostics",
"type": "IaaSDiagnostics",
"typeHandlerVersion": "1.5",
"settings": {
"StorageAccount": "paramstorage10",
"WadCfg": "GFDHasdsdfnkmsdfknsdifdskfsdkisf87s8443nkj4ejfgdf487843503603 vkngsfkkfgkjsfnvkjfdsnisfgsnfsgjksfigfsgnskfdgjsfgksfngsfgkslskakfdabvdbd674435bq4jZmM5Y2UyOTUtYjdmYS00MGZiLTgzNTMtOGM2M2RjNTI0NjRjL3Jlc291cmNlR3JvdXBzL3BhcmFtMDgxMi9wcm92aWRlcnMvTWljcm9zb2Z0LkNvbXB1dGUvdmlydHVhbE1hY2hpbmVzL3BhcndpbiI+PE1ldHJpY0FnZ3JlZ2F0aW9uIHNjaGVkdWxlZFRyYW5zZmVyUGVyaW9kPSJQVDFIIi8+PE1ldHJpY0FnZ3JlZ2F0aW9uIHNjaGVkdWxlZFRyYW5zZmVyUGVyaW9kPSJQVDFNIi8+PC9NZXRyaWNzPjwvRGlhZ25vc3RpY01vbml0b3JDb25maWd1cmF0aW9uPjwvV2FkQ2ZnPjdskfjgsdfgksfgk849349f=="
}
}
}
AZURE UI:
Issue:
After Request, I'm getting the successful response but When I'm going to Azure then the Diagnostics extension don't have successfully installed.
So how do I successfully install the diagnostics setting extension ??