%3CLINGO-SUB%20id%3D%22lingo-sub-1360721%22%20slang%3D%22en-US%22%3EOnboarding%20and%20servicing%20non-persistent%20VDI%20machines%20with%20Microsoft%20Defender%20ATP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1360721%22%20slang%3D%22en-US%22%3E%3CP%3EVirtual%20Desktop%20Infrastructure%20(VDI)%20is%20fairly%20common%20in%20customer%20environments%2C%20especially%20in%20today%E2%80%99s%20world%20where%20many%20are%20working%20from%20home%20as%20a%20result%20of%20COVID-19.%20As%20such%2C%20we%20want%20to%20ensure%20that%20Microsoft%20provides%20protection%20for%20VDI%20machines%2C%20and%20that%20you%20understand%20how%20%26nbsp%3BMicrosoft%20Defender%20Advanced%20Threat%20Protection%20(Microsoft%20Defender%20ATP)%20works%20within%20your%20VDI%20deployment.%20In%20this%20blog%20post%2C%20we%E2%80%99ll%20cover%20VDI%2C%20how%20it%20works%20with%20Microsoft%20Defender%20ATP%2C%20best%20practices%2C%20and%20some%20lessons%20learned.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20we%20talk%20about%20VDI%2C%20we%20often%20talk%20about%20two%20different%20deployment%20types%3A%26nbsp%3B%20persistent%20and%20non-persistent.%20Let%E2%80%99s%20look%20at%20both%20of%20these%20types%20and%20explore%20how%20they%20interact%20with%20Microsoft%20Defender%20ATP%20onboarding.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CU%3EPersistent%20VDI%3C%2FU%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPersistent%20VDI%20is%20a%20deployment%20type%20where%20the%20virtual%20machines%20(VM)%20persist%20their%20state%2C%20meaning%20that%20the%20machine%20doesn%E2%80%99t%20lose%20its%20state%20or%20data%20when%20it%20is%20rebooted%2C%20shutdown%2C%20or%20when%20a%20user%20logs%20off.%20In%20short%2C%20the%20persistent%20VDI%20machine%20behaves%20much%20like%20a%20physical%20machine%20in%20that%20local%20data%20is%20saved%20or%20persisted%20across%20these%20actions%20(reboot%2C%20shutdown%2C%20logoff).%20Onboarding%20a%20persistent%20VDI%20machine%20into%20%26nbsp%3BMicrosoft%20Defender%20ATP%20is%20handled%20the%20same%20way%20you%20would%20onboard%20a%20physical%20machine%2C%20such%20as%20a%20desktop%20or%20laptop.%20Group%20policy%2C%20Microsoft%20Endpoint%20Manager%2C%20and%20other%20methods%20can%20be%20used%20to%20onboard%20a%20persistent%20machine.%20In%20the%20%26nbsp%3BMicrosoft%20Defender%20Security%20Center%2C%20(%3CA%20href%3D%22https%3A%2F%2Fsecuritycenter.windows.com%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsecuritycenter.windows.com%3C%2FA%3E)%20under%20%3CSTRONG%3Eonboarding%3C%2FSTRONG%3E%2C%20you%20would%20select%20your%20preferred%20onboarding%20method%2C%20and%20follow%20the%20instructions%20for%20that%20type.%20As%20you%20can%20see%2C%20onboarding%20persistent%20VDI%20machines%20really%20isn%E2%80%99t%20different%20than%20onboarding%20a%20physical%20machine%20or%20a%20server%20that%20is%20a%20virtual%20machine.%20For%20the%20remainder%20of%20the%20post%20we%20will%20focus%20on%20non-persistent%20VDI.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CU%3ENon-persistent%20VDI%3C%2FU%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENon-persistent%20VDI%20is%20the%20opposite%20of%20persistent%20VDI.%20In%20non-persistent%20VDI%2C%20the%20virtual%20machine%20state%20does%20NOT%20persist%20across%20actions%2C%20such%20as%20reboot%2C%20logoff%2C%20or%20shutdown.%20Typically%2C%20when%20one%20of%20these%20actions%20is%20performed%2C%20the%20virtual%20machine%20is%20deleted.%20It%E2%80%99s%20helpful%20to%20understand%20at%20a%20high%20level%20how%20the%20non-persistent%20VDI%20model%20works.%20This%20will%20help%20paint%20a%20better%20picture%20of%20how%20Microsoft%20Defender%20ATP%20onboarding%20fits%20in.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20a%20non-persistent%20deployment%20type%2C%20VDI%20pools%20are%20typically%20deployed%20off%20one%20virtual%20machine%20commonly%20referred%20to%20as%20the%20VDI%20master%2C%20golden%20image%2C%20or%20master%20image.%20For%20simplicity%2C%20I%E2%80%99ll%20refer%20to%20it%20as%20the%20VDI%20master%20here.%20At%20an%20extremely%20high%20level%20it%20looks%20something%20like%20this%3A%3C%2FP%3E%0A%3CP%20class%3D%22lia-align-center%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22lia-align-center%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22JesseEsquivel_0-1588695840332.jpeg%22%20style%3D%22width%3A%20678px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F189048i1AFCD5CBE8FBACE4%2Fimage-dimensions%2F678x461%3Fv%3D1.0%22%20width%3D%22678%22%20height%3D%22461%22%20title%3D%22JesseEsquivel_0-1588695840332.jpeg%22%20alt%3D%22JesseEsquivel_0-1588695840332.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-align-center%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20VDI%20master%20is%20a%20virtual%20machine%20that%20has%20Windows%20installed%2C%20as%20well%20as%20software%2C%20and%20any%20customizations.%20No%20users%20will%20ever%20actually%20log%20on%20to%20this%20machine%3B%20instead%2C%20it%20is%20used%20by%20the%20virtualization%20platform%20as%20a%20template%20to%20deploy%20VDI%20machines.%20The%20deployment%20of%20the%20VDI%20machines%20from%20the%20VDI%20master%20typically%20happens%20by%20building%20the%20master%2C%20installing%20any%20software%20and%20customizations%2C%20then%20shutting%20it%20down%20in%20order%20to%20provision%20multiple%20VDI%20machines%20into%20groupings%20called%20%E2%80%9Cpools.%E2%80%9D%20The%20VDI%20machines%20that%20are%20provisioned%20into%20pools%20are%20what%20end%20users%20log%20on%20to.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20you%20can%20see%2C%20we%20have%20a%20unique%20scenario%20with%20non-persistent%20VDI.%20Changes%20are%20only%20made%20to%20the%20VDI%20master%2C%20and%20the%20VDI%20machines%20that%20users%20log%20on%20to%20are%20based%20off%20of%20this%20VDI%20master.%20But%20the%20VDI%20machines%20do%20not%20save%20their%20state%20and%20are%20essentially%20deleted%20after%20a%20user%20is%20done%20with%20that%20machine.%26nbsp%3B%20This%20means%20at%20any%20given%20time%20two%20things%20can%20be%20happening%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EVDI%20machines%20are%20being%20spun%20up%20in%20the%20pool%3C%2FLI%3E%0A%3CLI%3EVDI%20machines%20are%20being%20deleted%20or%20de-provisioned%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EFor%20specifics%20on%20this%2C%20you%20will%20want%20to%20contact%20your%20virtualization%20platform%20vendor.%3C%2FP%3E%0A%3CP%3ETo%20protect%20your%20VDI%20machines%2C%20you%20should%20onboard%20them%20into%20Microsoft%20Defender%20ATP.%20But%20this%20puts%20you%20in%20a%20bit%20of%20a%20chicken%2Fegg%20scenario.%20If%20you%20somehow%20deploy%20the%20onboarding%20mechanism%20to%20the%20VDI%20machines%20after%20they%20are%20provisioned%2Fspun%20up%2C%20you%20might%20have%20some%20time%20lapse%20between%20the%20time%20the%20machine%20came%20online%2C%20and%20when%20it%20is%20onboarded%20into%20%26nbsp%3BMicrosoft%20Defender%20ATP.%20This%20leaves%20a%20potential%20gap%20in%20time%20where%20the%20VDI%20machines%20would%20not%20be%20protected%20by%20Microsoft%20Defender%20ATP.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhat%20about%20using%20the%20startup%20script%20via%20group%20policy%3F%20Although%20you%20can%20use%20this%20method%2C%20there%20is%20potential%20for%20things%20to%20go%20wrong%20here%20as%20well%2C%20such%20as%20if%20group%20policy%20is%20broken%20for%20some%20reason%2C%20or%20you%20run%20into%20domain%20controller%2Fsysvol%20issues%2C%20etc.%20Configuration%20management%20tools%20such%20as%20Microsoft%20Endpoint%20Manager%20are%20typically%20not%20used%20on%20non-persistent%20VDI%20machines%2C%20mostly%20because%20anything%20that%20is%20installed%20or%20done%20to%20the%20machine%20with%20a%20configuration%20management%20solution%20is%20lost%20when%20the%20machine%20is%20deleted%2Fde-provisioned%20(so%20all%20of%20the%20actions%20there%20are%20in%20vain).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhat%20you%20need%20is%20a%20way%20to%20onboard%20the%20VDI%20machines%20at%20first%20boot%20as%20soon%20as%20they%20are%20created.%20This%20is%20why%20you%20have%20the%20%E2%80%9CVDI%20onboarding%20for%20non-persistent%20machines%E2%80%9D%20option%20in%20the%20Microsoft%20Defender%20Security%20Center%2C%20as%20shown%20in%20the%20following%20image%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22JesseEsquivel_1-1588695840349.png%22%20style%3D%22width%3A%20783px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F189049iFA32659E7B494997%2Fimage-dimensions%2F783x374%3Fv%3D1.0%22%20width%3D%22783%22%20height%3D%22374%22%20title%3D%22JesseEsquivel_1-1588695840349.png%22%20alt%3D%22JesseEsquivel_1-1588695840349.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESince%20you%20want%20the%20VDI%20machines%20(which%20are%20child%20clones%20of%20the%20VDI%20master)%20to%20be%20onboarded%20immediately%20at%20first%20boot%2C%20you%20must%20%3CSTRONG%3E%3CEM%3E%3CU%3Estage%3C%2FU%3E%20the%20onboarding%20script%20on%20the%20VDI%20master.%3C%2FEM%3E%3C%2FSTRONG%3E%20That%20way%2C%20it%20is%20executed%20as%20a%20startup%20script%20at%20first%20boot%20on%20all%20of%20the%20VDI%20machines%20that%20are%20provisioned%20from%20the%20VDI%20master.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%23FF0000%22%3E%3CSTRONG%3ENote%3A%3C%2FSTRONG%3E%3C%2FFONT%3E%20This%20is%20important%20to%20understand%3A%20The%20placement%20and%20configuration%20of%20the%20VDI%20onboarding%20startup%20script%20on%20the%20VDI%20master%20is%20merely%20staging%20the%20file%20and%20configuring%20it%20as%20a%20startup%20script%20to%20be%20executed%20on%20the%20VDI%20machines.%20It%20is%20%3CSTRONG%3ENOT%3C%2FSTRONG%3E%20intended%20to%20onboard%20the%20actual%20VDI%20master%3B%20in%20fact%2C%20you%20should%20not%20onboard%20a%20VDI%20master%20(more%20on%20this%20later).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fsecurity%2Fthreat-protection%2Fmicrosoft-defender-atp%2Fconfigure-endpoints-vdi%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Edocumentation%3C%2FA%3E%20shows%20that%20there%20are%20two%20different%20ways%20to%20configure%20the%20startup%20script%20for%20VDI%20machine%20onboarding%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EA%20single%20entry%20for%20each%20machine%3C%2FLI%3E%0A%3CLI%3EMultiple%20entries%20for%20each%20machine%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EThis%20is%20explained%20in%20detail%20in%20the%20documentation%2C%20but%20essentially%20boils%20down%20to%20how%20many%20objects%20for%20a%20given%20VDI%20machine%20you%20want%20to%20see%20in%20the%20Microsoft%20Defender%20Security%20Center.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELet%E2%80%99s%20take%20a%20look%20at%20what%20is%20happening%20behind%20the%20scenes.%20The%20difference%20is%20specifically%20in%20the%20single%20entry%20for%20each%20machine%20configuration.%20With%20this%20method%2C%20we%20call%20the%20.ps1%20directly%20as%20a%20startup%20script%20as%20mentioned%20in%20the%20documentation.%20Here%20is%20why%3A%20if%20you%20crack%20open%20the%20.ps1%20onboarding%20script%2C%20you%20can%20see%20the%20following%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22onboarding-servicing-non-persistent-vdi-machines-2.png%22%20style%3D%22width%3A%20968px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F189168i05626B70B7688748%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22onboarding-servicing-non-persistent-vdi-machines-2.png%22%20alt%3D%22onboarding-servicing-non-persistent-vdi-machines-2.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20.ps1%20is%20generating%20a%20unique%20value%20called%20%3CSTRONG%3EsenseGuid%3C%2FSTRONG%3E%2C%20which%20is%20based%20off%20of%20a%20concatenation%20of%20the%20OrgID%20(pulled%20from%20the%20WindowsDefenderATPOnboardingScript.cmd%20file)%2C%20the%20%E2%80%9C_%E2%80%9D%20character%2C%20and%20the%20computer%20name%20value.%20If%20not%20already%20present%2C%20the%20senseGuid%20value%20is%20written%20to%20the%20registry%20on%20the%20VDI%20machine%20at%20the%20path%20noted%20in%20the%20%24senseGuidRegPath%20line.%20Later%20in%20the%20.ps1%2C%20the%20%3CSTRONG%3EWindowsDefenderATPOnboardingScript.cmd%3C%2FSTRONG%3E%20file%20is%20then%20called.%20When%20the%20machine%20starts%20the%20SENSE%20service%2C%20the%20%3CSTRONG%3EmachineID%3C%2FSTRONG%3E%20is%20calculated%2C%20and%20its%20conversation%20with%20the%20tenant%20for%20onboarding%20begins.%20The%20%3CSTRONG%3EsenseGuid%3C%2FSTRONG%3E%20value%20produced%20by%20the%20.ps1%20in%20the%20registry%20on%20the%20machine%20ensures%20the%20same%20%3CSTRONG%3EmachineID%3C%2FSTRONG%3E%20is%20used%20as%20long%20as%20the%20machine%20DNS%20name%20stays%20the%20same.%20The%20%3CSTRONG%3EmachineID%3C%2FSTRONG%3E%20value%20is%20also%20calculated%20as%20part%20of%20the%20onboarding%20process%2C%20and%20once%20it%20is%20calculated%20it%20is%20also%20written%20to%20the%20same%20path%20in%20the%20registry%20on%20the%20local%20machine%20as%20a%20value%20called%20%3CSTRONG%3EsenseID.%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThere%20you%20have%20it%3B%20this%20is%20the%20logic%20that%20ensures%20the%20machine%20only%20has%20a%20single%20entry%20in%20the%20portal%20each%20time%20onboarding%20is%20run.%20If%20you%20opt%20for%20the%20other%20route%2C%20the%20.ps1%20is%20not%20used%20and%20the%20.cmd%20is%20called%20directly%20as%20a%20startup%20script%2C%20which%20doesn%E2%80%99t%20have%20this%20logic%3B%20therefore%2C%20multiple%20entries%20for%20the%20same%20machine%20are%20populated%20in%20the%20portal.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThere%20is%20more%20to%20this%20VDI%20onboarding%20story%2C%20such%20as%20how%20all%20of%20this%20relates%20to%20the%20management%20or%20servicing%20of%20the%20VDI%20Master.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CU%3EVDI%20Master%20Servicing%3C%2FU%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPatching%20and%20servicing%20of%20VDI%20machines%20in%20a%20pool%20doesn%E2%80%99t%20happen%20directly%20on%20those%20machines.%20If%20you%20push%20software%20or%20configuration%20changes%20to%20them%2C%20those%20changes%20are%20lost%20at%20logoff%2Freboot%2Fshutdown%20of%20the%20VDI%20machine.%20The%20patching%2Fservicing%20happens%20only%20on%20the%20VDI%20master.%20Typically%2C%20organizations%20re-compose%20their%20VDI%20pools%20at%20least%20once%20a%20month%20at%20a%20minimum%20to%20incorporate%20the%20latest%20Microsoft%20updates.%20From%20a%20high%20level%2C%20there%20are%20several%20approaches%20to%20servicing%20the%20VDI%20master.%20They%20are%20as%20follows%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EReuse%20the%20existing%20master%20by%20powering%20it%20on%2C%20patching%20and%20updating%20it%2C%20then%20shutting%20it%20back%20down.%3C%2FLI%3E%0A%3CLI%3EBuild%20a%20new%20master%20from%20scratch%20via%20automated%20process%20such%20as%20Microsoft%20Deployment%20Toolkit.%3C%2FLI%3E%0A%3CLI%3EOffline%20servicing%20(if%20possible).%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSTRONG%3EOption%201%20%E2%80%93%20Re-use%20the%20existing%20master%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EReusing%20the%20existing%20master%20can%20have%20unintended%20consequences%20if%20you%20are%20not%20careful.%20The%20main%20reason%20is%20that%20because%20you%20have%20%3CSTRONG%3E%3CEM%3E%3CU%3Estaged%3C%2FU%3E%20the%20onboarding%20script%20on%20the%20VDI%20master%3C%2FEM%3E%3C%2FSTRONG%3E%20(so%20that%20it%20is%20executed%20as%20a%20startup%20script%20at%20first%20boot%20on%20all%20of%20the%20VDI%20machines)%2C%20this%20means%20that%20when%20you%20power%20on%20the%20VDI%20master%2C%20the%20onboarding%20script%20is%20going%20to%20run.%20Remember%20that%20you%20should%20never%20onboard%20the%20VDI%20master.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20power%20on%20the%20VDI%20master%2C%20it%20will%20be%20onboarded%20(which%20you%20don%E2%80%99t%20want).%20The%20problem%20arises%20if%20you%20don%E2%80%99t%20offboard%20the%20VDI%20master%2C%20do%20some%20cleanup%2C%20and%20apply%20patches%2Fservice%20updates%2C%20shut%20it%20down%2C%20and%20then%20deploy%20a%20VDI%20pool%20from%20it.%20Here%20is%20the%20scenario%20and%20outcome%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3ESuppose%20that%20you%20have%20onboarded%20the%20VDI%20master%20simply%20by%20powering%20it%20on%20and%20it%20is%20assigned%20a%20senseGuid%20and%20a%20senseID.%20Those%20are%20written%20to%20the%20registry%20(with%20all%20the%20other%20onboarding%20info).%3C%2FLI%3E%0A%3CLI%3EThe%20VDI%20master%20is%20patched%2Fserviced%20and%20shut%20down%2C%20and%20a%20new%20VDI%20pool%20is%20deployed%20from%20it.%3C%2FLI%3E%0A%3CLI%3EOnce%20the%20VDI%20pool%20is%20deployed%2C%20the%20VDI%20machines%20start%20to%20boot%20up.%3C%2FLI%3E%0A%3CLI%3EThe%20VDI%20machines%20run%20the%20onboarding%20(because%20they%20are%20configured%20to%20do%20so)%2C%20but%20onboarding%20exits%20because%20they%20are%20%3CSTRONG%3E%3CEM%3Ealready%20onboarded%3C%2FEM%3E%3C%2FSTRONG%3E%3CEM%3E.%3C%2FEM%3E%3C%2FLI%3E%0A%3CLI%3ESince%20the%20VDI%20machines%20are%20basically%20a%20clone%20(I%20use%20this%20term%20loosely%20here)%20of%20the%20VDI%20master%2C%20they%20already%20have%20the%20senseID%20and%20senseGuid%20written%20to%20their%20registry%20along%20with%20all%20the%20other%20onboarding%20information.%3C%2FLI%3E%0A%3CLI%3EWhen%20all%20the%20VDI%20machines%20start%20to%20report%20their%20telemetry%2C%20%3CSTRONG%3E%3CEM%3E%3CU%3Ethey%20are%20reporting%20it%20under%20the%20same%20senseID%3C%2FU%3E%20%3C%2FEM%3E%3C%2FSTRONG%3E(or%20machineID%20as%20it%20is%20called%20in%20the%20Microsoft%20Defender%20Security%20Center).%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EHaving%20all%20your%20VDI%20machines%20reporting%20telemetry%20to%20the%20same%20senseID%2FmachineID%20in%20Microsoft%20Defender%20ATP%20causes%20a%20number%20of%20issues.%20There%20is%20no%20delineation%20between%20VDI%20machines%2C%20so%20if%20something%20happens%20on%20one%20of%20them%2C%20you%20won%E2%80%99t%20actually%20know%20which%20one%20it%20happened%20on%2C%20since%20they%20all%20report%20their%20telemetry%20to%20the%20same%20machineID.%20This%20is%20a%20bad%20scenario%20any%20way%20you%20look%20at%20it.%3C%2FP%3E%0A%3CP%3EHow%20do%20you%20avoid%20this%20scenario%3F%20(and%20you%20should%20at%20all%20costs)%20If%20your%20organization%20uses%20the%20method%20of%20turning%20on%20and%20servicing%20the%20same%20VDI%20master%2C%20then%20you%20should%20ensure%20that%20you%20perform%20a%20couple%20of%20extra%20steps%20to%20avoid%20this%20scenario.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%23FF0000%22%3E%3CSTRONG%3ENote%3A%3C%2FSTRONG%3E%20%3C%2FFONT%3EEach%20time%20you%20boot%20the%20VDI%20master%20for%20servicing%2Fpatching%2C%20make%20sure%20to%20run%20the%20offboarding%20script%20(downloadable%20from%20the%20Microsoft%20Defender%20Security%20Center).%20This%20will%20turn%20off%20the%20Microsoft%20Defender%20ATP%20sensor%20and%20remove%20the%20onboarding%20information%20from%20the%20registry.%26nbsp%3B%20You%20also%20need%20to%20make%20sure%20that%20the%20cyber%20folder%20contents%20are%20cleaned%20out%2C%20as%20data%20will%20begin%20to%20accumulate%20there%20when%20it%20is%20onboarded.%20Only%20the%20system%20account%20has%20access%20to%20perform%20this%20action.%20You%20can%20use%20psexec%20to%20open%20a%20cmd%20prompt%20as%20system%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%230000FF%22%3EPsExec.exe%20-s%20cmd.exe%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%230000FF%22%3Ecd%20%22C%3A%5CProgramData%5CMicrosoft%5CWindows%20Defender%20Advanced%20Threat%20Protection%5CCyber%22%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%230000FF%22%3Edel%20*.*%20%2Ff%20%2Fs%20%2Fq%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20color%3D%22%230000FF%22%3Eexit%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOur%20documentation%20has%20been%20updated%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fsecurity%2Fthreat-protection%2Fmicrosoft-defender-atp%2Fconfigure-endpoints-vdi%23updating-non-persistent-virtual-desktop-infrastructure-vdi-images%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CSPAN%3Ehere%3C%2FSPAN%3E%3C%2FA%3E%20to%20reflect%20this.%20This%20brings%20us%20to%20option%20number%20two%2C%20which%20is%20to%20build%20your%20VDI%20master%20from%20scratch%20via%20automated%20process%20each%20time%20you%20recompose%20your%20VDI%20pools.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EOption%202%20%E2%80%93%20Build%20a%20new%20master%20from%20scratch%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThere%20are%20a%20number%20of%20good%20reasons%20why%20you%20should%20consider%20using%20this%20method.%20The%20first%20reason%20is%2C%20you%20will%20never%20be%20in%20a%20position%20to%20have%20the%20issue%20described%20above%20happen%20(since%20you%20don%E2%80%99t%20reuse%20the%20same%20master%20over%20and%20over).%20You%20also%20get%20other%20benefits%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EUsing%20a%20clean%2Ffresh%20install%20of%20Windows%20each%20time%20(no%20WinSxS%20or%20image%20cleanup%20via%20DISM%20required)%3C%2FLI%3E%0A%3CLI%3EVDI%20master%20build%20automation%3C%2FLI%3E%0A%3CLI%3EVDI%20master%20software%20package%20consistency%3C%2FLI%3E%0A%3CLI%3EAutomated%20integration%20of%20Microsoft%20Defender%20Application%20Control%20policies%3C%2FLI%3E%0A%3CLI%3EAutomated%20integration%20of%20Microsoft%20Defender%20ATP%20onboarding%3C%2FLI%3E%0A%3CLI%3EAutomated%20development%20and%20testing%20of%20your%20organization%E2%80%99s%20vNext%20VDI%20image%3C%2FLI%3E%0A%3CLI%3EMore%20agile%20iterations%20between%20Windows%2010%20versions%20and%20software%3C%2FLI%3E%0A%3CLI%3E...and%20more.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EUsing%20this%20approach%20also%20removes%20a%20significant%20amount%20of%20room%20for%20human%20error%20by%20using%20automation%20tools%20such%20as%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fmem%2Fconfigmgr%2Fmdt%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EMicrosoft%20Deployment%20Toolkit%3C%2FA%3E%20(MDT)%20to%20build%20your%20VDI%20master.%20We%20have%20seen%20great%20success%20by%20customers%20who%20use%20this%20method%20to%20deploy%20their%20VDI%20pools.%20A%20sample%20script%20that%20can%20be%20used%20to%20stage%20the%20Microsoft%20Defender%20ATP%20onboarding%20script%20on%20your%20VDI%20master%20during%20an%20MDT%20task%20sequence%20is%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FJesseEsquivel%2FMDATP%2Fblob%2Fmaster%2FScripts%2FMDATP-Onboard.ps1%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EOption%203%20%E2%80%93%20Offline%20Servicing%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20option%20is%20really%20only%20available%20if%20you%E2%80%99re%20using%20a%20Microsoft%20formatted%20virtual%20hard%20disk%2C%20such%20as%20a%20vhd%20or%20vhdx.%20DISM%20can%20be%20used%20to%20service%20these%20disks%20offline%2C%20and%20this%20has%20also%20been%20added%20to%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fsecurity%2Fthreat-protection%2Fmicrosoft-defender-atp%2Fconfigure-endpoints-vdi%23updating-non-persistent-virtual-desktop-infrastructure-vdi-images%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Edocumentation%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20hope%20this%20helps%20better%20explain%20Microsoft%20Defender%20ATP%20onboarding%20and%20servicing%20for%20non-persistent%20VDI%20machines.%20Let%20us%20know%20what%20you%20think%20by%20leaving%20a%20comment%20below.%20And%20stay%20tuned--we%20will%20talk%20about%20Microsoft%20Defender%20Antivirus%20settings%20in%20a%20non-persistent%20VDI%20environment%20next%20time!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EJesse%20Esquivel%2C%20Program%20Manager%3C%2FP%3E%0A%3CP%3EMicrosoft%20Defender%20ATP%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1360721%22%20slang%3D%22en-US%22%3E%3CDIV%20id%3D%22lia-teaserTinyMceEditorJesseEsquivel_0%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22MDC19_liquidCooledServerBlade_001.jpg%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F189126i80B65BD7E5FC622D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22MDC19_liquidCooledServerBlade_001.jpg%22%20alt%3D%22MDC19_liquidCooledServerBlade_001.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EAn%20overview%20of%20onboarding%20and%20servicing%20non-persistent%20VDI%20machines%20with%20Microsoft%20Defender%20ATP.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1360721%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ERemote%20Work%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EVDI%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Evirtual%20desktop%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EVirtual%20Machines%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1502604%22%20slang%3D%22en-US%22%3ERe%3A%20Onboarding%20and%20servicing%20non-persistent%20VDI%20machines%20with%20Microsoft%20Defender%20ATP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1502604%22%20slang%3D%22en-US%22%3E%3CP%3EGreat%20job%2C%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F643371%22%20target%3D%22_blank%22%3E%40JesseEsquivel%3C%2FA%3E%2C%20thanks%20for%20sharing.%3C%2FP%3E%3CP%3EHave%20you%20ever%20seen%20any%20issues%20with%20onboarded%20machines%20going%20offline%2Fclosing%20ports%20after%20being%20unboarded%3F%3C%2FP%3E%3CP%3EWe%20are%20facing%20such%20issues%20in%20a%20customer%20scenario%20where%20the%20VDI%20machines%20become%20unavailable%20to%20Citrix%20after%20being%20onboared.%20The%20required%20ports%20simply%20closes%20and%20the%20machines%20cannot%20be%20used.%20Once%20we%20remove%20the%20onboarding%20script%2C%20everything%20works%20again.%3C%2FP%3E%3CP%3EWe%20have%20opened%20a%20support%20ticket%20with%20Microsoft%20but%20Support%20seems%20unable%20to%20help%20or%20even%20understand%20the%20issue.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1502728%22%20slang%3D%22en-US%22%3ERe%3A%20Onboarding%20and%20servicing%20non-persistent%20VDI%20machines%20with%20Microsoft%20Defender%20ATP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1502728%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F381360%22%20target%3D%22_blank%22%3E%40fgondorf%3C%2FA%3E%26nbsp%3BI%20have%20not%20seen%20this%20issue.%26nbsp%3B%20Onboarding%20a%20machine%20into%20MDATP%20simply%20instructs%20it%20to%20start%20sending%20telemetry%20to%20an%20MDATP%20tenant.%26nbsp%3B%20I%20would%20take%20a%20look%20at%20any%20host%20based%20firewalls%20on%20the%20machine%2C%20and%20I%20would%20recommend%20continuing%20to%20work%20with%20support%20as%20well.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1763622%22%20slang%3D%22en-US%22%3ERe%3A%20Onboarding%20and%20servicing%20non-persistent%20VDI%20machines%20with%20Microsoft%20Defender%20ATP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1763622%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F381360%22%20target%3D%22_blank%22%3E%40fgondorf%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20experiencing%20this%20same%20issue%20in%20my%20environment%2C%20exactly%20the%20same%20behaviour%20as%20you%20described.%3C%2FP%3E%3CP%3EPlease%20could%20you%20detail%20the%20steps%20the%20did%20to%20resolve%20the%20problem%3F%3C%2FP%3E%3CP%3EThanks%20in%20advance.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Microsoft

Virtual Desktop Infrastructure (VDI) is fairly common in customer environments, especially in today’s world where many are working from home as a result of COVID-19. As such, we want to ensure that Microsoft provides protection for VDI machines, and that you understand how  Microsoft Defender Advanced Threat Protection (Microsoft Defender ATP) works within your VDI deployment. In this blog post, we’ll cover VDI, how it works with Microsoft Defender ATP, best practices, and some lessons learned.

 

When we talk about VDI, we often talk about two different deployment types:  persistent and non-persistent. Let’s look at both of these types and explore how they interact with Microsoft Defender ATP onboarding.

 

Persistent VDI

 

Persistent VDI is a deployment type where the virtual machines (VM) persist their state, meaning that the machine doesn’t lose its state or data when it is rebooted, shutdown, or when a user logs off. In short, the persistent VDI machine behaves much like a physical machine in that local data is saved or persisted across these actions (reboot, shutdown, logoff). Onboarding a persistent VDI machine into  Microsoft Defender ATP is handled the same way you would onboard a physical machine, such as a desktop or laptop. Group policy, Microsoft Endpoint Manager, and other methods can be used to onboard a persistent machine. In the  Microsoft Defender Security Center, (https://securitycenter.windows.com) under onboarding, you would select your preferred onboarding method, and follow the instructions for that type. As you can see, onboarding persistent VDI machines really isn’t different than onboarding a physical machine or a server that is a virtual machine. For the remainder of the post we will focus on non-persistent VDI.

 

Non-persistent VDI

 

Non-persistent VDI is the opposite of persistent VDI. In non-persistent VDI, the virtual machine state does NOT persist across actions, such as reboot, logoff, or shutdown. Typically, when one of these actions is performed, the virtual machine is deleted. It’s helpful to understand at a high level how the non-persistent VDI model works. This will help paint a better picture of how Microsoft Defender ATP onboarding fits in.

 

In a non-persistent deployment type, VDI pools are typically deployed off one virtual machine commonly referred to as the VDI master, golden image, or master image. For simplicity, I’ll refer to it as the VDI master here. At an extremely high level it looks something like this:

 

JesseEsquivel_0-1588695840332.jpeg

 

The VDI master is a virtual machine that has Windows installed, as well as software, and any customizations. No users will ever actually log on to this machine; instead, it is used by the virtualization platform as a template to deploy VDI machines. The deployment of the VDI machines from the VDI master typically happens by building the master, installing any software and customizations, then shutting it down in order to provision multiple VDI machines into groupings called “pools.” The VDI machines that are provisioned into pools are what end users log on to.

 

As you can see, we have a unique scenario with non-persistent VDI. Changes are only made to the VDI master, and the VDI machines that users log on to are based off of this VDI master. But the VDI machines do not save their state and are essentially deleted after a user is done with that machine.  This means at any given time two things can be happening:

 

  • VDI machines are being spun up in the pool
  • VDI machines are being deleted or de-provisioned

For specifics on this, you will want to contact your virtualization platform vendor.

To protect your VDI machines, you should onboard them into Microsoft Defender ATP. But this puts you in a bit of a chicken/egg scenario. If you somehow deploy the onboarding mechanism to the VDI machines after they are provisioned/spun up, you might have some time lapse between the time the machine came online, and when it is onboarded into  Microsoft Defender ATP. This leaves a potential gap in time where the VDI machines would not be protected by Microsoft Defender ATP.

 

What about using the startup script via group policy? Although you can use this method, there is potential for things to go wrong here as well, such as if group policy is broken for some reason, or you run into domain controller/sysvol issues, etc. Configuration management tools such as Microsoft Endpoint Manager are typically not used on non-persistent VDI machines, mostly because anything that is installed or done to the machine with a configuration management solution is lost when the machine is deleted/de-provisioned (so all of the actions there are in vain).

 

What you need is a way to onboard the VDI machines at first boot as soon as they are created. This is why you have the “VDI onboarding for non-persistent machines” option in the Microsoft Defender Security Center, as shown in the following image:

 

JesseEsquivel_1-1588695840349.png

 

Since you want the VDI machines (which are child clones of the VDI master) to be onboarded immediately at first boot, you must stage the onboarding script on the VDI master. That way, it is executed as a startup script at first boot on all of the VDI machines that are provisioned from the VDI master.

 

Note: This is important to understand: The placement and configuration of the VDI onboarding startup script on the VDI master is merely staging the file and configuring it as a startup script to be executed on the VDI machines. It is NOT intended to onboard the actual VDI master; in fact, you should not onboard a VDI master (more on this later).

 

The documentation shows that there are two different ways to configure the startup script for VDI machine onboarding:

 

  • A single entry for each machine
  • Multiple entries for each machine

This is explained in detail in the documentation, but essentially boils down to how many objects for a given VDI machine you want to see in the Microsoft Defender Security Center.

 

Let’s take a look at what is happening behind the scenes. The difference is specifically in the single entry for each machine configuration. With this method, we call the .ps1 directly as a startup script as mentioned in the documentation. Here is why: if you crack open the .ps1 onboarding script, you can see the following:

 

onboarding-servicing-non-persistent-vdi-machines-2.png

 

The .ps1 is generating a unique value called senseGuid, which is based off of a concatenation of the OrgID (pulled from the WindowsDefenderATPOnboardingScript.cmd file), the “_” character, and the computer name value. If not already present, the senseGuid value is written to the registry on the VDI machine at the path noted in the $senseGuidRegPath line. Later in the .ps1, the WindowsDefenderATPOnboardingScript.cmd file is then called. When the machine starts the SENSE service, the machineID is calculated, and its conversation with the tenant for onboarding begins. The senseGuid value produced by the .ps1 in the registry on the machine ensures the same machineID is used as long as the machine DNS name stays the same. The machineID value is also calculated as part of the onboarding process, and once it is calculated it is also written to the same path in the registry on the local machine as a value called senseID.

 

There you have it; this is the logic that ensures the machine only has a single entry in the portal each time onboarding is run. If you opt for the other route, the .ps1 is not used and the .cmd is called directly as a startup script, which doesn’t have this logic; therefore, multiple entries for the same machine are populated in the portal.

 

There is more to this VDI onboarding story, such as how all of this relates to the management or servicing of the VDI Master.

 

VDI Master Servicing

 

Patching and servicing of VDI machines in a pool doesn’t happen directly on those machines. If you push software or configuration changes to them, those changes are lost at logoff/reboot/shutdown of the VDI machine. The patching/servicing happens only on the VDI master. Typically, organizations re-compose their VDI pools at least once a month at a minimum to incorporate the latest Microsoft updates. From a high level, there are several approaches to servicing the VDI master. They are as follows:

 

  1. Reuse the existing master by powering it on, patching and updating it, then shutting it back down.
  2. Build a new master from scratch via automated process such as Microsoft Deployment Toolkit.
  3. Offline servicing (if possible).

Option 1 – Re-use the existing master

 

Reusing the existing master can have unintended consequences if you are not careful. The main reason is that because you have staged the onboarding script on the VDI master (so that it is executed as a startup script at first boot on all of the VDI machines), this means that when you power on the VDI master, the onboarding script is going to run. Remember that you should never onboard the VDI master.

 

If you power on the VDI master, it will be onboarded (which you don’t want). The problem arises if you don’t offboard the VDI master, do some cleanup, and apply patches/service updates, shut it down, and then deploy a VDI pool from it. Here is the scenario and outcome:

 

  1. Suppose that you have onboarded the VDI master simply by powering it on and it is assigned a senseGuid and a senseID. Those are written to the registry (with all the other onboarding info).
  2. The VDI master is patched/serviced and shut down, and a new VDI pool is deployed from it.
  3. Once the VDI pool is deployed, the VDI machines start to boot up.
  4. The VDI machines run the onboarding (because they are configured to do so), but onboarding exits because they are already onboarded.
  5. Since the VDI machines are basically a clone (I use this term loosely here) of the VDI master, they already have the senseID and senseGuid written to their registry along with all the other onboarding information.
  6. When all the VDI machines start to report their telemetry, they are reporting it under the same senseID (or machineID as it is called in the Microsoft Defender Security Center).

Having all your VDI machines reporting telemetry to the same senseID/machineID in Microsoft Defender ATP causes a number of issues. There is no delineation between VDI machines, so if something happens on one of them, you won’t actually know which one it happened on, since they all report their telemetry to the same machineID. This is a bad scenario any way you look at it.

How do you avoid this scenario? (and you should at all costs) If your organization uses the method of turning on and servicing the same VDI master, then you should ensure that you perform a couple of extra steps to avoid this scenario.

 

Note: Each time you boot the VDI master for servicing/patching, make sure to run the offboarding script (downloadable from the Microsoft Defender Security Center). This will turn off the Microsoft Defender ATP sensor and remove the onboarding information from the registry.  You also need to make sure that the cyber folder contents are cleaned out, as data will begin to accumulate there when it is onboarded. Only the system account has access to perform this action. You can use psexec to open a cmd prompt as system:

 

PsExec.exe -s cmd.exe

cd "C:\ProgramData\Microsoft\Windows Defender Advanced Threat Protection\Cyber"

del *.* /f /s /q

exit

 

Our documentation has been updated here to reflect this. This brings us to option number two, which is to build your VDI master from scratch via automated process each time you recompose your VDI pools.

 

Option 2 – Build a new master from scratch

 

There are a number of good reasons why you should consider using this method. The first reason is, you will never be in a position to have the issue described above happen (since you don’t reuse the same master over and over). You also get other benefits:

 

  1. Using a clean/fresh install of Windows each time (no WinSxS or image cleanup via DISM required)
  2. VDI master build automation
  3. VDI master software package consistency
  4. Automated integration of Microsoft Defender Application Control policies
  5. Automated integration of Microsoft Defender ATP onboarding
  6. Automated development and testing of your organization’s vNext VDI image
  7. More agile iterations between Windows 10 versions and software
  8. ...and more.

Using this approach also removes a significant amount of room for human error by using automation tools such as the Microsoft Deployment Toolkit (MDT) to build your VDI master. We have seen great success by customers who use this method to deploy their VDI pools. A sample script that can be used to stage the Microsoft Defender ATP onboarding script on your VDI master during an MDT task sequence is here.

 

Option 3 – Offline Servicing

 

This option is really only available if you’re using a Microsoft formatted virtual hard disk, such as a vhd or vhdx. DISM can be used to service these disks offline, and this has also been added to the documentation.

 

I hope this helps better explain Microsoft Defender ATP onboarding and servicing for non-persistent VDI machines. Let us know what you think by leaving a comment below. And stay tuned--we will talk about Microsoft Defender Antivirus settings in a non-persistent VDI environment next time!

 

Jesse Esquivel, Program Manager

Microsoft Defender ATP

3 Comments
New Contributor

Great job, @JesseEsquivel, thanks for sharing.

Have you ever seen any issues with onboarded machines going offline/closing ports after being onboarded?

We are facing such issues in a customer scenario where the VDI machines become unavailable to Citrix after being onboarded. The required ports simply close and the machines cannot be used. Once we remove the onboarding script, everything works again.

We have opened a support ticket with Microsoft but Support seems unable to help or even understand the issue.

Microsoft

Hi @fgondorf I have not seen this issue.  Onboarding a machine into MDATP simply instructs it to start sending telemetry to an MDATP tenant.  I would take a look at any host based firewalls on the machine, and I would recommend continuing to work with support as well.  

Regular Visitor

Hello @fgondorf 

I am experiencing this same issue in my environment, exactly the same behaviour as you described.

Please could you detail the steps the did to resolve the problem?

Thanks in advance.