Skip to content

Commit

Permalink
Azure Files AD Script
Browse files Browse the repository at this point in the history
  • Loading branch information
johnthebrit committed Feb 27, 2020
1 parent 048a730 commit 04ef37e
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions AzureFilesADIntegration/EnableAzureFilesADIntegration.ps1
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
#https://docs.microsoft.com/en-us/azure/storage/files/storage-files-identity-auth-active-directory-enable
#Download AzFilesHybrid module from https://github.com/Azure-Samples/azure-files-samples/releases

#Import AzFilesHybrid module
Import-Module -name AzFilesHybrid

#Register the target storage account with your active directory environment under the target OU
join-AzStorageAccountForAuth -ResourceGroupName "RG-WCUS" -StorageAccountName "sawcusadfiles" `
-Domain "savilltech.net" -OrganizationalUnitDistinguishedName "OU=SPNs,DC=savilltech,DC=net"

#Check healthy
#Get the target storage account
$storageaccount = Get-AzStorageAccount -ResourceGroupName "RG-WCUS" -Name "sawcusadfiles"
#See the created kerberos key used by the AD account created
$storageaccount | Get-AzStorageAccountKey -ListKerbKey | ft KeyName
#List the directory service of the selected service account
$storageAccount.AzureFilesIdentityBasedAuth.DirectoryServiceOptions
#List the directory domain information if the storage account has enabled AD authentication for file shares
$storageAccount.AzureFilesIdentityBasedAuth.ActiveDirectoryProperties

#Computer object now present
#Can set access control on files share, e.g. Storage File Data SMB Share Elevated Contributor

New-PSDrive -Name "X" -PSProvider "FileSystem" -Root "\\sawcusadfiles.file.core.windows.net\data" -Scope Global
Get-PSDrive x | Remove-PSDrive

0 comments on commit 04ef37e

Please sign in to comment.