How to enable azure monitor in virtual machine using terraform? - azure

I am trying to enable azure monitor feature for my virtual machines which checks for health and performance of the VM using terraform but I am not able to find the right documentation for the same. Can you help me for the same because I want detailed monitoring for azure.
This is what I want to automate using terraform, enable health & performance using Azure Monitor for VM's
Here is the Azure Monitor for VM Screenshot
https://ibb.co/JmzfNZN

Enable Azure Monitor for VMs service is still in preview mode and is not available as a module in Terraform.
To raise a new feature request in Terraform for Azure, please use the below link:
https://github.com/terraform-providers/terraform-provider-azurerm/issues/new?template=enhancement.md

Related

how to configure the new alerts in azure monitor using ARM templates?

I am working on Azure Resource Manager Templates, Currently I created ARM templates for various azure resources like virtual machine, SQL Server, Service Bus and Web app etc...
But, for that I want to configure the azure alerts in monitor using ARM template not through the azure portal.
I followed below links to configure the new alerts experience in azure monitor:
The next generation of Azure Alerts has arrived
The new alerts experience in Azure Monitor
Create, view, and manage alerts using Azure Monitor
Can anyone suggest me how to configure the new alerts in azure monitor using ARM templates?
This article shows how you can use an Azure Resource Manager template to configure newer metric alerts in Azure Monitor. Resource Manager templates enable you to programmatically set up alerts in a consistent and reproducible way across your environments. Newer metric alerts are currently available on this set of resource types.

Deploy Azure Cloud Service using Azure Automation Powershell DSC

We are using Azure Automation DSC and were able to do simple things like create Automation account, create Resource group, VM creation and even able to deploy a web site on the target VM. All using powershell scripting.
How can we deploy Azure Cloud Services (web role / worker role)? what are the cmdlets? Any pointers? Please help.
What more things can be achieved using this? Moreover what limitations we can expect here.
Best Regards
Azure DSC is really focused on Azure's Infrastructure as a Service (IaaS) offering. Basically you can configure virtual servers (Windows and Linux) hosted on Azure.
To manage configurations for other services in Azure it is recommended to utilize Azure Resource Manager (ARM) which will allow you to define and configure Azure services in JSON.
Microsoft offers a lot of Quick Start ARM templates that can be accessed at the Azure Quickstart site.

How to add the diagnostics extension on cloud service using ARM template

I would like to know how we need to define the resource in ARM template for enabling the Diagnostics extension on Cloud service deployed. In the examples that i came across, i could see it only for Virtual Machines with IaasDiagnostics. But i couldnt find anything on enabling the diagnostics on cloud service(PaaSDiagnostics).
Thanks in Advance
ARM template is used to deploy and provision all of the resources for your application in a single, coordinated operation, which is only available in Azure Resource Manager while Cloud Service is in Azure Service Manager, so you could not use cloud service in ARM template.
You could look at Create a Windows Virtual machine with monitoring and diagnostics using Azure Resource Manager Template to enable diagnostics in ARM template.

Can I configure Azure diagnostics on IAAS virtual machine?

I would like to reuse libraries written for Azure PAAS solution (WebRoles and WorkerRoles) in a specific service running in Azure VM (IAAS). It would be beneficial if I could use the same trace listener (DiagnosticMonitorTraceListener) and let the Azure diagnostics to deliver logs to Azure Storage. Is it possible to install the diagnostics services into Azure VM?
I found basically the same question here on SO but it is quite old now. Perhaps there was some progress?
Yes, it's now possible to use the Azure Diagnostics extension with Azure IaaS virtual machines as well as PaaS cloud services, see the Virtual Machine Monitoring with Azure Diagnostics Extension documentation for more info.

Metrics related powershell commands in azure

We're trying to get the cpu percentage,disk read throughput,etc programmatically using powershell commands for metrics in azure but we are not able to get any of the commands according to new release.
First of all are you trying to get performance details from Web/Worker Role or New preview release of Windows Azure Virtual Machines?
With Windows Azure Virtual Machine:
You have full access to your Azure VM and configure it the way you would do in any remote VM and the get the performance data out of it. With Windows Azure Virtual Machine if you want to get Performance data from Powershell you would need to do the following:
Configure to Azure VM to have PowerShell Remote Access
Configure Azure VM port settings so you can connect from on-premise machine (this is must and you should know that open port will open connection to VM outside)
Configure Azure VM to collect performance data
Connect from your on-premise machine using PowerShell and collect performance data
You can find several resources on Internet to do above task.
With Web/Worker Role:
Even when you are using new Powershell cmdlets with Windows Azure, older commands are still accessible and working as expected. To get Performance metrics from Azure Here are some resources for your to try:
Windows Azure Diagnostics and PowerShell – Performance Counters:
Part 1 | Part 2
How To Easily Enable Windows Azure
Diagnostics Remotely

Resources