Posts

Showing posts from April, 2022

Azure - Customize Azure Log Search alerts using Automation Runbook

Image
 Introduction As you might know the Log Search Alert – V2 alert has been released and it’s rolled out globally. The v1 alerts were quite easy understand interms of what went wrong, but the v2 alerts have more information which can be ignored for the people who's working as NOC.  By default this cannot be customized as it's not that matured enough to do that, so i have created this runbook which does the customization for v1 & v2 alerts.  Benefits of this custom alert is, Both V1 & V2 alert is covered as part of this custom alert. All the existing alerts can also be routed through this custom script. All types of alerts like CPU, Disk, Memory & Event are supported by this custom alert. Additionally, Start & EndTime of the event, Search query, Fired data time & etc.. parameters are enabled for this custom alert. Finally, the Subject, Body of the email & affected details has been changed.   Following component...

Azure - Enable Diagnostic Settings for the Azure VM using Azure Policy

 Introduction This article is about enabling Diagnostic Settings for the Azure VM using Azure Policy. As there is no default policy available i thought this policy would be useful for enabling the Diagnostic Settings for the Azure VMs.  Following ARM Template can be used in Azure Policy to enable the Diagnostic Settings for the Azure VM and store the logs into Azure Storage Account.  This policy is completely parameterized to give       Storage Account Name,       Storage Account Resource Group & Storage Account ID  Policy can be applied at Subscription or the resource group level. As the DeployIfNotExists effect is used, it's helpful for remediating the existing non compliance resources.  #Code Stars here {     "properties": {         "displayName": "Deploy Diagnostic Settings for Azure VM to Storage Account",         "policyType": "Custom",        ...

Azure - Inherit Tags from Resource Group using Azure Policy

Introduction Again one more article for the Azure policy, We usually create tags while we deploy the resources, but got a requirment to inherit the policies from RG because the resources in the RG's are migrated. So we've decided to go for Azure Policy which does the work for us effectively compare than any other method. I started working with the Tags inheritance from the RG and used the default one to customize it, but it didn't work as expected. Then modified the arm template which will inherit all the tags from RG if it's missing. Following ARM template can be used in Azure Policy to inherit the tags from RG . I have defined 6 tags paramter for this inheritance and this can be increased or decreased as per the requirement. Also, this policy has the modify added so that it can remediate existing RG's if needed. #Code start from here {   "mode": "Indexed",   "policyRule": {     "if": {         "anyOf": [           ...