%3CLINGO-SUB%20id%3D%22lingo-sub-1612704%22%20slang%3D%22en-US%22%3ERe%3A%20How%20To%20Block%20Azure%20VHD%20Download%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1612704%22%20slang%3D%22en-US%22%3E%3CP%3EGreat%20topic%20for%20learning%20.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1609898%22%20slang%3D%22en-US%22%3EHow%20To%20Block%20Azure%20VHD%20Download%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1609898%22%20slang%3D%22en-US%22%3E%3CH2%20id%3D%22toc-hId--1272332690%22%20id%3D%22toc-hId--1272332690%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22It%20Security%20Team.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F226197i01FCE960A3AE30D7%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22It%20Security%20Team.png%22%20alt%3D%22It%20Security%20Team.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FH2%3E%3CH2%20id%3D%22toc-hId-1215180143%22%20id%3D%22toc-hId-1215180143%22%3EAbstract%3C%2FH2%3E%3CP%3EEncryption%20of%20Azure%20VM%20disk%20is%20a%20vast%20topic%20and%20an%20important%20one.%20Especially%20if%20you%20are%20a%20bank%20then%20your%20info%20security%20team%20is%20going%20to%20ensure%20that%20this%20recommendation%20is%20enforced%20without%20any%20exceptions.%20I%20have%20been%20working%20with%20a%20few%20leading%20banks%20in%20India%26nbsp%3B%20and%20encryption%20of%20Azure%20VM%20disk%20is%20one%20of%20the%20longest%20discussed%20topic%2C%20that%20I%20have%20experienced%20in%20recent%20times.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhile%20you%20encrypt%20the%20disk%20of%20Azure%20VM%20using%20either%20%E2%80%9CStorage%20%5BServer%5D%20side%20encryption%E2%80%9D%20or%20%E2%80%9CAzure%20Disk%20Encryption%E2%80%9D%3B%20security%20teams%20are%20always%20paranoid%20about%20the%20following%20point%20%E2%80%93%3C%2FP%3E%3CP%3E%E2%80%9CWhat%20if%20someone%20downloads%20my%20VHD%20from%20Azure%20portal%3F%20How%20do%20I%20protect%20my%20data%3F%E2%80%9D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWell%20this%20blog%20is%20an%20answer%20to%20above%20question!%20So%20Let%20us%20start%20with%20some%20background%20on%20encryption%20and%20understand%20why%20customers%20or%20security%20teams%20may%20ask%20to%20block%20the%20VHD%20download.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CH2%20id%3D%22toc-hId--592274320%22%20id%3D%22toc-hId--592274320%22%3EWhy%20security%20team%20need%20to%20block%20VHD%20Download%3F%3C%2FH2%3E%3CP%3EEncryption%20of%20Azure%20VM%20disk%20is%20possible%20in%20two%20ways%20%E2%80%93%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%3C%2FP%3E%3COL%3E%3CLI%3EServer%20Side%20Encryption%3C%2FLI%3E%3CLI%3EAzure%20Disk%20Encryption%3C%2FLI%3E%3C%2FOL%3E%3CP%3EServer%20side%20encryption%20%5Ba.k.a.%20Storage%20Side%20Encryption%20%E2%80%93%20hereafter%20referred%20as%20SSE%5D%20should%20suffice%20the%20organization%20security%20needs%20in%20most%20of%20the%20cases.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20most%20common%20question%20I%20have%20seen%20is%20below%20%E2%80%93%3C%2FP%3E%3CP%3E%3CSTRONG%3EQuestion%3C%2FSTRONG%3E%3A%20If%20my%20Azure%20VM%20is%20encrypted%20using%20SSE%20and%20if%20I%20download%20the%20VHD%20and%20map%20this%20VHD%20to%20a%20VM%20as%20OS%20or%20data%20disk%2C%20will%20the%20disk%20be%20encrypted%20and%20data%20on%20it%20non%20readable%3F%3C%2FP%3E%3CP%3E%3CSTRONG%3EAnswer%3C%2FSTRONG%3E%3A%20No.%20As%20soon%20as%20the%20data%20leaves%20the%20boundary%20of%20underlying%20storage%2C%20it%20is%20decrypted.%20Hence%20if%20you%20provision%20VM%20vhd%20or%20data%20disk%20vhd%20after%20download%2C%20the%20data%20will%20be%20readable.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EReference%20blog%20post%20mentioning%20this%20is%20here%20-%20%3CA%20title%3D%22https%3A%2F%2Fwww.sanganakauthority.com%2F2020%2F01%2Fazure-vm-disk-encryption-storage-side.html%22%20href%3D%22https%3A%2F%2Fwww.sanganakauthority.com%2F2020%2F01%2Fazure-vm-disk-encryption-storage-side.html%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.sanganakauthority.com%2F2020%2F01%2Fazure-vm-disk-encryption-storage-side.html.%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20triggers%20the%20requirement%20of%20%E2%80%9CWhy%20do%20we%20want%20to%20restrict%20Azure%20VM%20VHD%20download%3F%E2%80%9D.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20way%20customer%20organization%20can%20avoid%20Azure%20Disk%20Encryption%20using%20Bitlocker%20or%20DMCrypt%20%5Bhereafter%20referred%20as%20ADE%5D%20and%20especially%20avoid%20complexities%20involved%20in%20the%20implementation%20and%20management.%20Here%20I%20am%20not%20saying%20ADE%20is%20bad.%20It%20is%20still%20best%20way%20to%20encrypt.%20However%20if%20customer%20is%20interested%20in%20avoiding%20operational%20overheads%20in%20ADE%2C%20then%20SSE%20is%20really%20handy.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20SSE%20is%20used%20then%20data%20theft%20is%20still%20possible%20if%20the%20downloaded%20VHD%20gets%20into%20the%20wrong%20hands.%20Therefore%20it%20becomes%20necessary%20necessary%20to%20completely%20block%20the%20download%20option%20from%20the%20Azure%20portal%26nbsp%3Bfor%20extra%20sensitive%20data%20VHD%E2%80%99s.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CH2%20id%3D%22toc-hId-1895238513%22%20id%3D%22toc-hId-1895238513%22%3EHow%20do%20I%20block%20Azure%20VM%20VHD%20download%3F%3C%2FH2%3E%3CP%3EIt%20would%20have%20been%20really%20easy%20if%20we%20can%20put%20up%20an%20%E2%80%9CAzure%20Policy%E2%80%9D%20at%20the%20subscription%20level%20to%20block%20the%20VHD%20download.%20Unfortunately%20there%20is%20no%20such%20in-built%20policy.%20We%20can%20go%20down%20the%20path%20of%20building%20a%20custom%20policy%20but%20I%20have%20already%20tried%20it%2C%20without%20success.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EImportant%20aspect%20for%20policy%20is%20about%20having%20an%20%E2%80%9CAction%E2%80%9D%20in%20policy.%20However%20%E2%80%9CActions%E2%80%9D%20in%20Azure%20policy%20is%20a%20legacy%20syntax%20and%20as%20of%20today%20it%20supports%20only%20%E2%80%9Cwrite%E2%80%9D%20action.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFor%20VHD%20download%20we%20will%20have%20to%20use%20%E2%80%9CAction%E2%80%9D%20equals%20to%20%E2%80%9C%3CEM%3EMicrosoft.Compute%2Fdisks%2FbeginGetAccess%2Faction%3C%2FEM%3E%E2%80%9D%26nbsp%3Bwhich%20is%20not%20a%20write%20action%20and%20hence%20we%20can%E2%80%99t%20achieve%20this%20using%20Azure%20policy.%20I%20think%20%E2%80%9CActions%E2%80%9D%20suits%20better%20in%20RBAC%20section%20as%20they%20reflect%20permissions%20for%20users%20to%20execute%20certain%20action.%20Hence%20we%20will%20need%20to%20implement%20%E2%80%9Cblock%20VHD%20download%E2%80%9D%20using%20RBAC.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CH2%20id%3D%22toc-hId-87784050%22%20id%3D%22toc-hId-87784050%22%3EImplementing%20RBAC%20for%20restricting%20Azure%20VHD%20download%3C%2FH2%3E%3CP%3EThe%20download%20permissions%20on%20the%20Azure%20VM%20disk%20is%20assigned%20through%20RBAC%20setting%20%E2%80%9C%3CA%20href%3D%22https%3A%2F%2Fnam06.safelinks.protection.outlook.com%2F%3Furl%3Dhttps%253A%252F%252Fdocs.microsoft.com%252Fen-us%252Frest%252Fapi%252Fcompute%252Fdisks%252Fgrantaccess%26amp%3Bdata%3D02%257C01%257CKunal.Chandratre%2540microsoft.com%257C97eec00e98ba48ef6e1b08d79f746004%257C72f988bf86f141af91ab2d7cd011db47%257C1%257C0%257C637153194993258257%26amp%3Bsdata%3DJYBMc%252B9LWmmoVLXODtvBoi5IEZ7D8T2io5J9mvTVIoQ%253D%26amp%3Breserved%3D0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3EMicrosoft.Compute%2Fdisks%2FbeginGetAccess%2Faction%3C%2FA%3E%E2%80%9D.%20So%20if%20we%20restrict%20this%20access%20in%20an%20Azure%20custom%20role%20we%20should%20be%20able%20to%20achieve%20%E2%80%9Crestrict%20Azure%20VM%20disk%20download%E2%80%9D%20option%20.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20define%20an%20Azure%20custom%20role%20it%20is%20always%20a%20good%20start%20to%20use%20any%20existing%20Azure%20built%20in%20role.%20For%20our%20requirement%20%E2%80%9CContributor%E2%80%9D%20roles%20seems%20to%20be%20best%20fit.%20I%20found%20out%20contributor%20role%20as%20shown%20below%20from%20Azure%20portal.%20To%20create%20custom%20role%20with%20%E2%80%9CVHD%20download%20deny%E2%80%9D%20permission%3B%20clone%20this%20role%20as%20shown%20below%20-%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22VM%20Contributor.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F214597i50EE09F32AD47207%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22VM%20Contributor.png%22%20alt%3D%22Clone%20Azure%20built%20Role%20of%20Contributor%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EClone%20Azure%20built%20Role%20of%20Contributor%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOn%20the%20basic%20information%20of%20Clone%20windows%2C%20enter%20information%20as%20shown%20below.%20%E2%80%9CCustom%20role%20name%E2%80%9D%20can%20be%20of%20your%20choice.%20Then%20click%20on%20Next.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Basics.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F214823iD0447A48F97F6E1C%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Basics.png%22%20alt%3D%22Create%20custom%20role%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3ECreate%20custom%20role%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20will%20see%20Permissions%20tab%20with%20first%20permission%20with%20%E2%80%9C*%E2%80%9D%20which%20means%20that%20the%20Contributor%20role%20has%20access%20to%20almost%20all%20operations%20on%20Azure%20portal%2C%20except%20that%20the%20Contributor%20can%E2%80%99t%20assign%20a%20role%20to%20any%20other%20user.%3C%2FP%3E%3CP%3EOn%20the%20permissions%20tab%20itself%20we%20will%20need%20to%20%E2%80%9Cdeny%20VHD%20download%E2%80%9D%20option.%20Therefore%20on%20Permissions%20tab%20click%20on%20%E2%80%9CExclude%20Permissions%E2%80%9D%20as%20shown%20below%20%E2%80%93%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Exclude%20permissions.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F214600iF0408EC340591FBF%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Exclude%20permissions.png%22%20alt%3D%22Click%20on%20Exclude%20Permissions%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EClick%20on%20Exclude%20Permissions%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThen%20search%20for%20%E2%80%9Cdisk%E2%80%9D%20and%20select%20Compute%20resource%20provider%20as%20shown%20below%20%E2%80%93%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22compute.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F214602i916E82D890B43088%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22compute.png%22%20alt%3D%22Select%20Compute%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3ESelect%20Compute%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EUnder%20Microsoft.Compute%20permissions%20screen%20search%20for%20option%20%E2%80%9C%3CSPAN%3EOther%3C%2FSPAN%3E%26nbsp%3B%3CSPAN%3E%3CSPAN%3E%3A%20Get%20Disk%20SAS%20URI%E2%80%9D%20%3C%2FSPAN%3E%3C%2FSPAN%3Eunder%20%3CSPAN%3EMicrosoft.Compute%2Fdisks%20%3C%2FSPAN%3Eas%20shown%20below.%20Select%20the%20checkbox%20against%20it%20and%20click%20on%20Add.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22noSas.png%22%20style%3D%22width%3A%20987px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F214603iD180AC25E0389996%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22noSas.png%22%20alt%3D%22Other%26nbsp%3B%3A%20Get%20Disk%20SAS%20URI%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EOther%26nbsp%3B%3A%20Get%20Disk%20SAS%20URI%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAfter%20this%20you%20will%20see%20an%20action%20%E2%80%9CMicrosoft.Compute%2Fdisks%2FbeginGetAccess%2Faction%E2%80%9D%20is%20added%20in%20NotAction%20as%20shown%20below%20%E2%80%93%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22NoAction.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F214604i3C5051C22F31F704%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22NoAction.png%22%20alt%3D%22Verify%20Other%26nbsp%3B%3A%20Get%20Disk%20SAS%20URI%20check%20is%20successful%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EVerify%20Other%26nbsp%3B%3A%20Get%20Disk%20SAS%20URI%20check%20is%20successful%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThen%20click%20on%20%E2%80%9CReview%20%2B%20Create%E2%80%9D%20option%20and%20then%20click%20on%20%E2%80%9CCreate%E2%80%9D%20to%20have%20this%20role%20created%20under%20your%20subscription.%20You%20can%20find%20this%20role%20as%20below%20to%20check%20if%20role%20addition%20is%20successful.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22kunal.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F214605i3EFEAB1452DFF8C0%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22kunal.png%22%20alt%3D%22Verify%20if%20role%20is%20created%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EVerify%20if%20role%20is%20created%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThen%20click%20on%20%E2%80%9Cadd%E2%80%9D%20to%20assign%20this%20custom%20role%20to%20a%20user%20of%20your%20choice.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CH2%20id%3D%22toc-hId--1719670413%22%20id%3D%22toc-hId--1719670413%22%3EVerifying%20of%20denying%20Azure%20VM%20VHD%20download%3C%2FH2%3E%3CP%3EAfter%20successful%20role%20assignment%2C%20login%20to%20Azure%20portal%20with%20the%20credentials%20of%20the%20user%20who%20has%20been%20assigned%20the%20custom%20role.%20Open%20any%20Virtual%20Machine%20from%20the%20portal%20and%20go%20to%20Disks%20-%26gt%3B%20Click%20on%20OS%20disk%20Name.%20the%20click%20on%20%E2%80%9CDisk%20Export%E2%80%9D%20option%20and%20click%20on%20Generate%20URL%20button.%20This%20button%20actually%20generates%20the%20SAS%20URL%20which%20can%20be%20used%20to%20download%20Azure%20VM%20disk%20from%20Azure%20portal.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20now%20when%20you%20click%20on%20%E2%80%9CGenerate%20URL%E2%80%9D%20button%2C%20you%20will%20see%20an%20error%20message%20preventing%20you%20from%20generating%20SAS%20URL%20to%20download%20the%20vhd%26nbsp%3B%20%E2%80%93%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Download%20denied.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F214607i0FC14CD32247F75B%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Download%20denied.png%22%20alt%3D%22VHD%20Download%20is%20restricted%20by%20RBAC%20role%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EVHD%20Download%20is%20restricted%20by%20RBAC%20role%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20is%20how%20you%20can%20restrict%20Azure%20VM%20disk%20download%20from%20the%20Azure%20portal%20using%20custom%20RBAC.%3C%2FP%3E%3CH2%20id%3D%22toc-hId-767842420%22%20id%3D%22toc-hId-767842420%22%3EConclusion%3C%2FH2%3E%3CP%3EHope%20this%20post%20helps%20you%20in%20improving%20the%20security%20posture%20by%20adding%20an%20extra%20layer%20of%20security%20over%20SSE%20disk%20encryption.%3C%2FP%3E%3CP%3EIf%20you%20are%20more%20interested%20to%20know%20about%20Azure%20Disk%20encryption%20frequently%20asked%20real%20world%20questions%20then%20visit%20%3CA%20href%3D%22https%3A%2F%2Fwww.sanganakauthority.com%2F2020%2F01%2Fazure-vm-disk-encryption-storage-side.html%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1609898%22%20slang%3D%22en-US%22%3E%3CP%3EBank's%20Security%20teams%20love%20it.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22It%20Security%20Team.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F214582i75A20741EAD81502%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22It%20Security%20Team.png%22%20alt%3D%22It%20Security%20Team.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1609898%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Eazure%20virtual%20machines%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EIndia%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EInfrastructure%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Senior Member

It Security Team.png

Abstract

Encryption of Azure VM disk is a vast topic and an important one. Especially if you are a bank then your info security team is going to ensure that this recommendation is enforced without any exceptions. I have been working with a few leading banks in India  and encryption of Azure VM disk is one of the longest discussed topic, that I have experienced in recent times.

 

While you encrypt the disk of Azure VM using either “Storage [Server] side encryption” or “Azure Disk Encryption”; security teams are always paranoid about the following point –

“What if someone downloads my VHD from Azure portal? How do I protect my data?”

 

Well this blog is an answer to above question! So Let us start with some background on encryption and understand why customers or security teams may ask to block the VHD download.

 

Why security team need to block VHD Download?

Encryption of Azure VM disk is possible in two ways –     

  1. Server Side Encryption
  2. Azure Disk Encryption

Server side encryption [a.k.a. Storage Side Encryption – hereafter referred as SSE] should suffice the organization security needs in most of the cases.

 

The most common question I have seen is below –

Question: If my Azure VM is encrypted using SSE and if I download the VHD and map this VHD to a VM as OS or data disk, will the disk be encrypted and data on it non readable?

Answer: No. As soon as the data leaves the boundary of underlying storage, it is decrypted. Hence if you provision VM vhd or data disk vhd after download, the data will be readable.

 

Reference blog post mentioning this is here - https://www.sanganakauthority.com/2020/01/azure-vm-disk-encryption-storage-side.html.

 

This triggers the requirement of “Why do we want to restrict Azure VM VHD download?”.

 

This way customer organization can avoid Azure Disk Encryption using Bitlocker or DMCrypt [hereafter referred as ADE] and especially avoid complexities involved in the implementation and management. Here I am not saying ADE is bad. It is still best way to encrypt. However if customer is interested in avoiding operational overheads in ADE, then SSE is really handy.

 

If SSE is used then data theft is still possible if the downloaded VHD gets into the wrong hands. Therefore it becomes necessary necessary to completely block the download option from the Azure portal for extra sensitive data VHD’s.

 

How do I block Azure VM VHD download?

It would have been really easy if we can put up an “Azure Policy” at the subscription level to block the VHD download. Unfortunately there is no such in-built policy. We can go down the path of building a custom policy but I have already tried it, without success.

 

Important aspect for policy is about having an “Action” in policy. However “Actions” in Azure policy is a legacy syntax and as of today it supports only “write” action.

 

For VHD download we will have to use “Action” equals to “Microsoft.Compute/disks/beginGetAccess/action” which is not a write action and hence we can’t achieve this using Azure policy. I think “Actions” suits better in RBAC section as they reflect permissions for users to execute certain action. Hence we will need to implement “block VHD download” using RBAC.

 

Implementing RBAC for restricting Azure VHD download

The download permissions on the Azure VM disk is assigned through RBAC setting “Microsoft.Compute/disks/beginGetAccess/action”. So if we restrict this access in an Azure custom role we should be able to achieve “restrict Azure VM disk download” option .

 

To define an Azure custom role it is always a good start to use any existing Azure built in role. For our requirement “Contributor” roles seems to be best fit. I found out contributor role as shown below from Azure portal. To create custom role with “VHD download deny” permission; clone this role as shown below -

 

Clone Azure built Role of ContributorClone Azure built Role of Contributor

 

On the basic information of Clone windows, enter information as shown below. “Custom role name” can be of your choice. Then click on Next.

Create custom roleCreate custom role

 

You will see Permissions tab with first permission with “*” which means that the Contributor role has access to almost all operations on Azure portal, except that the Contributor can’t assign a role to any other user.

On the permissions tab itself we will need to “deny VHD download” option. Therefore on Permissions tab click on “Exclude Permissions” as shown below –

 

Click on Exclude PermissionsClick on Exclude Permissions

 

Then search for “disk” and select Compute resource provider as shown below –

 

Select ComputeSelect Compute

 

Under Microsoft.Compute permissions screen search for option “Other : Get Disk SAS URI” under Microsoft.Compute/disks as shown below. Select the checkbox against it and click on Add.

 

Other : Get Disk SAS URIOther : Get Disk SAS URI

 

After this you will see an action “Microsoft.Compute/disks/beginGetAccess/action” is added in NotAction as shown below –

 

Verify Other : Get Disk SAS URI check is successfulVerify Other : Get Disk SAS URI check is successful

 

Then click on “Review + Create” option and then click on “Create” to have this role created under your subscription. You can find this role as below to check if role addition is successful.

 

Verify if role is createdVerify if role is created

 

Then click on “add” to assign this custom role to a user of your choice.

 

Verifying of denying Azure VM VHD download

After successful role assignment, login to Azure portal with the credentials of the user who has been assigned the custom role. Open any Virtual Machine from the portal and go to Disks -> Click on OS disk Name. the click on “Disk Export” option and click on Generate URL button. This button actually generates the SAS URL which can be used to download Azure VM disk from Azure portal.

 

But now when you click on “Generate URL” button, you will see an error message preventing you from generating SAS URL to download the vhd  –

 

VHD Download is restricted by RBAC roleVHD Download is restricted by RBAC role

 

This is how you can restrict Azure VM disk download from the Azure portal using custom RBAC.

Conclusion

Hope this post helps you in improving the security posture by adding an extra layer of security over SSE disk encryption.

If you are more interested to know about Azure Disk encryption frequently asked real world questions then visit here.

 

1 Comment
Occasional Visitor

Great topic for learning .