Azure VM Insights Dependency Data (Map) collected by Azure Monitor Agent (AMA) is not shown in the Portal

Bastian Wenske 66 Reputation points
2022-11-21T19:18:32.013+00:00

Hi, community,

I want to monitor a single Azure VM by using the new Azure Monitor Agent for migration sake testing. Another requirement is that service map and VM Insights are enabled.

I used the following terraform code to deploy the monitoring solution. The VM was also deployed via terraform and is up and running.

resource "azurerm_log_analytics_workspace" "this" {  
  name                = "law-this-005"  
  location            = azurerm_resource_group.this.location  
  resource_group_name = azurerm_resource_group.this.name  
  sku                 = "PerGB2018"  
  retention_in_days   = "31"  
}  
  
resource "azurerm_virtual_machine_extension" "dependency_agent" {  
  name                       = "DependencyAgentWindows"  
  virtual_machine_id         = azurerm_windows_virtual_machine.this.id  
  publisher                  = "Microsoft.Azure.Monitoring.DependencyAgent"  
  type                       = "DependencyAgentWindows"  
  type_handler_version       = "9.10"  
  automatic_upgrade_enabled  = true  
  auto_upgrade_minor_version = true  
}  
  
resource "azurerm_virtual_machine_extension" "azure_monitor_agent" {  
  depends_on = [azurerm_virtual_machine_extension.dependency_agent]  
  
  name                       = "AzureMonitorWindowsAgent"  
  virtual_machine_id         = azurerm_windows_virtual_machine.this.id  
  publisher                  = "Microsoft.Azure.Monitor"  
  type                       = "AzureMonitorWindowsAgent"  
  type_handler_version       = "1.9"  
  automatic_upgrade_enabled  = true  
  auto_upgrade_minor_version = true  
}  
  
resource "azapi_resource" "data_collection_rule" {  
  depends_on = [azurerm_virtual_machine_extension.azure_monitor_agent]  
  type      = "Microsoft.Insights/dataCollectionRules@2021-09-01-preview"  
  name      = "MSVMI-vminsights"  
  location  = azurerm_resource_group.this.location  
  parent_id = azurerm_resource_group.this.id  
  body = jsonencode({  
    properties = {  
      dataFlows = [  
        {  
          streams = [  
            "Microsoft-InsightsMetrics"  
          ],  
          destinations = [  
            "VMInsightsPerf-Logs-Dest"  
          ]  
        },  
        {  
          streams = [  
            "Microsoft-ServiceMap"  
          ],  
          destinations = [  
            "VMInsightsPerf-Logs-Dest"  
          ]  
        }  
      ]  
      dataSources = {  
        performanceCounters = [  
          {  
            streams = [  
              "Microsoft-InsightsMetrics"  
            ]  
            samplingFrequencyInSeconds = 60  
            counterSpecifiers = [  
              "\\VmInsights\\DetailedMetrics"  
            ]  
            name = "VMInsightsPerfCounters"  
          }  
        ]  
        extensions = [  
          {  
            streams = [  
              "Microsoft-ServiceMap"  
            ]  
            extensionName     = "DependencyAgent"  
            extensionSettings = {}  
            name              = "DependencyAgentDataSource"  
          }  
        ]  
      }  
      description = "Data collection rule for VM Insights."  
      destinations = {  
        logAnalytics = [  
          {  
            name                = "VMInsightsPerf-Logs-Dest"  
            workspaceResourceId = azurerm_log_analytics_workspace.this.id  
          }  
        ]  
      }  
    }  
    kind = "Windows"  
  })  
}  
  
resource "azurerm_monitor_data_collection_rule_association" "msvmi" {  
  name                    = "VMInsights-Association"  
  target_resource_id      = azurerm_windows_virtual_machine.this.id  
  data_collection_rule_id = azapi_resource.data_collection_rule.id  
}  

As I can see in the Portal, the required extensions (Azure Monitor Agent + Dependency Agent) are installed successfully:

262774-image.png

The performance metrics in the Azure Monitor - VM Insights section are present:
262709-image.png

When I check the Map section, I get the following error message:
262764-image.png

==> I expect I can see the Dependency data at this point.

The Data Collection Rule is correctly associated with the VM:
262755-image.png

Furthermore, Azure Monitor Agent Heartbeats are logged inside the Log Analytics Workspace.

Is there anything I am not aware of?

I understood the documentation as follows:

  1. Create the VM
  2. Create Log Analytics Workspace
  3. Install Dependency Agent
  4. Install Azure Monitor Agent
  5. Create a Data Collection Rule ==> See Terraform code
  6. Create a Data Collection Rule Association ==> See Terraform code
  7. Data for Performance and Dependency Metrics will be collected and shown in the Portal

I also got from the documentation that I do not need to configure the Agent itself regarding auth due it will use the System-assigned Managed Identity of the VM (User-assigned Identity is not used). Furthermore, Log Analytics Solutions for VM Insights is unnecessary, so I didn't deploy any.

Appreciate any help!

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,320 questions
{count} votes

Accepted answer
  1. Darren Johnson 85 Reputation points
    2023-02-14T08:48:53.2066667+00:00

    Hi,

    I just stumbled upon this post, and have a solution so thought I would share. This is fixed by adding the code block below to resource "azurerm_virtual_machine_extension" "dependency_agent":

      settings = jsonencode({
        enableAMA = true
      })
    
    2 people found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.