Skip to content

Commit 9cbb630

Browse files
authored
Merge pull request #235491 from Lukeout/patch-31
Update agent-windows-troubleshoot.md
2 parents b987802 + d80be7f commit 9cbb630

File tree

1 file changed

+362
-0
lines changed

1 file changed

+362
-0
lines changed

articles/azure-monitor/agents/agent-windows-troubleshoot.md

Lines changed: 362 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,365 @@ If the query returns results, you need to determine if a particular data type is
131131
|8000 |HealthService |This event will specify if a workflow related to performance, event, or other data type collected is unable to forward to the service for ingestion to the workspace. | Event ID 2136 from source HealthService is written together with this event and can indicate the agent is unable to communicate with the service. Possible reasons might be misconfiguration of the proxy and authentication settings, network outage, or the network firewall or proxy doesn't allow TCP traffic from the computer to the service.|
132132
|10102 and 10103 |Health Service Modules |Workflow couldn't resolve the data source. |This issue can occur if the specified performance counter or instance doesn't exist on the computer or is incorrectly defined in the workspace data settings. If this is a user-specified [performance counter](data-sources-performance-counters.md#configure-performance-counters), verify the information specified follows the correct format and exists on the target computers. |
133133
|26002 |Health Service Modules |Workflow couldn't resolve the data source. |This issue can occur if the specified Windows event log doesn't exist on the computer. This error can be safely ignored if the computer isn't expected to have this event log registered. Otherwise, if this is a user-specified [event log](data-sources-windows-events.md#configure-windows-event-logs), verify the information specified is correct. |
134+
135+
## Pinned Certificate Issues with Older Microsoft Monitoring Agents - Breaking Change
136+
137+
*Root CA Change Overview*
138+
139+
As of 30 June 2023, Log Analytics back-end will no longer be accepting connections from MMA that reference an outdate root certificate. These MMAs are older versions prior to the Winter 2020 release (Log Analytics Agent) and prior to SCOM 2019 UR3 (SCOM). Any version, Bundle: 10.20.18053 / Extension: 1.0.18053.0, or greater will not have any issues, as well as any version above SCOM 2019 UR3. Any agent older than that will break and no longer be working and uploading to Log Analytics.
140+
141+
*What exactly is changing?*
142+
143+
As part of an ongoing security effort across various Azure services, Azure Log Analytics will be officially switching from the Baltimore CyberTrust CA Root to the [DigiCert Global G2 CA Root](https://www.digicert.com/kb/digicert-root-certificates.htm). This change will impact TLS communications with Log Analytics if the new DigiCert Global G2 CA Root certificate is missing from the OS, or the application is referencing the old Baltimore Root CA. **What this means is that Log Analytics will no longer accept connections from MMA that use this old root CA after it's retired.**
144+
145+
*Solution products*
146+
147+
You may have received the breaking change notification even if you have not personally installed the Microsoft Monitoring Agent. That is because various Azure products leverage the Microsoft Monitoring Agent. If you’re using one of these products, you may be affected as they leverage the Windows Log Analytics Agent. For those products with links below there may be specific instructions that will require you to upgrade to the latest agent.
148+
149+
- VM Insights
150+
- [System Center Operations Manager (SCOM)](/system-center/scom/deploy-upgrade-agents)
151+
- [System Center Service Manager (SCSM)](/system-center/scsm/upgrade-service-manager)
152+
- [Microsoft Defender for Server](/microsoft-365/security/defender-endpoint/update-agent-mma-windows)
153+
- [Microsoft Defender for Endpoint](/microsoft-365/security/defender-endpoint/update-agent-mma-windows)
154+
- Azure Sentinel
155+
- [Azure Automation Agent-based Hybrid Worker](../../automation/automation-windows-hrw-install.md#update-log-analytics-agent-to-latest-version)
156+
- [Azure Automation Change Tracking and Inventory](../../automation/change-tracking/overview.md?tabs=python-2#update-log-analytics-agent-to-latest-version)
157+
- [Azure Automation Update Management](../../automation/update-management/overview.md#update-windows-log-analytics-agent-to-latest-version)
158+
159+
160+
*Identifying and Remidiating Breaking Agents*
161+
162+
For deployments with a limited number of agents, we highly recommend you upgrading your agent per node via [these management instructions](https://aka.ms/MMA-Upgrade).
163+
164+
For deployments with multiple nodes, we've written a script that will detect any affected breaking MMAs per subscription and then subsequently upgrade them to the latest version. These scripts need to be run sequentially, starting with UpdateMMA.ps1 then UpgradeMMA.ps1. Depending on the machine, the script may take a while. PowerShell 7 or greater is needed to run to avoid a timeout.
165+
166+
*UpdateMMA.ps1*
167+
This script will go through VMs in your subscriptions, check for existing MMAs installed and then generate a .csv file of agents that need to be upgraded.
168+
169+
*UpgradeMMA.ps1*
170+
This script will use the .CSV file generated in UpdateMMA.ps1 to upgrade all breaking MMAs.
171+
172+
Both of these scripts may take a while to complete.
173+
174+
# [UpdateMMA](#tab/UpdateMMA)
175+
176+
```powershell
177+
# UpdateMMA.ps1
178+
# This script is to be run per subscription, the customer has to set the az subscription before running this within the terminal scope.
179+
# This script uses parallel processing, modify the $parallelThrottleLimit parameter to either increase or decrease the number of parallel processes
180+
# PS> .\UpdateMMA.ps1 GetInventory
181+
# The above command will generate a csv file with the details of VM's and VMSS that require MMA upgrade.
182+
# The customer can modify the the csv by adding/removing rows if needed
183+
# Update the MMA by running the script again and passing the csv file as parameter as shown below:
184+
# PS> .\UpdateMMA.ps1 Upgrade
185+
# If you don't want to check the inventory, then run the script wiht an additional -no-inventory-check
186+
# PS> .\UpdateMMA.ps1 GetInventory & .\UpdateMMA.ps1 Upgrade
187+
188+
189+
# This version of the script requires Powershell version >= 7 in order to improve performance via ForEach-Object -Parallel
190+
# https://docs.microsoft.com/powershell/scripting/whats-new/migrating-from-windows-powershell-51-to-powershell-7?view=powershell-7.1
191+
if ($PSVersionTable.PSVersion.Major -lt 7)
192+
{
193+
Write-Host "This script requires Powershell version 7 or newer to run. Please see https://docs.microsoft.com/powershell/scripting/whats-new/migrating-from-windows-powershell-51-to-powershell-7?view=powershell-7.1."
194+
exit 1
195+
}
196+
197+
$parallelThrottleLimit = 16
198+
$mmaFixVersion = [version]"10.20.18053.0"
199+
200+
function GetVmsWithMMAInstalled
201+
{
202+
param(
203+
$fileName
204+
)
205+
206+
$vmList = az vm list --show-details --query "[?powerState=='VM running'].{ResourceGroup:resourceGroup, VmName:name}" | ConvertFrom-Json
207+
208+
if(!$vmList)
209+
{
210+
Write-Host "Cannot get the VM list, this script can only detect the running VM's"
211+
return
212+
}
213+
214+
$vmsCount = $vmList.Length
215+
216+
$vmParallelThrottleLimit = $parallelThrottleLimit
217+
if ($vmsCount -lt $vmParallelThrottleLimit)
218+
{
219+
$vmParallelThrottleLimit = $vmsCount
220+
}
221+
222+
if($vmsCount -eq 1)
223+
{
224+
$vmGroups += ,($vmList[0])
225+
}
226+
else
227+
{
228+
# split the vm's into batches to do parallel processing
229+
for ($i = 0; $i -lt $vmsCount; $i += $vmParallelThrottleLimit)
230+
{
231+
$vmGroups += , ($vmList[$i..($i + $vmParallelThrottleLimit - 1)])
232+
}
233+
}
234+
235+
Write-Host "Detected $vmsCount Vm's running in this subscription."
236+
$hash = [hashtable]::Synchronized(@{})
237+
$hash.One = 1
238+
239+
$vmGroups | Foreach-Object -ThrottleLimit $parallelThrottleLimit -Parallel {
240+
$len = $using:vmsCount
241+
$hash = $using:hash
242+
$_ | ForEach-Object {
243+
$percent = 100 * $hash.One++ / $len
244+
Write-Progress -Activity "Getting VM Inventory" -PercentComplete $percent
245+
$vmName = $_.VmName
246+
$resourceGroup = $_.ResourceGroup
247+
$responseJson = az vm run-command invoke --command-id RunPowerShellScript --name $vmName -g $resourceGroup --scripts '@UpgradeMMA.ps1' --parameters "functionName=GetMMAVersion" --output json | ConvertFrom-Json
248+
if($responseJson)
249+
{
250+
$mmaVersion = $responseJson.Value[0].message
251+
if ($mmaVersion)
252+
{
253+
$extensionName = az vm extension list -g $resourceGroup --vm-name $vmName --query "[?name == 'MicrosoftMonitoringAgent'].name" | ConvertFrom-Json
254+
if ($extensionName)
255+
{
256+
$installType = "Extension"
257+
}
258+
else
259+
{
260+
$installType = "Installer"
261+
}
262+
$csvObj = New-Object -TypeName PSObject -Property @{
263+
'Name' = $vmName
264+
'Resource_Group' = $resourceGroup
265+
'Resource_Type' = "VM"
266+
'Install_Type' = $installType
267+
'Version' = $mmaVersion
268+
"Instance_Id" = ""
269+
}
270+
$csvObj | Export-Csv $using:fileName -Append -Force
271+
}
272+
}
273+
}
274+
}
275+
}
276+
277+
function GetVmssWithMMAInstalled
278+
{
279+
param(
280+
$fileName
281+
)
282+
283+
# get the vmss list which are successfully provisioned
284+
$vmssList = az vmss list --query "[?provisioningState=='Succeeded'].{ResourceGroup:resourceGroup, VmssName:name}" | ConvertFrom-Json
285+
286+
$vmssCount = $vmssList.Length
287+
Write-Host "Detected $vmssCount Vmss running in this subscription."
288+
$hash = [hashtable]::Synchronized(@{})
289+
$hash.One = 1
290+
291+
$vmssList | Foreach-Object -ThrottleLimit $parallelThrottleLimit -Parallel {
292+
$len = $using:vmsCount
293+
$hash = $using:hash
294+
$percent = 100 * $hash.One++ / $len
295+
Write-Progress -Activity "Getting VMSS Inventory" -PercentComplete $percent
296+
$vmssName = $_.VmssName
297+
$resourceGroup = $_.ResourceGroup
298+
299+
# get running vmss instance ids
300+
$vmssInstanceIds = az vmss list-instances --resource-group $resourceGroup --name $vmssName --expand instanceView --query "[?instanceView.statuses[1].displayStatus=='VM running'].instanceId" | ConvertFrom-Json
301+
if ($vmssInstanceIds.Length -gt 0)
302+
{
303+
$isMMAExtensionInstalled = az vmss extension list -g $resourceGroup --vmss-name $vmssName --query "[?name == 'MicrosoftMonitoringAgent'].name" | ConvertFrom-Json
304+
if ($isMMAExtensionInstalled )
305+
{
306+
# check an instance in vmss, if it needs an MMA upgrade. Since the extension is installed at VMSS level, checking for bad version in 1 instance should be fine.
307+
$responseJson = az vmss run-command invoke --command-id RunPowerShellScript --name $vmssName -g $resourceGroup --instance-id $vmssInstanceIds[0] --scripts '@UpgradeMMA.ps1' --parameters "functionName=GetMMAVersion" --output json | ConvertFrom-Json
308+
$mmaVersion = $responseJson.Value[0].message
309+
if ($mmaVersion)
310+
{
311+
$csvObj = New-Object -TypeName PSObject -Property @{
312+
'Name' = $vmssName
313+
'Resource_Group' = $resourceGroup
314+
'Resource_Type' = "VMSS"
315+
'Install_Type' = "Extension"
316+
'Version' = $mmaVersion
317+
"Instance_Id" = ""
318+
}
319+
$csvObj | Export-Csv $using:fileName -Append -Force
320+
}
321+
}
322+
else
323+
{
324+
foreach ($instanceId in $vmssInstanceIds)
325+
{
326+
$responseJson = az vmss run-command invoke --command-id RunPowerShellScript --name $vmssName -g $resourceGroup --instance-id $instanceId --scripts '@UpgradeMMA.ps1' --parameters "functionName=GetMMAVersion" --output json | ConvertFrom-Json
327+
$mmaVersion = $responseJson.Value[0].message
328+
if ($mmaVersion)
329+
{
330+
$csvObj = New-Object -TypeName PSObject -Property @{
331+
'Name' = $vmssName
332+
'Resource_Group' = $resourceGroup
333+
'Resource_Type' = "VMSS"
334+
'Install_Type' = "Installer"
335+
'Version' = $mmaVersion
336+
"Instance_Id" = $instanceId
337+
}
338+
$csvObj | Export-Csv $using:fileName -Append -Force
339+
}
340+
}
341+
}
342+
}
343+
}
344+
}
345+
346+
function Upgrade
347+
{
348+
param(
349+
$fileName = "MMAInventory.csv"
350+
)
351+
Import-Csv $fileName | ForEach-Object -ThrottleLimit $parallelThrottleLimit -Parallel {
352+
$mmaVersion = [version]$_.Version
353+
if($mmaVersion -lt $using:mmaFixVersion)
354+
{
355+
if ($_.Install_Type -eq "Extension")
356+
{
357+
if ($_.Resource_Type -eq "VMSS")
358+
{
359+
# if the extension is installed with a custom name, provide the name using the flag: --extension-instance-name <extension name>
360+
az vmss extension set --name MicrosoftMonitoringAgent --publisher Microsoft.EnterpriseCloud.Monitoring --force-update --vmss-name $_.Name --resource-group $_.Resource_Group --no-wait --output none
361+
}
362+
else
363+
{
364+
# if the extension is installed with a custom name, provide the name using the flag: --extension-instance-name <extension name>
365+
az vm extension set --name MicrosoftMonitoringAgent --publisher Microsoft.EnterpriseCloud.Monitoring --force-update --vm-name $_.Name --resource-group $_.Resource_Group --no-wait --output none
366+
}
367+
}
368+
else {
369+
if ($_.Resource_Type -eq "VMSS")
370+
{
371+
az vmss run-command invoke --command-id RunPowerShellScript --name $_.Name -g $_.Resource_Group --instance-id $_.Instance_Id --scripts '@UpgradeMMA.ps1' --parameters "functionName=UpgradeMMA" --output none
372+
}
373+
else
374+
{
375+
az vm run-command invoke --command-id RunPowerShellScript --name $_.Name -g $_.Resource_Group --scripts '@UpgradeMMA.ps1' --parameters "functionName=UpgradeMMA" --output none
376+
}
377+
}
378+
}
379+
}
380+
}
381+
382+
function GetInventory
383+
{
384+
param(
385+
$fileName = "MMAInventory.csv"
386+
)
387+
388+
# create a new file
389+
New-Item -Name $fileName -ItemType File -Force
390+
GetVmsWithMMAInstalled $fileName
391+
GetVmssWithMMAInstalled $fileName
392+
}
393+
394+
switch ($args.Count)
395+
{
396+
0 {
397+
Write-Host "The arguments provided are incorrect."
398+
Write-Host "To get the Inventory: Run the script as: PS> .\UpdateMMA.ps1 GetInventory"
399+
Write-Host "To update MMA from Inventory: Run the script as: PS> .\UpdateMMA.ps1 Upgrade"
400+
Write-Host "To do the both steps together: PS> .\UpdateMMA.ps1 GetInventory & .\UpdateMMA.ps1 Upgrade"
401+
}
402+
1 {
403+
$funcname = $args[0]
404+
Invoke-Expression "& $funcname"
405+
}
406+
2 {
407+
$funcname = $args[0]
408+
$funcargs = $args[1]
409+
Invoke-Expression "& $funcname $funcargs"
410+
}
411+
}
412+
```
413+
414+
# [UpgradeMMA](#tab/UpgradeMMA)
415+
416+
```powershell
417+
#UpgradeMMA.ps1
418+
419+
param(
420+
$functionName
421+
)
422+
423+
$mmaLatestVersion32bitDownloadUrl = "https://go.microsoft.com/fwlink/?LinkId=828604"
424+
$mmaLatestVersion64bitDownloadUrl = "https://go.microsoft.com/fwlink/?LinkId=828603"
425+
$mmaName = 'Microsoft Monitoring Agent'
426+
$mmaFixVersion = [version]"10.20.18053.0"
427+
$regPath = 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*'
428+
429+
function GetMMAVersion
430+
{
431+
$mmaVersion = (Get-ItemProperty $regPath | Where-Object { $_.DisplayName -eq $mmaName }).DisplayVersion
432+
return $mmaVersion
433+
}
434+
435+
function MMAUpgradeRequirementCheck
436+
{
437+
$mmaVersion = [version](GetMMAVersion)
438+
if ($mmaVersion -and ($mmaVersion -lt $mmaFixVersion))
439+
{
440+
return $TRUE
441+
}
442+
return $FALSE
443+
}
444+
445+
function GetMMAUpgradeUrl
446+
{
447+
$osArchitecture = (Get-WmiObject Win32_OperatingSystem).OSArchitecture
448+
if ($osArchitecture -eq "64-bit")
449+
{
450+
$newMMADownloadUrl = $mmaLatestVersion64bitDownloadUrl
451+
}
452+
else
453+
{
454+
$newMMADownloadUrl = $mmaLatestVersion32bitDownloadUrl
455+
}
456+
457+
return $newMMADownloadUrl
458+
}
459+
460+
function UpgradeMMA
461+
{
462+
$mmaUpgradeRequired = MMAUpgradeRequirementCheck
463+
if ($mmaUpgradeRequired)
464+
{
465+
$mmaDownloadUrl = GetMMAUpgradeUrl
466+
if ($mmaDownloadUrl)
467+
{
468+
$downloadedFile = "MMASetup.exe"
469+
# Download mma exe files
470+
Invoke-WebRequest "$mmaDownloadUrl" -OutFile $downloadedFile
471+
if(Test-Path $PSScriptRoot\MMA)
472+
{
473+
Remove-Item $PSScriptRoot\MMA -Recurse -Force
474+
}
475+
# Extract MMA exe file
476+
Start-Process -Wait -NoNewWindow -FilePath "$PSScriptRoot\$downloadedFile" -ArgumentList "/c /t:$PSScriptRoot\MMA"
477+
# Run Setup.exe
478+
Start-Process -Wait -NoNewWindow -FilePath "MMA\Setup.exe" -ArgumentList "/qn /l*v AgentUpgrade.log AcceptEndUserLicenseAgreement=1"
479+
}
480+
}
481+
}
482+
483+
if ($functionName -eq "GetMMAVersion")
484+
{
485+
GetMMAVersion
486+
}
487+
elseif ($functionName -eq "UpgradeMMA" )
488+
{
489+
UpgradeMMA
490+
}
491+
else
492+
{
493+
return "Wrong parameters"
494+
}
495+
```

0 commit comments

Comments
 (0)