Aisu  Joesph

Aisu Joesph

1623117481

Hook your Azure VM into Log Analytics with the MMA agent VM extension… using Terraform!

To connect your Windows VMs into a log analytics workspace in Azure, the Microsoft monitoring agent (MMA) needs to be installed and configured to point to the workspace.

This can be automated when provisioning a VM using Terraform.

Assuming the resource group and VM config is already done, we create a log analytics workspace using the azurerm_log_analytics_workspace resource block:

resource "azurerm_log_analytics_workspace" "law" {

  name                = lawname
  location            = westeurope
  resource_group_name = azurerm_resource_group.rg.name
  sku                 = "PerGB2018"
  retention_in_days   = 30
  tags = local.tags
}

The ‘azurerm_virtual_machine_extension’ resource block can then be configured as follows and linked to your virtual machine:

resource "azurerm_virtual_machine_extension" "mmaagent" {

  name                 = "mmaagent"
  virtual_machine_id   = azurerm_virtual_machine.windows_vm.id
  publisher            = "Microsoft.EnterpriseCloud.Monitoring"
  type                 = "MicrosoftMonitoringAgent"
  type_handler_version = "1.0"
  auto_upgrade_minor_version = "true"
  settings = <<SETTINGS
    {
      "workspaceId": "${var.workspaceId}"
    }
SETTINGS
   protected_settings = <<PROTECTED_SETTINGS
   {
      "workspaceKey": "${var.workspaceKey}"
   }
PROTECTED_SETTINGS
}

Note the workspaceId and workspaceKey are passed in as variables, so they will need to be defined as follows:

workspaceId = azurerm_log_analytics_workspace.law.workspace_id

workspaceKey = azurerm_log_analytics_workspace.law.primary_shared_key

Be sure to pass in the workspaceId, not the id of the resource as shown above.

Once deployed, in Azure, navigate to your new log analytics workspace and click on ‘agents management’, the number of connected VMs is shown here.

#terraform #azure-devops #devops #azure

What is GEEK

Buddha Community

Hook your Azure VM into Log Analytics with the MMA agent VM extension… using Terraform!
Aisu  Joesph

Aisu Joesph

1623117481

Hook your Azure VM into Log Analytics with the MMA agent VM extension… using Terraform!

To connect your Windows VMs into a log analytics workspace in Azure, the Microsoft monitoring agent (MMA) needs to be installed and configured to point to the workspace.

This can be automated when provisioning a VM using Terraform.

Assuming the resource group and VM config is already done, we create a log analytics workspace using the azurerm_log_analytics_workspace resource block:

resource "azurerm_log_analytics_workspace" "law" {

  name                = lawname
  location            = westeurope
  resource_group_name = azurerm_resource_group.rg.name
  sku                 = "PerGB2018"
  retention_in_days   = 30
  tags = local.tags
}

The ‘azurerm_virtual_machine_extension’ resource block can then be configured as follows and linked to your virtual machine:

resource "azurerm_virtual_machine_extension" "mmaagent" {

  name                 = "mmaagent"
  virtual_machine_id   = azurerm_virtual_machine.windows_vm.id
  publisher            = "Microsoft.EnterpriseCloud.Monitoring"
  type                 = "MicrosoftMonitoringAgent"
  type_handler_version = "1.0"
  auto_upgrade_minor_version = "true"
  settings = <<SETTINGS
    {
      "workspaceId": "${var.workspaceId}"
    }
SETTINGS
   protected_settings = <<PROTECTED_SETTINGS
   {
      "workspaceKey": "${var.workspaceKey}"
   }
PROTECTED_SETTINGS
}

Note the workspaceId and workspaceKey are passed in as variables, so they will need to be defined as follows:

workspaceId = azurerm_log_analytics_workspace.law.workspace_id

workspaceKey = azurerm_log_analytics_workspace.law.primary_shared_key

Be sure to pass in the workspaceId, not the id of the resource as shown above.

Once deployed, in Azure, navigate to your new log analytics workspace and click on ‘agents management’, the number of connected VMs is shown here.

#terraform #azure-devops #devops #azure

Using Azure Log Analytics Workspaces to collect Custom Logs from your VM

Motivation:

We all have seen the Monitoring Tab Key Metrics on the VM Page. Yes, it is useful to see whether the CPU has been running or not through the **CPU **metrics, to check when the VM is getting the data from the outside world through Network In metrics and if the VM is doing any kind of write operation using **Disk Operations/Sec **metrics but it’s not effective for the custom services that we build on VM. So, in this blog, I will be giving you an example of how to create your own log based on customer service, bring it to Azure Log Analytics Workspace using its default agent, and query it according to our needs, even better create an alert on it.

Prerequisites:

  1. An Azure Account
  2. Azure Virtual Machine Service
  3. Azure Log Analytics Workspace Service
  4. Azure Alert Service

Azure Virtual Machine:

Let’s start with the VM itself. You already have the service running on the VM but don’t know how to get those logs into the portal or even create a log for your services. So, let’s assume that you have not created the logs for your services. So for this blog, I will be taking a simple flask app as my example for the service. To get it up and running we must download the flask library from pip and then create a flask app similar to this below:

#logs #log-analytics #azure #azure log analytics

Ruthie  Bugala

Ruthie Bugala

1620431700

Analyze Azure Cosmos DB data using Azure Synapse Analytics

This article will help you understand how to analyze Azure Cosmos DB data using Azure Synapse Analytics.

Introduction

Azure Cosmos DB is a multi-model NoSQL database that supports hosting various types of data that are transactional in nature. OLTP systems employ transactional databases for hosting operational data. To analyze large volumes of transactional data, relational databases do not scale or perform to the needs of large-scale analytics. Columnar data warehouses are one of the preferred, effective, and proven means of analyzing and aggregating large volumes of data for big data scale analytics. Azure Synapse is the data warehouse offering in the Microsoft Azure technology stack. The challenge with analyzing transactional data in relational databases using columnar warehouses is that one needs to replicate and/or relocate data from operational repositories into analytical repositories. Hybrid transactional analytical processing (HTAP) is a methodology or approach where data hosted in a relational format is auto-organized in a columnar format eliminating the need to replicate and/or relocate the data to a great extent. Azure offers a feature to analyze data hosted in Cosmos DB using Azure Synapse. In this article, we will learn how to implement the same.

Pre-requisites

We are assuming that we are hosting data in the Cosmos DB instance. To simulate this assumption, we would need an Azure Cosmos DB account implemented using the Core (SQL) API, with all the preview features turned on. Once you have an account created, you would be able to see an account listed as shown below.

#azure #sql azure #azure synapse analytics #azure

Ruthie  Bugala

Ruthie Bugala

1619601744

Azure Synapse Analytics Database CI/CD using Azure Function

In this article, I will discuss an Azure Database CI/CD approach using Azure Premium Function and Jenkins pipeline. I will only explain the architecture and the approach I took to implement the Database CI/CD pipeline.

Problem Statement and Challenges

I was working on a project where I had to build a Database deployment pipeline using enterprise GitHub which is only accessible through the company’s internal network. Also, port 1433 was blocked from the internal network to the Azure Synapse public endpoint for security reasons. Hence the only option I had was to run my pipeline in an internal network so that I could access GitHub which I was using for my Database Deployment Source Control and send the SQL code to Azure Synapse using Azure function HTTP post as port 1433 was blocked.

#azure #devops #azure-synapse-analytics #azure-devops #azure-functions