You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> If you were previously using RC4 encryption and update the storage account to use AES-256, you should run `klist purge` on the client and then remount the file share to get new Kerberos tickets with AES-256.
To access Azure Files resources with identity-based authentication, an identity (a user, group, or service principal) must have the necessary permissions at the share level. This process is similar to specifying Windows share permissions, where you specify the type of access that a particular user has to a file share. The guidance in this section demonstrates how to assign read, write, or delete permissions for a file share to an identity. **We highly recommend assigning permissions by declaring actions and data actions explicitly as opposed to using the wildcard (\*) character.**
190
+
191
+
Most users should assign share-level permissions to specific Microsoft Entra users or groups, and then [configure Windows ACLs](#configure-windows-acls) for granular access control at the directory and file level. However, alternatively you can set a [default share-level permission](storage-files-identity-ad-ds-assign-permissions.md#share-level-permissions-for-all-authenticated-identities) to allow contributor, elevated contributor, or reader access to **all authenticated identities**.
192
+
193
+
There are five Azure built-in roles for Azure Files, some of which allow granting share-level permissions to users and groups:
194
+
195
+
-**Storage File Data Share Reader** allows read access in Azure file shares over SMB.
196
+
-**Storage File Data Privileged Reader** allows read access in Azure file shares over SMB by overriding existing Windows ACLs.
197
+
-**Storage File Data Share Contributor** allows read, write, and delete access in Azure file shares over SMB.
198
+
-**Storage File Data Share Elevated Contributor** allows read, write, delete, and modify Windows ACLs in Azure file shares over SMB.
199
+
-**Storage File Data Privileged Contributor** allows read, write, delete, and modify Windows ACLs in Azure file shares over SMB by overriding existing Windows ACLs.
200
+
201
+
> [!IMPORTANT]
202
+
> Full administrative control of a file share, including the ability to take ownership of a file, requires using the storage account key. Administrative control isn't supported with Microsoft Entra credentials.
203
+
204
+
You can use the Azure portal, PowerShell, or Azure CLI to assign the built-in roles to the Microsoft Entra identity of a user for granting share-level permissions. Be aware that the share-level Azure role assignment can take some time to take effect. We recommend using share-level permission for high-level access management to an AD group representing a group of users and identities, then leverage Windows ACLs for granular access control at the directory/file level.
### Assign an Azure role to a Microsoft Entra identity
209
+
210
+
> [!IMPORTANT]
211
+
> **Assign permissions by explicitly declaring actions and data actions as opposed to using a wildcard (\*) character.** If a custom role definition for a data action contains a wildcard character, all identities assigned to that role are granted access for all possible data actions. This means that all such identities will also be granted any new data action added to the platform. The additional access and permissions granted through new actions or data actions may be unwanted behavior for customers using wildcard.
212
+
213
+
# [Portal](#tab/azure-portal)
214
+
To assign an Azure role to a Microsoft Entra identity using the [Azure portal](https://portal.azure.com), follow these steps:
215
+
216
+
1. In the Azure portal, go to your file share, or [Create a file share](storage-how-to-create-file-share.md).
217
+
2. Select **Access Control (IAM)**.
218
+
3. Select **Add a role assignment**
219
+
4. In the **Add role assignment** blade, select the appropriate built-in role (for example, Storage File Data SMB Share Reader or Storage File Data SMB Share Contributor) from the **Role** list. Leave **Assign access to** at the default setting: **Microsoft Entra user, group, or service principal**. Select the target Microsoft Entra identity by name or email address.
220
+
5. Select **Review + assign** to complete the role assignment.
221
+
222
+
# [PowerShell](#tab/azure-powershell)
223
+
224
+
The following PowerShell sample shows how to assign an Azure role to a Microsoft Entra identity, based on sign-in name. For more information about assigning Azure roles with PowerShell, see [Manage access using RBAC and Azure PowerShell](../../role-based-access-control/role-assignments-powershell.md).
225
+
226
+
Before you run the following sample script, remember to replace placeholder values, including brackets, with your own values.
227
+
228
+
```powershell
229
+
#Get the name of the custom role
230
+
$FileShareContributorRole = Get-AzRoleDefinition "<role-name>" #Use one of the built-in roles: Storage File Data SMB Share Reader, Storage File Data SMB Share Contributor, Storage File Data SMB Share Elevated Contributor
The following command shows how to assign an Azure role to a Microsoft Entra identity based on sign-in name. For more information about assigning Azure roles with Azure CLI, see [Manage access by using RBAC and Azure CLI](../../role-based-access-control/role-assignments-cli.md).
240
+
241
+
Before you run the following sample script, remember to replace placeholder values, including brackets, with your own values.
242
+
243
+
```azurecli-interactive
244
+
#Assign the built-in role to the target identity: Storage File Data SMB Share Reader, Storage File Data SMB Share Contributor, Storage File Data SMB Share Elevated Contributor
245
+
az role assignment create --role "<role-name>" --assignee <user-principal-name> --scope "/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.Storage/storageAccounts/<storage-account>/fileServices/default/fileshares/<share-name>"
246
+
```
247
+
---
248
+
249
+
## Configure Windows ACLs
250
+
251
+
After you assign share-level permissions with RBAC, you can assign Windows ACLs at the root, directory, or file level. Think of share-level permissions as the high-level gatekeeper that determines whether a user can access the share, whereas Windows ACLs act at a more granular level to determine what operations the user can do at the directory or file level.
252
+
253
+
Azure Files supports the full set of basic and advanced permissions. You can view and configure Windows ACLs on directories and files in an Azure file share by mounting the share and then using Windows File Explorer or running the Windows [icacls](/windows-server/administration/windows-commands/icacls) or [Set-ACL](/powershell/module/microsoft.powershell.security/set-acl) command.
254
+
255
+
The following sets of permissions are supported on the root directory of a file share:
256
+
257
+
- BUILTIN\Administrators:(OI)(CI)(F)
258
+
- NT AUTHORITY\SYSTEM:(OI)(CI)(F)
259
+
- BUILTIN\Users:(RX)
260
+
- BUILTIN\Users:(OI)(CI)(IO)(GR,GE)
261
+
- NT AUTHORITY\Authenticated Users:(OI)(CI)(M)
262
+
- NT AUTHORITY\SYSTEM:(F)
263
+
- CREATOR OWNER:(OI)(CI)(IO)(F)
264
+
265
+
For more information, see [Configure directory and file-level permissions over SMB](storage-files-identity-ad-ds-configure-permissions.md).
266
+
267
+
### Mount the file share using your storage account key
268
+
269
+
Before you configure Windows ACLs, you must first mount the file share to your domain-joined VM by using your storage account key. To do this, log into the domain-joined VM as a Microsoft Entra user, open a Windows command prompt, and run the following command. Remember to replace `<YourStorageAccountName>`, `<FileShareName>`, and `<YourStorageAccountKey>` with your own values. If Z: is already in use, replace it with an available drive letter. You can find your storage account key in the Azure portal by navigating to the storage account and selecting **Security + networking** > **Access keys**, or you can use the `Get-AzStorageAccountKey` PowerShell cmdlet.
270
+
271
+
It's important that you use the `net use` Windows command to mount the share at this stage and not PowerShell. If you use PowerShell to mount the share, then the share won't be visible to Windows File Explorer or cmd.exe, and you won't be able to configure Windows ACLs.
272
+
273
+
> [!NOTE]
274
+
> You might see the **Full Control** ACL applied to a role already. This typically already offers the ability to assign permissions. However, because there are access checks at two levels (the share level and the file/directory level), this is restricted. Only users who have the **SMB Elevated Contributor** role and create a new file or directory can assign permissions on those new files or directories without using the storage account key. All other file/directory permission assignment requires connecting to the share using the storage account key first.
275
+
276
+
```
277
+
net use Z: \\<YourStorageAccountName>.file.core.windows.net\<FileShareName> /user:localhost\<YourStorageAccountName> <YourStorageAccountKey>
278
+
```
279
+
280
+
### Configure Windows ACLs with Windows File Explorer
281
+
282
+
After you've mounted your Azure file share, you must configure the Windows ACLs. You can do this using either Windows File Explorer or icacls.
283
+
284
+
Follow these steps to use Windows File Explorer to grant full permission to all directories and files under the file share, including the root directory.
285
+
286
+
1. Open Windows File Explorer and right click on the file/directory and select **Properties**.
287
+
1. Select the **Security** tab.
288
+
1. Select **Edit** to change permissions.
289
+
1. You can change the permissions of existing users or select **Add** to grant permissions to new users.
290
+
1. In the prompt window for adding new users, enter the target user name you want to grant permission to in the **Enter the object names to select** box, and select **Check Names** to find the full UPN name of the target user.
291
+
1. Select **OK**.
292
+
1. In the **Security** tab, select all permissions you want to grant your new user.
293
+
1. Select **Apply**.
294
+
295
+
### Configure Windows ACLs with icacls
296
+
297
+
Use the following Windows command to grant full permissions to all directories and files under the file share, including the root directory. Remember to replace the placeholder values in the example with your own values.
For more information on how to use icacls to set Windows ACLs and the different types of supported permissions, see [the command-line reference for icacls](/windows-server/administration/windows-commands/icacls).
304
+
305
+
## Mount the file share from a domain-joined VM
306
+
307
+
The following process verifies that your file share and access permissions were set up correctly and that you can access an Azure file share from a domain-joined VM. Be aware that the share-level Azure role assignment can take some time to take effect.
308
+
309
+
Sign in to the domain-joined VM using the Microsoft Entra identity to which you granted permissions. Be sure to sign in with Microsoft Entra credentials. If the drive is already mounted with the storage account key, you'll need to disconnect the drive or sign in again.
310
+
311
+
Run the PowerShell script below or [use the Azure portal](storage-files-quick-create-use-windows.md#map-the-azure-file-share-to-a-windows-drive) to persistently mount the Azure file share and map it to drive Z: on Windows. If Z: is already in use, replace it with an available drive letter. Because you've been authenticated, you won't need to provide the storage account key. The script will check to see if this storage account is accessible via TCP port 445, which is the port SMB uses. Remember to replace `<storage-account-name>` and `<file-share-name>` with your own values. For more information, see [Use an Azure file share with Windows](storage-how-to-use-files-windows.md).
312
+
313
+
Always mount Azure file shares using `file.core.windows.net`, even if you set up a private endpoint for your share.
New-PSDrive -Name Z -PSProvider FileSystem -Root "\\<storage-account-name>.file.core.windows.net\<file-share-name>" -Persist
320
+
} else {
321
+
Write-Error -Message "Unable to reach the Azure storage account via port 445. Check to make sure your organization or ISP is not blocking port 445, or use Azure P2S VPN, Azure S2S VPN, or Express Route to tunnel SMB traffic over a different port."
322
+
}
323
+
```
324
+
325
+
You can also use the `net-use` command from a Windows prompt to mount the file share. Remember to replace `<YourStorageAccountName>` and `<FileShareName>` with your own values.
326
+
327
+
```
328
+
net use Z: \\<YourStorageAccountName>.file.core.windows.net\<FileShareName>
329
+
```
330
+
331
+
## Mount the file share from a non-domain-joined VM or a VM joined to a different AD domain
332
+
333
+
Non-domain-joined VMs or VMs that are joined to a different domain than the storage account can access Azure file shares using Microsoft Entra Domain Services authentication only if the VM has unimpeded network connectivity to the domain controllers for Microsoft Entra Domain Services, which are located in Azure. This usually requires setting up a site-to-site or point-to-site VPN. The user accessing the file share must have an identity and credentials (a Microsoft Entra identity synced from Microsoft Entra ID to Microsoft Entra Domain Services) in the Microsoft Entra Domain Services managed domain.
334
+
335
+
To mount a file share from a non-domain-joined VM, the user must either:
336
+
337
+
- Provide explicit credentials such as **DOMAINNAME\username** where **DOMAINNAME** is the Microsoft Entra Domain Services domain and **username** is the identity’s user name in Microsoft Entra Domain Services, or
338
+
- Use the notation **username@domainFQDN**, where **domainFQDN** is the fully qualified domain name.
339
+
340
+
Using one of these approaches will allow the client to contact the domain controller in the Microsoft Entra Domain Services domain to request and receive Kerberos tickets.
341
+
342
+
For example:
343
+
344
+
```
345
+
net use Z: \\<YourStorageAccountName>.file.core.windows.net\<FileShareName> /user:<DOMAINNAME\username>
346
+
```
347
+
348
+
or
349
+
350
+
```
351
+
net use Z: \\<YourStorageAccountName>.file.core.windows.net\<FileShareName> /user:<username@domainFQDN>
0 commit comments