Home
%3CLINGO-SUB%20id%3D%22lingo-sub-733672%22%20slang%3D%22en-US%22%3EIdentify%20Azure%20VMs%20which%20are%20not%20monitored%20by%20Security%20Center%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-733672%22%20slang%3D%22en-US%22%3E%3CH2%20id%3D%22toc-hId-1790592826%22%20id%3D%22toc-hId-1790621661%22%3E%3CSPAN%3EAnd%20use%20an%20input%20file%20to%20onboard%20them%20to%20Security%20Center%20automatically%3C%2FSPAN%3E%3C%2FH2%3E%0A%3CP%3E%3CEM%3E%3CSPAN%3EThe%20link%20for%20the%20scripts%20used%20in%20this%20blog%20can%20be%20found%20at%20the%20end%20of%20the%20blog.%3C%2FSPAN%3E%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%224%22%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoeui%26amp%3Bquot%3B%2C%26amp%3Bquot%3Blato%26amp%3Bquot%3B%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Carial%2Csans-serif%3B%20font-size%3A%2018.06px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20300%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%3E%3CSTRONG%20style%3D%22box-sizing%3A%20border-box%3B%20font-weight%3A%20bold%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20%26amp%3Bquot%3B%22%3ELooking%20to%20increase%20your%20Secure%20Score%3F%20Look%20%3CA%20style%3D%22background-color%3A%20transparent%3B%20box-sizing%3A%20border-box%3B%20color%3A%20%23146cac%3B%20text-decoration%3A%20underline%3B%22%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2FAzure-Security-Center%2Ftree%2Fmaster%2FSecure%2520Score%2FInstall%2520monitoring%2520agent%2520on%2520your%2520machines%2FPowerShell%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%3C%2FSPAN%3E%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3ESecurity%20Center%20offers%20a%20couple%20of%20options%20to%20have%20your%20Virtual%20Machines%20(VMs)%20in%20Azure%20automatically%20protected.%20This%20provides%20great%20benefits%20by%20protecting%20your%20resources%20against%20threats%20and%20helps%20you%20get%20more%20secure%20in%20a%20fast%20and%20efficient%20way.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3ETo%20safeguard%20your%20VMs%2C%20Security%20Center%20requires%20the%20installation%20of%20the%20Microsoft%20Monitoring%20Agent%20(MMA).%20The%20easiest%20way%20to%20have%20that%20automatically%20done%20for%20you%2C%20is%20to%20enable%20%3CSTRONG%3EAuto%20Provisioning%3C%2FSTRONG%3E%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20925px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F121856i29E88DD1234990B5%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22autoprovision.png%22%20title%3D%22autoprovision.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EThis%20installs%20the%20(MMA)%20automatically%20to%20all%20your%20VMs%20in%20your%20subscription.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EAnother%20great%20option%20is%20to%20assign%20a%20built-in%20Azure%20Policy%2C%20which%20will%20also%20install%20the%20MMA%20upon%20creation%20of%20a%20VM%20and%20can%20also%20take%20care%20of%20remediations%2C%20in%20case%20someone%20has%20removed%20the%20MMA%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20755px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F121857i8A967066622E8BC1%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22policyDefinition.png%22%20title%3D%22policyDefinition.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EVMs%20which%20don%E2%80%99t%20have%20the%20MMA%20installed%2C%20are%20flagged%20by%20Azure%20Policy%20as%20%3CSTRONG%3Enon-compliant%3C%2FSTRONG%3E.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--761564135%22%20id%3D%22toc-hId--761535300%22%3E%3CSPAN%3EAre%20you%20not%20using%20the%20automatic%20MMA%20installation%20options%3F%3C%2FSPAN%3E%3C%2FH2%3E%0A%3CP%3E%3CSPAN%3EThere%20might%20be%20exceptions%20for%20which%20you%20don%E2%80%99t%20want%20the%20MMA%20automatically%20installed%20in%20your%20subscription.%20Although%20you%20can%20define%20a%20scope%20and%20exceptions%20in%20Azure%20Policy%2C%20it%20is%20not%20meant%20to%20change%20frequently%2C%20since%20you%20must%20update%20the%20Azure%20Policy%20assignment%20to%20reflect%20the%20change.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EIf%20for%20whatever%20reason%20you%20have%20chosen%20not%20to%20use%20automatic%20installations%20of%20the%20MMA%2C%20then%20you%20obviously%20have%20a%20concern%20if%20your%20resources%20are%20properly%20protected%20(and%20you%20should!)%20The%20challenge%20is%20how%20to%20get%20insights%20into%20the%20VMs%20that%20are%20not%20protected.%20Security%20Center%20offers%20your%20recommendations%20and%20one%20of%20those%20is%20to%20install%20the%20MMA%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F121858iF815A7F2790ACDC3%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22mma_recommendation.png%22%20title%3D%22mma_recommendation.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EClicking%20on%20the%20recommendation%20reveals%20which%20VMs%20are%20not%20protected.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-981246200%22%20id%3D%22toc-hId-981275035%22%3E%3CSPAN%3EUsing%20PowerShell%20to%20retrieve%20a%20list%20of%20all%20unprotected%20VMs%3C%2FSPAN%3E%3C%2FH2%3E%0A%3CP%3E%3CSPAN%3EAnother%20option%20to%20get%20insights%20into%20which%20VMs%20are%20not%20protected%20by%20Security%20Center%2C%20is%20to%20use%20PowerShell.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EThis%20offers%20a%20great%20way%20to%20enable%20automation%20for%20not%20only%20creating%20such%20a%20list%2C%20but%20also%20to%20bulk%20install%20the%20MMA%20on%20VMs%20that%20you%20identify.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EFirst%2C%20let%E2%80%99s%20get%20a%20list%20of%20VMs%20which%20are%20not%20protected%20by%20Security%20Center%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F121859i343AAA5384E034CD%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22getVMs.png%22%20title%3D%22getVMs.png%22%20%2F%3E%3C%2FSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EThe%20script%20will%20create%20an%20output%20CSV%20file%2C%20which%20you%20can%20import%20in%20Excel%20and%20would%20give%20you%20filtering%20capabilities%20for%20every%20column.%20You%20can%20filter%20on%20subscriptions%2C%20resource%20groups%20and%20filter%20if%20the%20MMA%20extension%20has%20been%20installed%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F121860iEEC383AF5696DCB7%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22outputFile.png%22%20title%3D%22outputFile.png%22%20%2F%3E%3C%2FSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1570910761%22%20id%3D%22toc-hId--1570881926%22%3E%3CSPAN%3EAutomatically%20install%20the%20MMA%20VM%20Extension%20based%20on%20an%20input%20file%3C%2FSPAN%3E%3C%2FH2%3E%0A%3CP%3E%3CSPAN%3ENow%20that%20you%20have%20insights%20into%20which%20VMs%20are%20not%20protected%20by%20Security%20Center%2C%20you%20can%20create%20an%20input%20file%20which%20only%20contains%20the%20VMs%20that%20you%20want%20the%20MMA%20to%20be%20installed%20on.%20Keep%20the%20headers%20as%20they%20are%20and%20just%20copy%20your%20filtered%20view%20in%20a%20new%20CSV%20file%2C%20like%20this%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20776px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F121861iC740148A52E2643A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22inputFile.png%22%20title%3D%22inputFile.png%22%20%2F%3E%3C%2FSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3ENow%20run%20the%20second%20script%20which%20will%20take%20your%20input%20CSV%20file%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20892px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F121862i63C6E513F35458F5%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22installingMMA.png%22%20title%3D%22installingMMA.png%22%20%2F%3E%3C%2FSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EWith%20these%20two%20scripts%20you%20can%20pick%20and%20choose%20which%20VMs%20you%20would%20want%20to%20protect%20with%20Security%20Center%20in%20case%20you%20cannot%20use%20the%20automatic%20agent%20installation%20capabilities.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EThe%20sample%20scripts%20used%20in%20this%20blog%20can%20be%20found%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2FAzure-Security-Center%2Ftree%2Fmaster%2FSecure%2520Score%2FInstall%2520monitoring%2520agent%2520on%2520your%2520machines%2FPowerShell%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%224%22%3E%3CSTRONG%3E%3CSPAN%3ELooking%20to%20increase%20your%20Secure%20Score%3F%20Look%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2FAzure-Security-Center%2Ftree%2Fmaster%2FSecure%2520Score%2FInstall%2520monitoring%2520agent%2520on%2520your%2520machines%2FPowerShell%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%3C%2FSPAN%3E%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-733672%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ELog%20Analytics%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESecurity%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESecurity%20Center%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

And use an input file to onboard them to Security Center automatically

The link for the scripts used in this blog can be found at the end of the blog.

 

Looking to increase your Secure Score? Look here.

 

Security Center offers a couple of options to have your Virtual Machines (VMs) in Azure automatically protected. This provides great benefits by protecting your resources against threats and helps you get more secure in a fast and efficient way.

To safeguard your VMs, Security Center requires the installation of the Microsoft Monitoring Agent (MMA). The easiest way to have that automatically done for you, is to enable Auto Provisioning:

 

autoprovision.png

This installs the (MMA) automatically to all your VMs in your subscription.

 

Another great option is to assign a built-in Azure Policy, which will also install the MMA upon creation of a VM and can also take care of remediations, in case someone has removed the MMA:

 policyDefinition.png

VMs which don’t have the MMA installed, are flagged by Azure Policy as non-compliant.

 

Are you not using the automatic MMA installation options?

There might be exceptions for which you don’t want the MMA automatically installed in your subscription. Although you can define a scope and exceptions in Azure Policy, it is not meant to change frequently, since you must update the Azure Policy assignment to reflect the change.

If for whatever reason you have chosen not to use automatic installations of the MMA, then you obviously have a concern if your resources are properly protected (and you should!) The challenge is how to get insights into the VMs that are not protected. Security Center offers your recommendations and one of those is to install the MMA:

 

mma_recommendation.png

Clicking on the recommendation reveals which VMs are not protected.

 

Using PowerShell to retrieve a list of all unprotected VMs

Another option to get insights into which VMs are not protected by Security Center, is to use PowerShell.

This offers a great way to enable automation for not only creating such a list, but also to bulk install the MMA on VMs that you identify.

 

First, let’s get a list of VMs which are not protected by Security Center:

getVMs.png The script will create an output CSV file, which you can import in Excel and would give you filtering capabilities for every column. You can filter on subscriptions, resource groups and filter if the MMA extension has been installed:

outputFile.png 

Automatically install the MMA VM Extension based on an input file

Now that you have insights into which VMs are not protected by Security Center, you can create an input file which only contains the VMs that you want the MMA to be installed on. Keep the headers as they are and just copy your filtered view in a new CSV file, like this:

inputFile.png 

Now run the second script which will take your input CSV file:

installingMMA.png With these two scripts you can pick and choose which VMs you would want to protect with Security Center in case you cannot use the automatic agent installation capabilities.

 

The sample scripts used in this blog can be found here:

 

Looking to increase your Secure Score? Look here.