Step by step guide on computer account auth for Azure Files

%3CLINGO-SUB%20id%3D%22lingo-sub-1855164%22%20slang%3D%22en-US%22%3EStep%20by%20step%20guide%20on%20computer%20account%20auth%20for%20Azure%20Files%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1855164%22%20slang%3D%22en-US%22%3E%3CH1%20id%3D%22toc-hId-585656748%22%20id%3D%22toc-hId-585656748%22%20id%3D%22toc-hId-585656748%22%20id%3D%22toc-hId-585656748%22%20id%3D%22toc-hId-585656748%22%20id%3D%22toc-hId-585656748%22%3EStep%20by%20step%20guide%20on%20computer%20account%20auth%20for%20Azure%20Files%3C%2FH1%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20the%20last%203%20weeks%2C%20I%20have%20been%20getting%20a%20lot%20of%20questions%20around%20Azure%20Files.%20The%20main%20question%20has%20been%20%E2%80%9CCan%20computer%20accounts%20have%20access%20Azure%20Files%3F%E2%80%9D.%20This%20combined%20with%20my%20work%20on%20MSIX%20app%20attach%20(which%20also%20uses%20Azure%20Files)%20has%20prompted%20the%20creation%20of%20this%20post.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1276218222%22%20id%3D%22toc-hId-1276218222%22%20id%3D%22toc-hId-1276218222%22%20id%3D%22toc-hId-1276218222%22%20id%3D%22toc-hId-1276218222%22%20id%3D%22toc-hId-1276218222%22%3EPrerequisites%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAzure%20Files%20supports%20multiple%20authentication%20mechanisms.%20This%20article%20is%20focused%20on%20authenticating%20with%3C%2FP%3E%0A%3CP%3EAD%20DS%2C%20as%20described%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fstorage%2Ffiles%2Fstorage-files-identity-ad-ds-enable%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%20Hence%20the%20prerequisites%20are%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EAD%20DS%20synched%20to%20Azure%20AD%3C%2FLI%3E%0A%3CLI%3EPermissions%20to%20create%20a%20Group%20in%20AD%20DS%3C%2FLI%3E%0A%3CLI%3EStorage%20account%20or%20enough%20permissions%20to%20create%20one%3C%2FLI%3E%0A%3CLI%3EVM%20or%20physical%20machine%20joined%20to%20AD%20DS%2C%20and%20permissions%20to%20access%20it%3C%2FLI%3E%0A%3CLI%3EWVD%20host%20pool%20in%20which%20all%20session%20hosts%20have%20been%20domain%20joined%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--531236241%22%20id%3D%22toc-hId--531236241%22%20id%3D%22toc-hId--531236241%22%20id%3D%22toc-hId--531236241%22%20id%3D%22toc-hId--531236241%22%20id%3D%22toc-hId--531236241%22%3EProcess%20overview%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E1.%20Create%20AD%20DS%20security%20group.%20%3CBR%20%2F%3E2.%20Add%20the%20computer%20accounts%20for%20all%20session%20hosts%20as%20members%20of%20the%20group%3CBR%20%2F%3E3.%20Synch%20AD%20DS%20group%20to%20Azure%20AD%3CBR%20%2F%3E4.%20Create%20storage%20account%20%3CBR%20%2F%3E5.%20Create%20file%20share%20under%20the%20storage%20account%20%3CBR%20%2F%3E6.%20Join%20storage%20account%20to%20AD%20DS%20%3CBR%20%2F%3E7.%20Assign%20the%20AD%20DS%20group%20that%20has%20been%20synched%20to%20Azure%20AD%2C%20the%20%3CSTRONG%3EStorage%20File%20Data%20SMB%20Share%20Contributor%3C%2FSTRONG%3E%20role%20assignment%20on%20the%20storage%20account%3CBR%20%2F%3E8.%20Mount%20file%20share%20on%20any%20session%20host%20%3CBR%20%2F%3E9.%20Grant%20NTFS%20permissions%20on%20the%20file%20share%20to%20the%20AD%20DS%20group%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1956276592%22%20id%3D%22toc-hId-1956276592%22%20id%3D%22toc-hId-1956276592%22%20id%3D%22toc-hId-1956276592%22%20id%3D%22toc-hId-1956276592%22%20id%3D%22toc-hId-1956276592%22%3ECreate%20Group%20in%20AD%20DS%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20group%20will%20be%20used%20in%20later%20steps%20to%20grant%20share%20level%20and%20(files%20share)%20permissions.%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3ERemote%20into%20the%20VM%20or%20physical%20machine%20joined%20to%20AD%20DS.%3C%2FLI%3E%0A%3CLI%3EOpen%20the%20%3CSTRONG%3EActive%20Directory%20Users%20and%20Computers%3C%2FSTRONG%3E%20utility.%3C%2FLI%3E%0A%3CLI%3EUnder%20the%20domain%20node%20right%20click%20and%20select%20%3CSTRONG%3ENew%3C%2FSTRONG%3E%2C%20and%20then%20%3CSTRONG%3EGroup%3C%2FSTRONG%3E.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSTRONG%3ENote%3C%2FSTRONG%3E%3A%20it%20is%20not%20mandatory%20to%20create%20a%20new%20group%2C%20an%20existing%20group%20can%20be%20used.%3C%2FP%3E%0A%3COL%20start%3D%224%22%3E%0A%3CLI%3EIn%20the%20%3CSTRONG%3ENew%20Object%20%E2%80%93%20Group%20%3C%2FSTRONG%3Eenter%20group%20name%20and%20select%3A%3COL%20class%3D%22lia-list-style-type-lower-alpha%22%3E%0A%3CLI%3EGroup%20scope%3A%20Global%3C%2FLI%3E%0A%3CLI%3EGroup%20type%3A%20Security%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3C%2FLI%3E%0A%3CLI%3ERight%20click%20on%20the%20new%20group%20and%20select%20%3CSTRONG%3EProperties.%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3EIn%20the%20properties%20screen%20select%20the%20%3CSTRONG%3EMembers%20%3C%2FSTRONG%3Etab.%3C%2FLI%3E%0A%3CLI%3EClick%20%3CSTRONG%3EAdd%E2%80%A6%20%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3EIn%20the%20%3CSTRONG%3ESelect%20Users%2C%20Contacts%2C%20Computers%2C%20Service%20Accounts%2C%20or%20Groups%20%3C%2FSTRONG%3Edialog%20click%20%3CSTRONG%3EObject%20Types%E2%80%A6%20%3C%2FSTRONG%3Eand%20select%20%3CSTRONG%3EComputers.%20%3C%2FSTRONG%3EClick%20%3CSTRONG%3EOK.%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3EIn%20the%20%3CSTRONG%3EEnter%20the%20object%20names%20to%20select%20%3C%2FSTRONG%3Eenter%20the%20names%20of%20all%20session%20hosts.%3C%2FLI%3E%0A%3CLI%3EClick%20%3CSTRONG%3ECheck%20Names%20%3C%2FSTRONG%3Eand%20if%20multiple%20entries%20are%20present%20select%20the%20%E2%80%9Ccorrect%E2%80%9D%20one%20from%20the%20results%20dialog.%3C%2FLI%3E%0A%3CLI%3EPress%20%3CSTRONG%3EOk%20%3C%2FSTRONG%3Eand%20then%20%3CSTRONG%3EApply.%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSTRONG%3ENote%3A%20%3C%2FSTRONG%3EIf%20this%20is%20a%20new%20group%20it%20may%20take%20up%20to%201%20hour%20to%20sync%20with%20Azure%20AD.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-148822129%22%20id%3D%22toc-hId-148822129%22%20id%3D%22toc-hId-148822129%22%20id%3D%22toc-hId-148822129%22%20id%3D%22toc-hId-148822129%22%20id%3D%22toc-hId-148822129%22%3ECreate%20storage%20account%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFor%20brevity%20we%20will%20assume%20there%20is%20already%20a%20storage%20account%20with%20a%20file%20share.%20If%20required%2C%20please%20reference%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fstorage%2Fcommon%2Fstorage-account-create%3Ftoc%3D%252Fazure%252Fstorage%252Fblobs%252Ftoc.json%26amp%3Btabs%3Dazure-portal%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ethis%3C%2FA%3E%20article%20on%20how%20to%20create%20storage%20accounts.%20If%20you%E2%80%99re%20creating%20a%20new%20storage%20account%2C%20it%20is%20mandatory%20to%20create%20a%20file%20share.%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ENote%3A%20%3C%2FSTRONG%3Eif%20you%20are%20creating%20a%20%3CSTRONG%3EPremium%20%3C%2FSTRONG%3Estorage%20account%20make%20sure%20%3CSTRONG%3EAccount%20Kind%20%3C%2FSTRONG%3Eis%20set%20to%20%3CSTRONG%3EFileStorage.%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1658632334%22%20id%3D%22toc-hId--1658632334%22%20id%3D%22toc-hId--1658632334%22%20id%3D%22toc-hId--1658632334%22%20id%3D%22toc-hId--1658632334%22%20id%3D%22toc-hId--1658632334%22%3EShare-level%20permission%20aka%20RBAC%20permission%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3ESelect%20the%20desired%20storage%20account%3C%2FLI%3E%0A%3CLI%3EClick%20%3CSTRONG%3EAccess%20Control%20(IAM)%20%3C%2FSTRONG%3Eand%20then%20%3CSTRONG%3EAdd.%20%3C%2FSTRONG%3EFrom%20the%20drop%20down%20select%20%3CSTRONG%3EAdd%20role%20assignments.%20%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3EIn%20the%20%3CSTRONG%3EAdd%20role%20assignment%20%3C%2FSTRONG%3Escreen%3A%3COL%20class%3D%22lia-list-style-type-lower-alpha%22%3E%0A%3CLI%3ERole%3A%20%3CSTRONG%3EStorage%20File%20Data%20SMB%20Share%20Contributor%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3EAssign%20access%20to%3A%20%3CSTRONG%3EUser%2C%20Group%2C%20or%20Service%20Principal%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3ESubscription%3A%20%3CSTRONG%3EBased%20on%20your%20environment%20%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3ESelect%3A%20%3CSTRONG%3Epick%20the%20AD%20group%20that%20you%20created%20which%20contains%20your%20session%20hosts%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3C%2FLI%3E%0A%3CLI%3EClick%20%3CSTRONG%3ESave%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-828880499%22%20id%3D%22toc-hId-828880499%22%20id%3D%22toc-hId-828880499%22%20id%3D%22toc-hId-828880499%22%20id%3D%22toc-hId-828880499%22%20id%3D%22toc-hId-828880499%22%3EJoin%20storage%20account%20to%20AD%20DS%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20this%20step%20we%20are%20going%20to%20join%20our%20storage%20account%20to%20AD%20DS.%20The%20full%20article%20is%20available%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure-Samples%2Fazure-files-samples%2Freleases%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%20Please%20note%20our%20steps%20here%20have%20been%20modified%20to%20achieve%20the%20desired%20scenario.%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3ERemote%20into%20the%20VM%20or%20physical%20machine%20joined%20to%20AD%20DS%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSTRONG%3ENote%3C%2FSTRONG%3E%3A%20Run%20the%20script%20using%20an%20on-premises%20AD%20DS%20credential%20that%20is%20synced%20to%20your%20Azure%20AD.%20The%20on-premises%20AD%20DS%20credential%20must%20have%20either%20the%20storage%20account%20owner%20or%20the%20contributor%20Azure%20role%20permissions.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20start%3D%222%22%3E%0A%3CLI%3EDownload%20and%20unzip%20the%20latest%20version%20on%20AzFilesHybrid%20from%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure-Samples%2Fazure-files-samples%2Freleases%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%3C%2FLI%3E%0A%3CLI%3EOpen%20%3CSTRONG%3EPowerShell%20%3C%2FSTRONG%3Ein%20elevated%20mode.%3C%2FLI%3E%0A%3CLI%3ERun%20the%20following%20command%20to%20set%20the%20execution%20policy%3A%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3ESet-ExecutionPolicy%20-ExecutionPolicy%20Unrestricted%20-Scope%20CurrentUser%E2%80%8B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLI%3E%0A%3CLI%3ENavigate%20to%20where%20AzfileHybrid%20was%20unzipped%20and%20run%20.%5CCopyToPSPath.ps1%3C%2FLI%3E%0A%3CLI%3EImport%20the%20AzFilesHybrid%20module%20via%20Import-Module%20-Name%20AzFilesHybrid%3C%2FLI%3E%0A%3CLI%3EConnect%20to%20Azure%20AD%20via%20Connect-AzAccount%3C%2FLI%3E%0A%3CLI%3ESet%20the%20following%20parameters%20according%20to%20your%20setup%3A%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%24SubscriptionId%20%3D%20%22%3CYOUR-SUBSCRIPTION-ID-HERE%3E%22%0A%24ResourceGroupName%20%3D%20%22%3CRESOURCE-GROUP-NAME-HERE%3E%22%0A%24StorageAccountName%20%3D%20%22%3CSTORAGE-ACCOUNT-NAME-HERE%3E%22%E2%80%8B%3C%2FSTORAGE-ACCOUNT-NAME-HERE%3E%3C%2FRESOURCE-GROUP-NAME-HERE%3E%3C%2FYOUR-SUBSCRIPTION-ID-HERE%3E%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3COL%20start%3D%229%22%3E%0A%3CLI%3ERun%20%3CSTRONG%3E%3CSTRONG%3EJoin-AzStorageAccountForAuth%3C%2FSTRONG%3E%3C%2FSTRONG%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3EJoin-AzStorageAccountForAuth%20%60%0A-ResourceGroupName%20%24ResourceGroupName%20%60%0A-StorageAccountName%20%24StorageAccountName%20%60%0A-DomainAccountType%20%22ComputerAccount%22%20%60%0A-OrganizationalUnitDistinguishedName%20%22%3COU-HERE%3E%22%20%60%0A-EncryptionType%20%22'RC4'%2C'AES256'%22%3C%2FOU-HERE%3E%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3COL%20start%3D%2210%22%3E%0A%3CLI%3EThe%20output%20of%20the%20above%20command%20must%20look%20like%20the%20screenshot%20below.%20If%20it%20doesn%E2%80%99t%2C%20joining%20the%20storage%20account%20to%20AD%20DS%20was%20not%20successful.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22psscreen.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F231553iA9D75438294DF743%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22psscreen.png%22%20alt%3D%22psscreen.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--978573964%22%20id%3D%22toc-hId--978573964%22%20id%3D%22toc-hId--978573964%22%20id%3D%22toc-hId--978573964%22%20id%3D%22toc-hId--978573964%22%20id%3D%22toc-hId--978573964%22%3EFile-level%20permissions%20aka%20NTFS%20permissions%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20be%20able%20to%20authenticate%20with%20AD%20DS%20computer%20accounts%20against%20an%20Azure%20Files%20storage%20account%2C%20we%20must%20also%20assign%20NTFS%20level%20permission%20in%20addition%20to%20the%20RBAC%20permission%20we%20set%20up%20earlier.%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EOpen%20the%20Azure%20portal%20and%20navigate%20to%20the%20storage%20account%20that%20we%20added%20to%20AD%20DS.%3C%2FLI%3E%0A%3CLI%3ESelect%20%3CSTRONG%3EAccess%20keys%20%3C%2FSTRONG%3Eand%20copy%20%3CSTRONG%3EKey1%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSTRONG%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22accesskey.png%22%20style%3D%22width%3A%20485px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F231552iA6042D502E305CE0%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22accesskey.png%22%20alt%3D%22accesskey.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3COL%20start%3D%223%22%3E%0A%3CLI%3ERemote%20into%20the%20VM%20or%20physical%20machine%20joined%20to%20AD%20DS.%3C%2FLI%3E%0A%3CLI%3EOpen%20command%20prompt%20in%20elevated%20mode.%3C%2FLI%3E%0A%3CLI%3EExecute%20the%20following%20command%20replacing%20the%20values%20in%20it%20with%20those%20applicable%20to%20your%20environment%3A%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3Enet%20use%20%3CDESIRED-DRIVE-LETTER%3E%3A%20%5C%5C%3CSTORAGE-ACCOUNT-NAME%3E.file.core.windows.net%5C%3CSHARE-NAME%3E%20%2Fuser%3AAzure%5C%3CSTORAGE-ACCOUNT-NAME%3E%20%3CSTORAGE-ACCOUNT-KEY%3E%E2%80%8B%3C%2FSTORAGE-ACCOUNT-KEY%3E%3C%2FSTORAGE-ACCOUNT-NAME%3E%3C%2FSHARE-NAME%3E%3C%2FSTORAGE-ACCOUNT-NAME%3E%3C%2FDESIRED-DRIVE-LETTER%3E%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSTRONG%3ENote%3A%20%3C%2FSTRONG%3EMake%20sure%20that%20the%20output%20of%20the%20command%20above%20is%20%E2%80%9C%3CSTRONG%3EThe%20command%20completed%20successfully%3C%2FSTRONG%3E%E2%80%9D.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20not%2C%20repeat%20and%20verify%20input.%3C%2FP%3E%0A%3COL%20start%3D%226%22%3E%0A%3CLI%3EOpen%20%3CSTRONG%3EFile%20Explorer%20%3C%2FSTRONG%3Eand%20find%20the%20drive%20letter%20specified%20in%20the%20command%20above.%3C%2FLI%3E%0A%3CLI%3ERight%20click%20on%20the%20drive%20letter%20and%20select%20%3CSTRONG%3EProperties%20%3C%2FSTRONG%3Eand%20then%20%3CSTRONG%3ESecurity.%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3EClick%20%3CSTRONG%3EEdit%20%3C%2FSTRONG%3Eand%20after%20that%20%3CSTRONG%3EAdd%E2%80%A6%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22select.png%22%20style%3D%22width%3A%20684px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F231551i7A38ED3B3D782436%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22select.png%22%20alt%3D%22select.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ENote%3A%20%3C%2FSTRONG%3EMake%20sure%20that%20domain%20name%20matches%20your%20AD%20DS%20domain%20name%2C%20if%20it%20doesn%E2%80%99t%20the%20storage%20account%20has%20not%20been%20domain%20joined.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20start%3D%229%22%3E%0A%3CLI%3EIf%20prompted%2C%20enter%20admin%20credentials.%3C%2FLI%3E%0A%3CLI%3EIn%20the%20%3CSTRONG%3ESelect%20Users%2C%20Computers%2C%20Service%20Accounts%2C%20or%20Groups%20%3C%2FSTRONG%3Ewindow%20enter%20the%20name%20of%20the%20group%20we%20created%20in%20the%20%3CSTRONG%3ECreate%20Group%20in%20AD%20DS%20%3C%2FSTRONG%3Esection%3C%2FLI%3E%0A%3CLI%3EClick%20%3CSTRONG%3EOK%20%3C%2FSTRONG%3Eand%20confirm%20the%20group%20has%20%3CSTRONG%3ERead%20%26amp%3B%20execute%20%3C%2FSTRONG%3Epermissions.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22permissions2.png%22%20style%3D%22width%3A%20543px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F231550i2B8E5E2921FD90E7%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22permissions2.png%22%20alt%3D%22permissions2.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3COL%20start%3D%229%22%3E%0A%3CLI%3EAdd%20the%20AD%20group%20with%20the%20computer%20accounts%20with%20%3CSTRONG%3ERead%20%26amp%3B%20execute%3C%2FSTRONG%3E%20permissions.%3C%2FLI%3E%0A%3CLI%3EClick%20%3CSTRONG%3EApply%20%3C%2FSTRONG%3Eand%20if%20prompted%20by%20%3CSTRONG%3EWindows%20Security%20%3C%2FSTRONG%3Econfirm%20by%20pressing%20%3CSTRONG%3EYes.%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1508938869%22%20id%3D%22toc-hId-1508938869%22%20id%3D%22toc-hId-1508938869%22%20id%3D%22toc-hId-1508938869%22%20id%3D%22toc-hId-1508938869%22%20id%3D%22toc-hId-1508938869%22%3ETroubleshooting%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECommon%20challenges%20with%20granting%20machine%20accounts%20access%20to%20Azure%20Files%20share%20authenticated%20with%20Azure%20AD%20are%20captured%20in%20the%20sections%20below.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--298515594%22%20id%3D%22toc-hId--298515594%22%20id%3D%22toc-hId--298515594%22%20id%3D%22toc-hId--298515594%22%20id%3D%22toc-hId--298515594%22%20id%3D%22toc-hId--298515594%22%3EGroup%20membership%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20a%20VM%20is%20added%20to%20an%20AD%20DS%20group%20that%20VM%20needs%20to%20be%20restarted%20in%20order%20to%20pick%20up%20its%20membership%20to%20the%20group.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--432200318%22%20id%3D%22toc-hId--432200318%22%20id%3D%22toc-hId--432200318%22%20id%3D%22toc-hId--432200318%22%20id%3D%22toc-hId--432200318%22%20id%3D%22toc-hId--432200318%22%3EAdding%20storage%20account%20to%20AD%20DS%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20Azure%20Files%20team%20have%20excellent%20troubleshooting%20document%20available%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fstorage%2Ffiles%2Fstorage-troubleshoot-windows-file-connection-problems%23unable-to-mount-azure-files-with-ad-credentials%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%20There%20are%20few%20errors%20that%20I%20have%20observed%20occurring%20with%20higher%20frequency%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EIgnoring%20warnings%20when%20running%20the%20PowerShell%3C%2FLI%3EThis%20will%20cause%20the%20account%20to%20be%20created%20but%20possibly%20with%20certain%20incorrect%20setting.%20This%20is%20where%20it%20is%20easier%20to%20delete%20the%20domain%20account%20representing%20the%20storage%20account%20and%20try%20again.%3C%2FUL%3E%0A%3CUL%3E%0A%3CLI%3EIncorrect%20OU%20specified%3C%2FLI%3EIt%20is%20a%20best%20practice%20to%20specify%20an%20OU%20for%20your%20storage%20account.%20The%20way%20an%20OU%20is%20specified%20is%20using%20the%20standard%20syntax%20(DC%3Douname%2CDC%3Ddomainprefix%2CDC%3Dtopleveldomain%20%E2%80%93%20for%20example%20DC%3DstorageAccounts%2CDC%3Dwvdcontoso%2CDC%3Dcom)%3C%2FUL%3E%0A%3CUL%3E%0A%3CLI%3EStorage%20account%20synch%20to%20Azure%20AD%3C%2FLI%3EIt%20will%20take%20about%2030%20minutes%20for%20the%20storage%20account%20to%20synch%20to%20Azure%20AD.%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-2055312515%22%20id%3D%22toc-hId-2055312515%22%20id%3D%22toc-hId-2055312515%22%20id%3D%22toc-hId-2055312515%22%20id%3D%22toc-hId-2055312515%22%20id%3D%22toc-hId-2055312515%22%3ESynching%20AD%20DS%20group%20to%20Azure%20AD%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20synch%20interval%20between%20AD%20DS%20and%20Azure%20AD%20is%2030%20minutes%20by%20default.%20If%20the%20AD%20DS%20group%20was%20create%20in%20the%20last%2030%20minutes%20and%20cannot%20be%20assigned%20to%20the%20storage%20account%2C%20option%201%20is%20to%20wait%2C%20option%202%20is%20to%20force%20the%20AD%20DS%20-%26gt%3B%20Azure%20AD%20sync.%20Sample%20script%2C%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fstgeorgi%2Fmsixappattach%2Fblob%2Fmaster%2Fforce%2520AD%2520DS%2520to%2520Azure%2520AD%2520sync%2Fforce%2520sync.ps1%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%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%3CH2%20id%3D%22toc-hId-247858052%22%20id%3D%22toc-hId-247858052%22%20id%3D%22toc-hId-247858052%22%20id%3D%22toc-hId-247858052%22%20id%3D%22toc-hId-247858052%22%20id%3D%22toc-hId-247858052%22%3ERBAC%20permissions%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFor%20MSIX%20app%20attach%20and%20FSLogix%20the%20minimum%20RBAC%20permissions%20on%20the%20storage%20account%20are%20%3CSTRONG%3EStorage%20File%20Data%20SMB%20Share%20Contributor.%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1559596411%22%20id%3D%22toc-hId--1559596411%22%20id%3D%22toc-hId--1559596411%22%20id%3D%22toc-hId--1559596411%22%20id%3D%22toc-hId--1559596411%22%20id%3D%22toc-hId--1559596411%22%3ENTFS%20permission%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFor%20MSIX%20app%20attach%20and%20FSLogix%20the%20minimum%20NTFS%20permissions%20on%20the%20storage%20account%20are%20%3CSTRONG%3ERead%20%26amp%3B%20Execute%2C%20%3C%2FSTRONG%3Eand%3CSTRONG%3E%20List%20folder%20content.%3C%2FSTRONG%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1857673%22%20slang%3D%22en-US%22%3ERe%3A%20Step%20by%20step%20guide%20on%20computer%20account%20auth%20for%20Azure%20Files%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1857673%22%20slang%3D%22en-US%22%3E%3CP%3EGreat%20article%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F195573%22%20target%3D%22_blank%22%3E%40Stefan%20Georgiev%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAnyone%20interested%20in%20seeing%20a%20video%20walking%20through%20this%20process%20check%20out%20%3CA%20href%3D%22https%3A%2F%2Fwww.youtube.com%2FAzureAcademy%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EThe%20Azure%20Academy%3C%2FA%3E%3C%2FP%3E%0A%3CP%3Evideo%20on%20Azure%20Files%20with%20AD%20Authentication%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D9S5A1IJqfOQ%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D9S5A1IJqfOQ%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1857676%22%20slang%3D%22en-US%22%3ERe%3A%20Step%20by%20step%20guide%20on%20computer%20account%20auth%20for%20Azure%20Files%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1857676%22%20slang%3D%22en-US%22%3ENice%20video%20if%20I%20knew%20it%20was%20there%20I%20would%20have%20skipped%20on%20creating%20article%3C%2FLINGO-BODY%3E
Highlighted
Microsoft

Step by step guide on computer account auth for Azure Files

 

In the last 3 weeks, I have been getting a lot of questions around Azure Files. The main question has been “Can computer accounts have access Azure Files?”. This combined with my work on MSIX app attach (which also uses Azure Files) has prompted the creation of this post.

 

Prerequisites

 

Azure Files supports multiple authentication mechanisms. This article is focused on authenticating with

AD DS, as described here. Hence the prerequisites are:

  • AD DS synched to Azure AD
  • Permissions to create a Group in AD DS
  • Storage account or enough permissions to create one
  • VM or physical machine joined to AD DS, and permissions to access it
  • WVD host pool in which all session hosts have been domain joined

 

Process overview

 

1. Create AD DS security group.
2. Add the computer accounts for all session hosts as members of the group
3. Synch AD DS group to Azure AD
4. Create storage account
5. Create file share under the storage account
6. Join storage account to AD DS
7. Assign the AD DS group that has been synched to Azure AD, the Storage File Data SMB Share Contributor role assignment on the storage account
8. Mount file share on any session host
9. Grant NTFS permissions on the file share to the AD DS group

 

Create Group in AD DS

 

This group will be used in later steps to grant share level and (files share) permissions.

  1. Remote into the VM or physical machine joined to AD DS.
  2. Open the Active Directory Users and Computers utility.
  3. Under the domain node right click and select New, and then Group.

Note: it is not mandatory to create a new group, an existing group can be used.

  1. In the New Object – Group enter group name and select:
    1. Group scope: Global
    2. Group type: Security
  2. Right click on the new group and select Properties.
  3. In the properties screen select the Members tab.
  4. Click Add…
  5. In the Select Users, Contacts, Computers, Service Accounts, or Groups dialog click Object Types… and select Computers. Click OK.
  6. In the Enter the object names to select enter the names of all session hosts.
  7. Click Check Names and if multiple entries are present select the “correct” one from the results dialog.
  8. Press Ok and then Apply.

Note: If this is a new group it may take up to 1 hour to sync with Azure AD.

 

Create storage account

 

For brevity we will assume there is already a storage account with a file share. If required, please reference this article on how to create storage accounts. If you’re creating a new storage account, it is mandatory to create a file share.

Note: if you are creating a Premium storage account make sure Account Kind is set to FileStorage.

 

Share-level permission aka RBAC permission

 

  1. Select the desired storage account
  2. Click Access Control (IAM) and then Add. From the drop down select Add role assignments.
  3. In the Add role assignment screen:
    1. Role: Storage File Data SMB Share Contributor
    2. Assign access to: User, Group, or Service Principal
    3. Subscription: Based on your environment
    4. Select: pick the AD group that you created which contains your session hosts
  4. Click Save

 

Join storage account to AD DS

 

In this step we are going to join our storage account to AD DS. The full article is available here. Please note our steps here have been modified to achieve the desired scenario.

  1. Remote into the VM or physical machine joined to AD DS

Note: Run the script using an on-premises AD DS credential that is synced to your Azure AD. The on-premises AD DS credential must have either the storage account owner or the contributor Azure role permissions.

 

  1. Download and unzip the latest version on AzFilesHybrid from here.
  2. Open PowerShell in elevated mode.
  3. Run the following command to set the execution policy:
    Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser​
  4. Navigate to where AzfileHybrid was unzipped and run .\CopyToPSPath.ps1
  5. Import the AzFilesHybrid module via Import-Module -Name AzFilesHybrid
  6. Connect to Azure AD via Connect-AzAccount
  7. Set the following parameters according to your setup:
    $SubscriptionId = "<your-subscription-id-here>"
    $ResourceGroupName = "<resource-group-name-here>"
    $StorageAccountName = "<storage-account-name-here>"​
  1. Run Join-AzStorageAccountForAuth
    Join-AzStorageAccountForAuth `
    -ResourceGroupName $ResourceGroupName `
    -StorageAccountName $StorageAccountName `
    -DomainAccountType "ComputerAccount" `
    -OrganizationalUnitDistinguishedName "<ou-here>" `
    -EncryptionType "'RC4','AES256'"
  1. The output of the above command must look like the screenshot below. If it doesn’t, joining the storage account to AD DS was not successful.

psscreen.png

File-level permissions aka NTFS permissions

 

To be able to authenticate with AD DS computer accounts against an Azure Files storage account, we must also assign NTFS level permission in addition to the RBAC permission we set up earlier.

  1. Open the Azure portal and navigate to the storage account that we added to AD DS.
  2. Select Access keys and copy Key1

accesskey.png

  1. Remote into the VM or physical machine joined to AD DS.
  2. Open command prompt in elevated mode.
  3. Execute the following command replacing the values in it with those applicable to your environment:
    net use <desired-drive-letter>: \\<storage-account-name>.file.core.windows.net\<share-name> /user:Azure\<storage-account-name> <storage-account-key>​

Note: Make sure that the output of the command above is “The command completed successfully”.

 

If not, repeat and verify input.

  1. Open File Explorer and find the drive letter specified in the command above.
  2. Right click on the drive letter and select Properties and then Security.
  3. Click Edit and after that Add…

select.png

Note: Make sure that domain name matches your AD DS domain name, if it doesn’t the storage account has not been domain joined.

 

  1. If prompted, enter admin credentials.
  2. In the Select Users, Computers, Service Accounts, or Groups window enter the name of the group we created in the Create Group in AD DS section
  3. Click OK and confirm the group has Read & execute permissions.

permissions2.png

  1. Add the AD group with the computer accounts with Read & execute permissions.
  2. Click Apply and if prompted by Windows Security confirm by pressing Yes.

 

Troubleshooting

 

Common challenges with granting machine accounts access to Azure Files share authenticated with Azure AD are captured in the sections below.

 

Group membership

 

When a VM is added to an AD DS group that VM needs to be restarted in order to pick up its membership to the group.

 

Adding storage account to AD DS

 

The Azure Files team have excellent troubleshooting document available here. There are few errors that I have observed occurring with higher frequency:

 

  • Ignoring warnings when running the PowerShell
  • This will cause the account to be created but possibly with certain incorrect setting. This is where it is easier to delete the domain account representing the storage account and try again.
  • Incorrect OU specified
  • It is a best practice to specify an OU for your storage account. The way an OU is specified is using the standard syntax (DC=ouname,DC=domainprefix,DC=topleveldomain – for example DC=storageAccounts,DC=wvdcontoso,DC=com)
  • Storage account synch to Azure AD
  • It will take about 30 minutes for the storage account to synch to Azure AD.

 

Synching AD DS group to Azure AD

 

The synch interval between AD DS and Azure AD is 30 minutes by default. If the AD DS group was create in the last 30 minutes and cannot be assigned to the storage account, option 1 is to wait, option 2 is to force the AD DS -> Azure AD sync. Sample script, here.

 

RBAC permissions

 

For MSIX app attach and FSLogix the minimum RBAC permissions on the storage account are Storage File Data SMB Share Contributor.

 

NTFS permission

 

For MSIX app attach and FSLogix the minimum NTFS permissions on the storage account are Read & Execute, and List folder content.

2 Replies
Highlighted

Great article @Stefan Georgiev 

Anyone interested in seeing a video walking through this process check out The Azure Academy

video on Azure Files with AD Authentication

https://www.youtube.com/watch?v=9S5A1IJqfOQ

 

TheAzureAcademy #WindowsVirtualDesktop #FSLogix Learn how to use the new Azure Files with AD Authentication with FSLogix & Windows Virtual Desktop today at ...
Highlighted
Nice video if I knew it was there I would have skipped on creating article