Link to the Azure Files Script:
https://github.com/Azure-Samples/azure-files-samples/releases
Set Execution Policy:
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
Copy files:
.\CopyToPSPath.ps1
Import the AzFilesHybrid Module:
Import-Module -Name AzFilesHybrid
Set the variables:
$SubscriptionId = "<your-subscription-id-here>"
$ResourceGroupName = "<resource-group-name-here>"
$StorageAccountName = "<storage-account-name-here>"
Set the session to the Azure Subscription:
Select-AzSubscription -SubscriptionId $SubscriptionId
Register the storage account with Windows AD:
Join-AzStorageAccountForAuth `
-ResourceGroupName $ResourceGroupName `
-Name $StorageAccountName `
-DomainAccountType "<ComputerAccount|ServiceLogonAccount>" `
#-OrganizationalUnitName "<ou-name-here>"
# OR USE A DISTINGUISHED NAME
-OrganizationalUnitDistinguishedName "<ou-distinguishedname-here>"
Confirm the settings:
# Get the target storage account
$storageaccount = Get-AzStorageAccount `
-ResourceGroupName $ResourceGroupName `
-Name $StorageAccountName
# List the directory service of the selected service account $storageAccount.AzureFilesIdentityBasedAuth.DirectoryServiceOptions
# List the directory domain information if the storage account has enabled
#AD DS authentication for file shares
$storageAccount.AzureFilesIdentityBasedAuth.ActiveDirectoryProperties
Please note that the Storage Access key will be found under the storage Account Key section which you need to add the above-mentioned scripts.
Comments
0 comments
Please sign in to leave a comment.