This article records my personal experiences while migrating to Azure Monitor Agent from Log Analytics agent. Microsoft says
The Log Analytics agent will be retired on August 31, 2024. After this date, Microsoft will no longer provide any support for the Log Analytics agent. If you’re currently using the Log Analytics agent with Azure Monitor or other supported features and services, start planning your migration to Azure Monitor Agent by using the information in this article.
Migrate from legacy agents to Azure Monitor Agent – Azure Monitor | Microsoft Learn
Checking the Prerequisites
Running the AMA Migration Helper – Microsoft Azure for BidOne DEV/Test. There were no issues found. For example
There are no Data Collection Rules for any of the workspaces too.
In summary the Azure Monitor Agent can address all of your needs. See Migrate from legacy agents to Azure Monitor Agent – Azure Monitor
Implementation of Azure Monitor Agent
Using the Tools for migrating to Azure Monitor Agent from legacy agents – Azure Monitor | Microsoft Learn to install and run the ACR generator for an existing Log Analytics workspace, I see this error.
The term 'az' is not recognized as the name of a cmdlet, function, script file, or operable program.
Thus I had to install Azure CLI and restart my powershell session.
Running the Powershell again it now hangs and does not complete. I add some print lines to find where it was stalling.
PS C:\EDI_AUTOMATION\edi-automation\EDI.Automation\EDI.Automation> .\WorkspaceConfigToDCRMigrationTool.ps1 -SubscriptionId "hidden" -ResourceGroupName "au-edi-dev-rg" -WorkspaceName "au-edi-dev-oms" -DCRName "au-edi-dev-oms-dcr" -Location "australiasoutheast" -FolderPath "C:\EDI_AUTOMATION\edi-automation\EDI.Automation\EDI.Automation\DCR Migration Scripts"
You entered:
Subscription Id 13e1109a-1e53-4193-bc46-64d09a542269
ResourceGroupName au-edi-dev-rg
Workspace Name au-edi-dev-oms
You are already logged into Azure
If DCE does not exist, it will create a new one. If it does exists, it will return the existing one
The code fragment that swallows my command and does not return is below
# If DCE does not exist, it will create a new one. If it does exists, it will return the existing one
Write-Host "If DCE does not exist, it will create a new one. If it does exists, it will return the existing one"
$dce = az monitor data-collection endpoint create --name $dceName --public-network-access "Enabled" --resource-group $ResourceGroupName
Write-Host "$dce.Count"
Listing the data collection endpoints, in an attempt to troubleshoot I see this
PS C:\Users\Mark.Brimble> az monitor data-collection endpoint list --resource-group "au-edi-dev-rg"
The command requires the extension monitor-control-service. Do you want to install it now? The command will continue to run after the extension is installed. (Y/n): Y
Running the above script again I get a different error.
You entered:
Subscription Id not shown
ResourceGroupName au-edi-dev-rg
Workspace Name au-edi-dev-oms
You are already logged into Azure
If DCE does not exist, it will create a new one. If it does exists, it will return the existing one
ERROR: (ResourceGroupNotFound) Resource group 'au-edi-dev-rg' could not be found.
Code: ResourceGroupNotFound
Message: Resource group 'au-edi-dev-rg' could not be found.
.Count
Error: Unable to get or create a Data Collection Endpoint.
If DCE does not exist, it will create a new one. If it does exists, it will return the existing one
ERROR: (ResourceGroupNotFound) Resource group 'au-edi-dev-rg' could not be found.
Code: ResourceGroupNotFound
Message: Resource group 'au-edi-dev-rg' could not be found.
.Count
Error: Unable to get or create a Data Collection Endpoint.
Find-IfVmiEnabled: C:\EDI_AUTOMATION\edi-automation\EDI.Automation\EDI.Automation\WorkspaceConfigToDCRMigrationTool.ps1:136
Line |
136 | if (Find-IfVmiEnabled -ResourceGroupName $ResourceGroupName -Work …
| ~~~~~~~~~~~~~~~~~
| The term 'Find-IfVmiEnabled' is not recognized as a name of a cmdlet, function, script file, or executable
| program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
| again.
Success!
Check your output folder! (Relative path: C:\EDI_AUTOMATION\edi-automation\EDI.Automation\EDI.Automation\DCR Migration Scripts)
The problem
I am now stuck. The issue is that Azure CLI can’t find the resource group even though it exists.
$dce = az monitor data-collection endpoint create --name $dceName --public-network-access "Enabled" --resource-group $ResourceGroupName
I think this is defect and will log a ticket with Microsoft.
The solution
I feel silly about this. I was using a powershell subscription context and assumed that would also be used by Azure CLI in the same session. That is not the case. On changing the Azure CLI subscription contect the issue disappears.