%3CLINGO-SUB%20id%3D%22lingo-sub-372218%22%20slang%3D%22en-US%22%3EStep%20by%20step%20-%20Creating%20Shielded%20VMs%20without%20VMM%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-372218%22%20slang%3D%22en-US%22%3E%0A%20%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CSTRONG%3EFirst%20published%20on%20TECHNET%20on%20Jun%2006%2C%202016%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20Hi%2C%20I%E2%80%99m%20Jane%2C%20one%20of%20the%20newest%20members%20of%20the%20Windows%20Server%20Security%20Product%20Team.%20My%20very%20first%20hands-on%20experience%20is%20to%20deploy%20Shielded%20VMs%20with%20the%20minimum%20amount%20of%20hardware.%20It%20was%20fun%20and%20a%20great%20learning%20experience.%20I%20followed%20the%20comprehensive%20%3CA%20href%3D%22https%3A%2F%2Fgallery.technet.microsoft.com%2FShielded-VMs-and-Guarded-98d2b045%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%20TP5%20deployment%20guide%20on%20Shielded%20VM%20and%20Guarded%20Fabric%20%3C%2FA%3E%20guide%20with%20one%20deviation%3A%20I%20deployed%20it%26nbsp%3Bwithout%20VMM.%20If%20you%20are%20just%20like%20me%2C%20trying%20out%20the%20scenario%20end%20to%20end%2C%20this%20blog%20post%20will%20provide%20you%20the%20step%20by%20step%20instructions%20to%20use%20just%20the%20PowerShell%20cmdlets%20to%20create%20shielded%20VMs.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20This%20blog%20post%20doesn%E2%80%99t%20cover%20any%20of%20the%20gory%20details%20or%20the%20building%20blocks%20for%20this%20scenario%2C%20etc.%26nbsp%3B%20For%20that%2C%20I%20highly%20recommend%20that%20you%20first%20read%20through%20the%20%3CA%20href%3D%22https%3A%2F%2Fgallery.technet.microsoft.com%2FShielded-VMs-and-Guarded-98d2b045%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%20deployment%20guide%20%3C%2FA%3E%20which%20also%20covers%20terminology%20descriptions%2C%20scenario%20overview%20and%20architectural%20designs.%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId-1679736491%22%20id%3D%22toc-hId-1761101603%22%3EPrerequisites%3C%2FH2%3E%3CBR%20%2F%3E%20Before%20you%20start%2C%20you%20should%20have%20completed%20the%20deployment%20of%20both%20the%20guarded%20host%20and%20the%20Host%20Guardian%20Service%20(HGS)%20server.%20%26nbsp%3BFor%20your%20reference%2C%20you%20can%20follow%20the%20%3CA%20href%3D%22https%3A%2F%2Fblogs.technet.microsoft.com%2Fdatacentersecurity%2F2016%2F03%2F16%2Fwindows-server-2016-and-host-guardian-service-for-shielded-vms%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%20deploying%20HGS%20server%20%3C%2FA%3E%20blog%20to%20setup%20the%20HGS%20server%20as%20well%20as%20deploying%20guarded%20host%20guide%20to%20configure%20the%20guarded%20hosts.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20As%20a%20way%20to%20quickly%20check%20and%20verify%20your%20deployment%2C%20run%20the%20following%20cmdlet%20on%20each%20guarded%20host%3A%20%3CBR%20%2F%3E%20Get-HGSClientConfiguration%20%3CBR%20%2F%3E%20The%20output%20of%20the%20cmdlet%20should%20display%20that%20IsHostGuarded%20is%20True%2C%20and%20AttestationStatus%20is%20Passed.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20There%20are%202%20ways%20to%20create%20shielded%20VMs%3A%20%3CBR%20%2F%3E%3CUL%3E%3CBR%20%2F%3E%3CLI%3EShielding%20an%20existing%20VM%20(a.k.a%20grandfathering)%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3EProvisioning%20a%20shielded%20VM%20from%20a%20template%3C%2FLI%3E%3CBR%20%2F%3E%3C%2FUL%3E%3CBR%20%2F%3E%20I%E2%80%99ll%20illustrate%20both%20approaches%20in%20this%20blog%20post.%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId--872420470%22%20id%3D%22toc-hId--791055358%22%3EShielding%20an%20existing%20VM%3C%2FH2%3E%3CBR%20%2F%3E%20Let%E2%80%99s%20start%20with%20the%20simpler%20approach.%20This%20requires%20you%20to%20have%20a%20running%20VM%20on%20a%20host%20which%20is%20not%20the%20guarded%20host.%20This%20is%20important%20to%20distinguish%2C%20because%20you%20are%20simulating%20the%20scenario%20where%20a%20tenant%20wants%20to%20take%20an%20existing%2C%20unprotected%20VM%20and%20shield%20it%20before%20moving%20it%20to%20a%20guarded%20host.%20For%20clarity%2C%20the%20host%20machine%20which%20is%20not%20the%20guarded%20host%20will%20be%20referred%20as%20the%20tenant%20host%20below.%20A%20shielded%20VM%20can%20only%20run%20on%20a%20trusted%20guarded%20host.%20The%20trust%20is%20established%20by%20the%26nbsp%3Badding%20the%20HGS%20guardian%20(retrieved%20from%20the%20HGS%20server)%20to%20the%20Key%20Protector%20which%20is%20used%20to%20shield%20the%20VM.%20That%20way%2C%20the%20shielded%20VM%20can%20only%20be%20started%20after%20the%20guarded%20host%20successfully%20attest%20against%20the%20HGS%20server.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20In%20this%20example%2C%20the%20running%20VM%20is%20named%20%3CEM%3E%20SVM%20%3C%2FEM%3E%20.%20This%20VM%20must%20be%20generation%202%20and%20have%20a%20supported%20OS%20installed%20with%20remote%20desktop%20enabled.%20You%20should%20verify%20the%20VM%20can%20be%20connected%20through%20RDP%20first%2C%20as%20it%20will%20almost%20certainly%20be%20the%20primary%20way%20to%20access%20the%20VM%20once%20it%20is%20shielded%20(unless%20you%20have%20installed%20other%20remoting%20capabilities).%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId-870389865%22%20id%3D%22toc-hId-951754977%22%3ERetrieve%20the%20HGS%20guardian%3C%2FH2%3E%3CBR%20%2F%3E%20As%20explained%20above%2C%20the%20first%20step%20is%20to%20get%20the%20HGS%20guardian%20metadata%20from%20the%20HGS%20server%2C%20and%20use%20it%20to%20create%20the%20Key%20protector.%20To%20do%20this%2C%20run%20the%20following%20PowerShell%20command%20on%20a%20guarded%20host%20or%20any%20machine%20that%20can%20reach%20the%20HGS%20server%3A%20%3CBR%20%2F%3E%20Invoke-WebRequest%20http%3A%2F%2F%3CHGSSERVER%3EFQDN%26gt%3B%2FKeyProtection%2Fservice%2Fmetadata%2F2014-07%2Fmetadata.xml%20-OutFile%20C%3A%5CHGSGuardian.xml%20%3CBR%20%2F%3E%20Copy%20the%20file%20C%3A%5CHGSGuardian.xml%20to%20the%20tenant%20host.%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId--1681767096%22%20id%3D%22toc-hId--1600401984%22%3EShield%20the%20VM%3C%2FH2%3E%3CBR%20%2F%3E%20Each%20shielded%20VM%20has%20a%20Key%20Protector%20which%20contains%26nbsp%3Bone%20owner%20guardian%2C%20and%20one%20or%20more%20HGS%20guardians.%20The%26nbsp%3Bsteps%20below%20illustrate%20the%20process%20of%26nbsp%3Bgetting%20the%20guardians%2C%20create%20the%20Key%20Protector%20in%20order%20to%20shield%20the%20VM.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Run%20the%20following%20cmdlets%20on%20a%20tenant%20host%3A%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%5Bsnippet%20slug%3Dshield-a-vm-by-tenant-admin%20line_numbers%3Dfalse%20lang%3Dbsh%5D%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Typically%2C%20you%20would%20logon%20to%20the%20VM%20and%20enable%20BitLocker%20before%20moving%20it%20to%20the%20guarded%20host.%20Since%20this%20is%20only%20for%20testing%20purposes%2C%20we%E2%80%99ll%20skip%20this%20step%20here.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20To%20complete%20the%20process%2C%20perform%20the%20following%20steps%3A%20%3CBR%20%2F%3E%3CUL%3E%3CBR%20%2F%3E%3CLI%3Eshut%20down%20the%20shielded%20VM%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3Eexport%20the%20VM%20from%20the%20tenant%20host%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3Ecopy%20the%20exported%20file%20to%20the%20guarded%20host%20and%20import%20them%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3Estart%20the%20VM%20on%20the%20guarded%20host%3C%2FLI%3E%3CBR%20%2F%3E%3C%2FUL%3E%3CBR%20%2F%3E%20As%20shown%20above%2C%20this%20approach%20is%20quite%20manual%20and%20easy%20to%20make%20mistakes%20(such%20as%20not%20running%20BitLocker%20to%20encrypt%20data).%20Therefore%2C%20it%20is%20not%20recommended%20in%20production.%20For%20that%2C%20you%20should%20use%20the%20second%20approach%20illustrated%20in%20the%20following%20section%3A%20%3CA%20href%3D%22%23ProvisioningTemplate%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20Provisioning%20Shielded%20VMs%20using%20the%20template%20disk.%20%3C%2FA%3E%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId-61043239%22%20id%3D%22toc-hId-142408351%22%3E%3CA%3E%20%3C%2FA%3E%20Provisioning%20Shielded%20VMs%20using%20shielded%20templates%3C%2FH2%3E%3CBR%20%2F%3E%20In%20production%2C%20you%20would%20typically%20use%20a%20fabric%20manager%20(e.g.%20VMM)%20to%20deploy%20shielded%20VMs.%20However%2C%20the%20steps%20illustrated%20below%20allow%20you%20to%20deploy%20and%20validate%20the%20entire%20scenario%20without%20a%20fabric%20manager.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20In%20a%20nutshell%2C%20you%20will%20create%20a%20template%20disk%2C%20a%20shielding%20data%20file%2C%20a%20Windows%20unattend.xml%20file%20and%20other%20security%20artifacts%20on%20the%20tenant%20host%2C%20then%20copy%20these%20files%20to%20a%20guarded%20host%20and%20provision%20shielded%20VMs.%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId-1803853574%22%20id%3D%22toc-hId-1885218686%22%3EPrerequisites%3C%2FH2%3E%3CBR%20%2F%3E%20In%20order%20to%20create%20the%20template%20disk%20and%20the%20shielding%20data%20file%2C%20you%20will%20need%20to%20install%20the%20%E2%80%9CShielded%20VM%20Tools%E2%80%9D%20feature%20under%20the%20Remote%20Server%20Administration%20Tools%20-%26gt%3B%20Feature%20Administration%20Tools%20on%20the%20tenant%20host%20machine.%20You%20can%20do%20this%20either%20in%20Server%20Manager%20or%20by%20running%20the%20following%20cmdlet%3A%20%3CBR%20%2F%3E%20Install-WindowsFeature%20RSAT-Shielded-VM-Tools%20%3CBR%20%2F%3E%20Next%2C%20you%20will%20also%20need%20a%20VHDX%20file%20with%20a%20fully%20installed%20and%20sysprepped%20OS%E2%80%94we%E2%80%99ll%20call%20it%20ServerOS.vhdx.%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId--748303387%22%20id%3D%22toc-hId--666938275%22%3ECreate%20a%20signed%20template%20disk%3C%2FH2%3E%3CBR%20%2F%3E%20In%20order%20to%20create%20the%20signed%20template%20disk%2C%20you%20will%20need%20to%20have%20a%20certificate%20to%20sign%20it.%20For%20simplicity%2C%20let%E2%80%99s%20create%20a%20self-signed%20certificate%20for%20this%20purpose.%20%26nbsp%3BRun%20the%20following%20PowerShell%20commands%20on%20the%20tenant%20host%3A%20%3CBR%20%2F%3E%20%24cert%20%3D%20New-SelfSignedCertificate%20-DnsName%20'signing.contoso.com'%20%3CBR%20%2F%3E%20Now%2C%20we%20sign%20the%20disk%3A%20%3CBR%20%2F%3E%20Protect-TemplateDisk%20-Path%20%E2%80%98C%3A%5CServerOS.vhdx%E2%80%99%20-TemplateName%20%22ServerOSTemplate%22%20-Version%201.0.0.1%20-Certificate%20%24cert%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId-994506948%22%20id%3D%22toc-hId-1075872060%22%3ECreate%20Shielding%20Data%20(PDK)%20file%3C%2FH2%3E%3CBR%20%2F%3E%20Shielding%20Data%20is%20created%2Fowned%20by%20tenants%2FVM%20owners%20and%20contains%20secrets%20that%20must%20be%20protected%20from%20the%20fabric%20admin%20and%20that%20is%20needed%20to%20create%20shielded%20VMs%2C%20e.g.%20the%20shielded%20VM%E2%80%99s%20administrator%20password.%26nbsp%3B%20Shielding%20Data%20is%20contained%20in%20a%20PDK%20file%20which%20is%20also%20encrypted.%26nbsp%3B%20Once%20created%20by%20the%20tenant%2FVM%20owner%2C%20the%20resulting%20PDK%20file%20must%20be%20copied%20to%20the%20guarded%20fabric.%20The%20%3CA%20href%3D%22https%3A%2F%2Fgallery.technet.microsoft.com%2FShielded-VMs-and-Guarded-98d2b045%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%20deployment%20guide%20%3C%2FA%3E%20has%20much%20more%20detailed%20explanation%20of%20shielding%20data%20and%20why%20it%20is%20necessary.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20In%20addition%2C%20you%20will%20also%20need%20a%20Windows%20unattend.xml%20file%3B%20a%20working%20sample%20is%20also%20included%20in%20the%20%3CA%20href%3D%22https%3A%2F%2Fgallery.technet.microsoft.com%2FShielded-VMs-and-Guarded-98d2b045%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%20deployment%20guide%20%3C%2FA%3E%20.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20During%20deployment%2C%20you%20will%20need%20to%20import%20the%20HGS%20guardian%2C%20you%20can%20follow%20the%20steps%20described%20in%20the%20section%20above%20titled%20Retrieve%20the%20HGS%20guardian%E2%80%94it%20will%20be%20referenced%20as%20%E2%80%98C%3A%5CHGSGuardian.xml%E2%80%99%20below.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Run%20the%20following%20cmdlets%20on%20the%20tenant%20host%20to%20create%20the%20PDK%3A%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%5Bsnippet%20slug%3Dcreate-pdk%20lang%3Dbsh%5D%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId--1557650013%22%20id%3D%22toc-hId--1476284901%22%3EProvision%20shielded%20VM%20on%20a%20guarded%20host%3C%2FH2%3E%3CBR%20%2F%3E%20Copy%20the%20template%20disk%20file%20(ServerOS.vhdx)%20and%20the%20PDK%20file%20(contoso.pdk)%20to%20the%20guarded%20host%2C%20to%20get%20ready%20for%20deployment.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20The%20Windows%20unattend.xml%20file%20has%20some%20placeholder%20settings%20that%20need%20to%20be%20substituted%20during%20deployment%20to%20ensure%20the%20resulting%20VM%20is%20unique%20and%20fully%20configured%2C%20e.g.%20it%20contains%20a%20computer%20name%20and%20a%20timezone.%20These%20unique%20values%20are%20specified%20in%20a%20FSK%20(Fabric%20Specialization%20Key)%20file.%20To%20create%20one%2C%20run%20the%20following%20cmdlet%20on%20the%20guarded%20host%20to%20create%20the%20FSK%20file%2C%20and%20provision%20a%20shielded%20VM%20using%20the%20signed%20template%20disk%3A%20%3CBR%20%2F%3E%20%5Bsnippet%20slug%3Dcreating-shielded-vm-using-template-disk%20lang%3Dbsh%5D%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20While%20the%20shielded%20VM%20is%20being%20provisioned%2C%20you%20can%20use%20the%20following%20cmdlet%20to%20check%20the%20progress%3A%20%3CBR%20%2F%3E%20Get-ShieldedVMProvisioningStatus%20-VMName%20%24vmname%20%3CBR%20%2F%3E%20Once%20it%E2%80%99s%20completed%2C%20make%20sure%20the%20shielded%20VM%20has%20the%20correct%20Network%20Adapter%20configured%20so%20it%20can%20be%20accessed%20through%20RDP.%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId-185160322%22%20id%3D%22toc-hId-266525434%22%3ERunning%20Shielded%20VMs%20on%20a%20Hyper-V%20cluster%3C%2FH2%3E%3CBR%20%2F%3E%20If%20you%20are%20trying%20to%20deploy%20shielded%20VMs%20on%20clustered%20guarded%20hosts%20(using%20a%20Windows%20Failover%20Cluster)%2C%20you%20can%20configure%20the%20shielded%20VM%20to%20be%20highly%20available%20using%20the%20following%20cmdlet%3A%20%3CBR%20%2F%3E%20Add-ClusterVirtualMachineRole%20-VMName%20'contososvm1'%20-Cluster%20%3CGUARDED%20host%3D%22%22%20cluster%3D%22%22%20name%3D%22%22%3E%20%3CBR%20%2F%3E%20The%20shielded%20VM%20can%20now%20be%20live%20migrated%20within%20the%20cluster.%20%3CBR%20%2F%3E%3CH2%20id%3D%22toc-hId--1481720074%22%20id%3D%22toc-hId--1400354962%22%3EConclusion%3C%2FH2%3E%3CBR%20%2F%3E%20In%20summary%2C%20this%20blog%20post%20walked%20you%20through%20the%20steps%20to%20create%20shielded%20VMs%20without%20a%20fabric%20manager%20such%20as%20VMM.%20This%20enables%20you%20to%20deploy%20and%20validate%20the%20scenario%20with%20a%20simpler%20topology%20(at%20the%20expense%20of%20a%20more%20complex%20administration%20experience).%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20This%20scenario%20is%20new%20in%20Windows%20Server%202016%E2%80%94we%E2%80%99d%20love%20to%20hear%20your%20feedback.%20You%20can%20reach%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2FShieldedVMFeedback%40microsoft.com%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%20us%20%3C%2FA%3E%20%2C%20or%20submit%20and%20vote%20on%20request%20through%20the%20%3CA%20href%3D%22https%3A%2F%2Fwindowsserver.uservoice.com%2Fforums%2F295065-security-and-assurance%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%20User%20Voice%20web%20site%20%3C%2FA%3E%20.%3C%2FGUARDED%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-372218%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20TECHNET%20on%20Jun%2006%2C%202016%20Hi%2C%20I%E2%80%99m%20Jane%2C%20one%20of%20the%20newest%20members%20of%20the%20Windows%20Server%20Security%20Product%20Team.%3C%2FLINGO-TEASER%3E%3C%2FHGSSERVER%3E%3C%2FLINGO-BODY%3E
Microsoft
First published on TECHNET on Jun 06, 2016
Hi, I’m Jane, one of the newest members of the Windows Server Security Product Team. My very first hands-on experience is to deploy Shielded VMs with the minimum amount of hardware. It was fun and a great learning experience. I followed the comprehensive TP5 deployment guide on Shielded VM and Guarded Fabric guide with one deviation: I deployed it without VMM. If you are just like me, trying out the scenario end to end, this blog post will provide you the step by step instructions to use just the PowerShell cmdlets to create shielded VMs.

This blog post doesn’t cover any of the gory details or the building blocks for this scenario, etc.  For that, I highly recommend that you first read through the deployment guide which also covers terminology descriptions, scenario overview and architectural designs.

Prerequisites


Before you start, you should have completed the deployment of both the guarded host and the Host Guardian Service (HGS) server.  For your reference, you can follow the deploying HGS server blog to setup the HGS server as well as deploying guarded host guide to configure the guarded hosts.

As a way to quickly check and verify your deployment, run the following cmdlet on each guarded host:
Get-HGSClientConfiguration
The output of the cmdlet should display that IsHostGuarded is True, and AttestationStatus is Passed.

There are 2 ways to create shielded VMs:

  • Shielding an existing VM (a.k.a grandfathering)

  • Provisioning a shielded VM from a template


I’ll illustrate both approaches in this blog post.

Shielding an existing VM


Let’s start with the simpler approach. This requires you to have a running VM on a host which is not the guarded host. This is important to distinguish, because you are simulating the scenario where a tenant wants to take an existing, unprotected VM and shield it before moving it to a guarded host. For clarity, the host machine which is not the guarded host will be referred as the tenant host below. A shielded VM can only run on a trusted guarded host. The trust is established by the adding the HGS guardian (retrieved from the HGS server) to the Key Protector which is used to shield the VM. That way, the shielded VM can only be started after the guarded host successfully attest against the HGS server.

In this example, the running VM is named SVM . This VM must be generation 2 and have a supported OS installed with remote desktop enabled. You should verify the VM can be connected through RDP first, as it will almost certainly be the primary way to access the VM once it is shielded (unless you have installed other remoting capabilities).

Retrieve the HGS guardian


As explained above, the first step is to get the HGS guardian metadata from the HGS server, and use it to create the Key protector. To do this, run the following PowerShell command on a guarded host or any machine that can reach the HGS server:
Invoke-WebRequest http://<HGSServer">FQDN>/KeyProtection/service/metadata/2014-07/metadata.xml -OutFile C:\HGSGuardian.xml
Copy the file C:\HGSGuardian.xml to the tenant host.

Shield the VM


Each shielded VM has a Key Protector which contains one owner guardian, and one or more HGS guardians. The steps below illustrate the process of getting the guardians, create the Key Protector in order to shield the VM.

Run the following cmdlets on a tenant host:

[snippet slug=shield-a-vm-by-tenant-admin line_numbers=false lang=bsh]

Typically, you would logon to the VM and enable BitLocker before moving it to the guarded host. Since this is only for testing purposes, we’ll skip this step here.

To complete the process, perform the following steps:

  • shut down the shielded VM

  • export the VM from the tenant host

  • copy the exported file to the guarded host and import them

  • start the VM on the guarded host


As shown above, this approach is quite manual and easy to make mistakes (such as not running BitLocker to encrypt data). Therefore, it is not recommended in production. For that, you should use the second approach illustrated in the following section: Provisioning Shielded VMs using the template disk.

Provisioning Shielded VMs using shielded templates


In production, you would typically use a fabric manager (e.g. VMM) to deploy shielded VMs. However, the steps illustrated below allow you to deploy and validate the entire scenario without a fabric manager.

In a nutshell, you will create a template disk, a shielding data file, a Windows unattend.xml file and other security artifacts on the tenant host, then copy these files to a guarded host and provision shielded VMs.

Prerequisites


In order to create the template disk and the shielding data file, you will need to install the “Shielded VM Tools” feature under the Remote Server Administration Tools -> Feature Administration Tools on the tenant host machine. You can do this either in Server Manager or by running the following cmdlet:
Install-WindowsFeature RSAT-Shielded-VM-Tools
Next, you will also need a VHDX file with a fully installed and sysprepped OS—we’ll call it ServerOS.vhdx.

Create a signed template disk


In order to create the signed template disk, you will need to have a certificate to sign it. For simplicity, let’s create a self-signed certificate for this purpose.  Run the following PowerShell commands on the tenant host:
$cert = New-SelfSignedCertificate -DnsName 'signing.contoso.com'
Now, we sign the disk:
Protect-TemplateDisk -Path ‘C:\ServerOS.vhdx’ -TemplateName "ServerOSTemplate" -Version 1.0.0.1 -Certificate $cert

Create Shielding Data (PDK) file


Shielding Data is created/owned by tenants/VM owners and contains secrets that must be protected from the fabric admin and that is needed to create shielded VMs, e.g. the shielded VM’s administrator password.  Shielding Data is contained in a PDK file which is also encrypted.  Once created by the tenant/VM owner, the resulting PDK file must be copied to the guarded fabric. The deployment guide has much more detailed explanation of shielding data and why it is necessary.

In addition, you will also need a Windows unattend.xml file; a working sample is also included in the deployment guide .

During deployment, you will need to import the HGS guardian, you can follow the steps described in the section above titled Retrieve the HGS guardian—it will be referenced as ‘C:\HGSGuardian.xml’ below.

Run the following cmdlets on the tenant host to create the PDK:

[snippet slug=create-pdk lang=bsh]

Provision shielded VM on a guarded host


Copy the template disk file (ServerOS.vhdx) and the PDK file (contoso.pdk) to the guarded host, to get ready for deployment.

The Windows unattend.xml file has some placeholder settings that need to be substituted during deployment to ensure the resulting VM is unique and fully configured, e.g. it contains a computer name and a timezone. These unique values are specified in a FSK (Fabric Specialization Key) file. To create one, run the following cmdlet on the guarded host to create the FSK file, and provision a shielded VM using the signed template disk:
[snippet slug=creating-shielded-vm-using-template-disk lang=bsh]

While the shielded VM is being provisioned, you can use the following cmdlet to check the progress:
Get-ShieldedVMProvisioningStatus -VMName $vmname
Once it’s completed, make sure the shielded VM has the correct Network Adapter configured so it can be accessed through RDP.

Running Shielded VMs on a Hyper-V cluster


If you are trying to deploy shielded VMs on clustered guarded hosts (using a Windows Failover Cluster), you can configure the shielded VM to be highly available using the following cmdlet:
Add-ClusterVirtualMachineRole -VMName 'contososvm1' -Cluster <guarded host cluster name>
The shielded VM can now be live migrated within the cluster.

Conclusion


In summary, this blog post walked you through the steps to create shielded VMs without a fabric manager such as VMM. This enables you to deploy and validate the scenario with a simpler topology (at the expense of a more complex administration experience).

This scenario is new in Windows Server 2016—we’d love to hear your feedback. You can reach us , or submit and vote on request through the User Voice web site .