Skip to content

Commit c65c140

Browse files
committed
Improve PS readability in AD DJ guide.
1 parent 37bc22c commit c65c140

File tree

1 file changed

+33
-16
lines changed

1 file changed

+33
-16
lines changed

articles/storage/files/storage-files-identity-auth-active-directory-enable.md

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ The following diagram illustrates the end-to-end workflow for enabling Azure AD
9393
To enable AD authentication over SMB for Azure file shares, you need to first register your storage account with AD and then set the required domain properties on the storage account. When the feature is enabled on the storage account, it applies to all new and existing file shares in the account. Use `join-AzStorageAccountForAuth` to enable the feature. You can find the detailed description of the end-to-end workflow in the section below.
9494

9595
> [!IMPORTANT]
96-
> The `join-AzStorageAccountForAuth` cmdlet will make modifications to your AD environment. Read the following explanation to better understand what it is doing to ensure you have the proper permissions to execute the command and that the applied changes align with the compliance and security policies.
96+
> The `Join-AzStorageAccountForAuth` cmdlet will make modifications to your AD environment. Read the following explanation to better understand what it is doing to ensure you have the proper permissions to execute the command and that the applied changes align with the compliance and security policies.
9797
98-
The `join-AzStorageAccountForAuth` cmdlet will perform the equivalent of an offline domain join on behalf of the indicated storage account. It will create an account in your AD domain, either a [computer account](https://docs.microsoft.com/windows/security/identity-protection/access-control/active-directory-accounts#manage-default-local-accounts-in-active-directory) or a [service logon account](https://docs.microsoft.com/windows/win32/ad/about-service-logon-accounts). The created AD account represents the storage account in the AD domain. If the AD account is created under an AD Organizational Unit (OU) that enforces password expiration, you must update the password before the maximum password age. Failing to update AD account password will result in authentication failures when accessing Azure file shares. To learn how to update the password, see [Update AD account password](#update-ad-account-password).
98+
The `Join-AzStorageAccountForAuth` cmdlet will perform the equivalent of an offline domain join on behalf of the indicated storage account. It will create an account in your AD domain, either a [computer account](https://docs.microsoft.com/windows/security/identity-protection/access-control/active-directory-accounts#manage-default-local-accounts-in-active-directory) or a [service logon account](https://docs.microsoft.com/windows/win32/ad/about-service-logon-accounts). The created AD account represents the storage account in the AD domain. If the AD account is created under an AD Organizational Unit (OU) that enforces password expiration, you must update the password before the maximum password age. Failing to update AD account password will result in authentication failures when accessing Azure file shares. To learn how to update the password, see [Update AD account password](#update-ad-account-password).
9999

100100
You can use the following script to perform the registration and enable the feature or, alternatively, you can manually perform the operations that the script would. Those operations are described in the section following the script. You do not need to do both.
101101

@@ -105,18 +105,18 @@ You can use the following script to perform the registration and enable the feat
105105
- Run the script using an AD credential that is synced to your Azure AD. The AD credential must have either the storage account owner or the contributor RBAC role permissions.
106106
- Make sure your storage account is in a [supported region](#regional-availability).
107107

108-
### 2. Execute AD enablement script
108+
### 2. Domain join your storage account
109109
Remember to replace the placeholder values with your own in the parameters below before executing it in PowerShell.
110110

111111
```PowerShell
112112
#Change the execution policy to unblock importing AzFilesHybrid.psm1 module
113-
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Currentuser
113+
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
114114
115115
# Navigate to where AzFilesHybrid is unzipped and stored and run to copy the files into your path
116116
.\CopyToPSPath.ps1
117117
118118
#Import AzFilesHybrid module
119-
Import-Module -name AzFilesHybrid
119+
Import-Module -Name AzFilesHybrid
120120
121121
#Login with an Azure AD credential that has either storage account owner or contributer RBAC assignment
122122
Connect-AzAccount
@@ -125,13 +125,17 @@ Connect-AzAccount
125125
Select-AzSubscription -SubscriptionId "<your-subscription-id-here>"
126126
127127
#Register the target storage account with your active directory environment under the target OU
128-
join-AzStorageAccountForAuth -ResourceGroupName "<resource-group-name-here>" -Name "<storage-account-name-here>" -DomainAccountType "<ServiceLogonAccount|ComputerAccount>" -OrganizationalUnitName "<ou-name-here>"
128+
Join-AzStorageAccountForAuth `
129+
-ResourceGroupName "<resource-group-name-here>" `
130+
-Name "<storage-account-name-here>" `
131+
-DomainAccountType "ComputerAccount" `
132+
-OrganizationalUnitName "<ou-name-here>"
129133
```
130134

131-
The following description summarizes all actions performed when the `join-AzStorageAccountForAuth` cmdlet gets executed. You may perform these steps manually, if you prefer not to use the command:
135+
The following description summarizes all actions performed when the `Join-AzStorageAccountForAuth` cmdlet gets executed. You may perform these steps manually, if you prefer not to use the command:
132136

133137
> [!NOTE]
134-
> If you have already executed the join-AzStorageAccountForAuth script above successfully, go to the next section "3. Confirm that the feature is enabled". You do not need to perform the operations below again.
138+
> If you have already executed the `Join-AzStorageAccountForAuth` script above successfully, go to the next section "3. Confirm that the feature is enabled". You do not need to perform the operations below again.
135139
136140
#### a. Checking environment
137141

@@ -154,9 +158,17 @@ Keep the SID of the newly created account, you'll need it for the next step.
154158
The script would then enable the feature on your storage account. To perform this setup manually, provide some configuration details for the domain properties in the following command, then run it. The storage account SID required in the following command is the SID of the identity you created in AD (section b above).
155159

156160
```PowerShell
157-
#Set the feature flag on the target storage account and provide the required AD domain information
158-
159-
Set-AzStorageAccount -ResourceGroupName "<your-resource-group-name-here>" -Name "<your-storage-account-name-here>" -EnableActiveDirectoryDomainServiesForFile $true -ActiveDirectoryDomainName "<your-domain-name-here>" -ActiveDirectoryNetBiosDomainName "<your-netbios-domain-name-here>" -ActiveDirectoryForestName "<your-forest-name-here>" -ActiveDirectoryDomainGuid "<your-guid-here>" -ActiveDirectoryDomainsid "<your-domain-sid-here>" -ActiveDirectoryAzureStorageSid "<your-storage-account-sid>"
161+
# Set the feature flag on the target storage account and provide the required AD domain information
162+
Set-AzStorageAccount `
163+
-ResourceGroupName "<your-resource-group-name-here>" `
164+
-Name "<your-storage-account-name-here>" `
165+
-EnableActiveDirectoryDomainServiesForFile $true `
166+
-ActiveDirectoryDomainName "<your-domain-name-here>" `
167+
-ActiveDirectoryNetBiosDomainName "<your-netbios-domain-name-here>" `
168+
-ActiveDirectoryForestName "<your-forest-name-here>" `
169+
-ActiveDirectoryDomainGuid "<your-guid-here>" `
170+
-ActiveDirectoryDomainsid "<your-domain-sid-here>" `
171+
-ActiveDirectoryAzureStorageSid "<your-storage-account-sid>"
160172
```
161173

162174

@@ -165,13 +177,15 @@ Set-AzStorageAccount -ResourceGroupName "<your-resource-group-name-here>" -Name
165177
You can check to confirm whether the feature is enabled on your storage account, you can use the following script:
166178

167179
```PowerShell
168-
#Get the target storage account
169-
$storageaccount = Get-AzStorageAccount -ResourceGroupName "<your-resource-group-name-here>" -Name "<your-storage-account-name-here>"
180+
# Get the target storage account
181+
$storageaccount = Get-AzStorageAccount `
182+
-ResourceGroupName "<your-resource-group-name-here>" `
183+
-Name "<your-storage-account-name-here>"
170184
171-
#List the directory service of the selected service account
185+
# List the directory service of the selected service account
172186
$storageAccount.AzureFilesIdentityBasedAuth.DirectoryServiceOptions
173187
174-
#List the directory domain information if the storage account has enabled AD authentication for file shares
188+
# List the directory domain information if the storage account has enabled AD authentication for file shares
175189
$storageAccount.AzureFilesIdentityBasedAuth.ActiveDirectoryProperties
176190
```
177191

@@ -189,7 +203,10 @@ To trigger password rotation, you can run the `Update-AzStorageAccountADObjectPa
189203

190204
```PowerShell
191205
#Update the password of the AD account registered for the storage account
192-
Update-AzStorageAccountADObjectPassword -RotateToKerbKey kerb2 -ResourceGroupName "your-resource-group-name-here" -StorageAccountName "your-storage-account-name-here"
206+
Update-AzStorageAccountADObjectPassword `
207+
-RotateToKerbKey kerb2 `
208+
-ResourceGroupName "<your-resource-group-name-here>" `
209+
-StorageAccountName "<your-storage-account-name-here>"
193210
```
194211

195212
## Next steps

0 commit comments

Comments
 (0)