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
Copy file name to clipboardExpand all lines: articles/storage/files/files-managed-identities.md
+32-21Lines changed: 32 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,7 @@ ms.date: 03/23/2026
8
8
ms.author: kendownie
9
9
ms.custom:
10
10
- devx-track-azurepowershell
11
+
zone_pivot_groups: azure-files-windows-linux
11
12
# Customer intent: As a cloud administrator, I want to improve security by authenticating managed identities to allow applications and virtual machines to access SMB Azure Files shares using identity-based authentication with Microsoft Entra ID instead of using a storage account key.
12
13
---
13
14
@@ -59,7 +60,7 @@ To authenticate a managed identity, you must enable the **SMBOAuth** property on
59
60
60
61
To enable the **SMBOAuth** property on your storage account, use either the Azure portal or Azure PowerShell. For instructions, select the appropriate tab.
61
62
62
-
### [Portal](#tab/windows)
63
+
### [Portal](#tab/portal)
63
64
64
65
To create a new storage account with the **SMBOAuth** property enabled by using the Azure portal, follow [these steps](create-classic-file-share.md#create-a-storage-account). Under the **Advanced** tab, select the **Enable Managed Identity for SMB** checkbox.
65
66
@@ -73,7 +74,7 @@ Go to the storage account. From the service menu, under **Settings**, select **C
73
74
74
75
Next, [create an SMB file share](create-classic-file-share.md) on the storage account.
75
76
76
-
### [PowerShell](#tab/linux)
77
+
### [PowerShell](#tab/powershell)
77
78
78
79
To enable the **SMBOAuth** property on your storage account by using Azure PowerShell, first prepare your PowerShell environment.
79
80
@@ -147,9 +148,9 @@ You now have a storage account and file share ready for SMB OAuth authentication
147
148
148
149
## Configure managed identity
149
150
150
-
You can use managed identities with Windows or Linux. Select the appropriate tab and follow the instructions for your operating system.
151
+
You can use managed identities with Windows or Linux. Select your operating system and follow the instructions.
151
152
152
-
### [Windows](#tab/windows)
153
+
::: zone pivot="windows"
153
154
154
155
The enablement steps described here are for Azure VMs. If you want to enable a managed identity on non-Azure Windows machines (on-premises or other cloud), you must [onboard them to Azure Arc and assign a managed identity](/azure/cloud-adoption-framework/scenarios/hybrid/arc-enabled-servers/eslz-identity-and-access-management). You can also authenticate by using an application identity instead of using a managed identity on a VM or Windows device.
155
156
@@ -203,7 +204,9 @@ If you created a user assigned managed identity, follow these steps to add it to
203
204
204
205
1. Select the **User assigned** tab, and then select **Add user assigned managed identity**. Select the managed identity you created, and then select **Add**.
205
206
206
-
### [Linux](#tab/linux)
207
+
::: zone-end
208
+
209
+
::: zone pivot="linux"
207
210
208
211
To configure a managed identity on a Linux VM running in Azure, follow these steps. Your VM must be running Azure Linux 3.0, Ubuntu 22.04, Ubuntu 24.04, RHEL 9.6+, or SLES 15 SP6+.
209
212
@@ -251,13 +254,13 @@ If you created a user assigned managed identity, follow these steps to add it to
251
254
252
255
1. Select the **User assigned** tab, and then select **Add user assigned managed identity**. Select the managed identity you created, and then select **Add**.
253
256
254
-
---
257
+
::: zone-end
255
258
256
259
## Prepare your client to authenticate by using a managed identity
257
260
258
261
Follow these steps to prepare your system to mount the file share using managed identity authentication. The steps are different for Windows and Linux clients. Clients shouldn't be domain joined.
259
262
260
-
### [Windows](#tab/windows)
263
+
::: zone pivot="windows"
261
264
262
265
To prepare your client VM or Windows device to authenticate by using a managed identity, follow these steps.
263
266
@@ -292,7 +295,7 @@ For a system assigned managed identity, run the following command to get an OAut
> To view complete usage information and examples, run the executable without any parameters: `AzFilesSmbMIClient.exe`
303
306
304
-
### [Linux](#tab/linux)
307
+
::: zone-end
308
+
309
+
::: zone pivot="linux"
305
310
306
311
To prepare your Linux VM to authenticate by using a managed identity, follow these steps.
307
312
@@ -399,13 +404,13 @@ You have two options for configuring authentication on Linux:
399
404
400
405
You can use a system assigned or user assigned managed identity to configure authentication.
401
406
402
-
If your VM has a user assigned managed identity, run the following command to get a token from the Azure Instance Metadata Service (IMDS) and store it automatically. Replace `<storage-account-name>` with your storage account name. Replace `<client-id>` with the client ID of your managed identity. If you don't have the Client ID, go to the managed identity in the Azure portal and copy the Client ID.
407
+
If your VM has a user assigned managed identity, run the following command to get a token from the Azure Instance Metadata Service (IMDS) and store it automatically. Replace `<storage-account-name>` with your storage account name. Replace `<client-id>` with the client ID of your managed identity. If you don't have the client ID, go to the managed identity in the Azure portal and copy the client ID.
403
408
404
409
```bash
405
410
sudo azfilesauthmanager set https://<storage-account-name>.file.core.windows.net --imds-client-id <client-id>
406
411
```
407
412
408
-
If your VM has a system assigned managed identity, use the `--system` flag:
413
+
If your VM has a system assigned managed identity, use the `--system` flag and don't supply a client ID:
409
414
410
415
```bash
411
416
sudo azfilesauthmanager set https://<storage-account-name>.file.core.windows.net --system
@@ -430,21 +435,23 @@ sudo azfilesauthmanager set https://<storage-account-name>.file.core.windows.net
430
435
sudo azfilesauthmanager list
431
436
```
432
437
433
-
---
438
+
::: zone-end
434
439
435
440
## Mount the file share
436
441
437
442
You can now mount the file share on Windows or Linux without using a storage account key.
438
443
439
-
### [Windows](#tab/windows)
444
+
::: zone pivot="windows"
440
445
441
446
On Windows clients, you can directly access your Azure file share using the UNC path by entering the following path into Windows File Explorer. Replace `<storage-account-name>` with your storage account name and `<file-share-name>` with your file share name:
For more information, see [Mount SMB Azure file share on Windows](storage-how-to-use-files-windows.md).
446
451
447
-
### [Linux](#tab/linux)
452
+
::: zone-end
453
+
454
+
::: zone pivot="linux"
448
455
449
456
Run the following command to mount the file share with the recommended mount options. Replace `<storage-account-name>` with your storage account name and `<file-share-name>` with your file share name. You can find your credential ID in the following config file: `cat /etc/azfilesauth/config.yaml`. For a user assigned managed identity, include the client ID of the managed identity using the `username=<client-id>` mount option. For a system assigned managed identity, omit the mount option `username=<client-id>`.
Automatic credential refresh requires a managed identity assigned to your VM. If you're supplying the OAuth token directly, you must refresh credentials manually by using the `azfilesauthmanager set` command as described in [Configure authentication](#configure-authentication), or programmatically via the shared library APIs.
480
487
481
-
---
488
+
::: zone-end
482
489
483
490
## Troubleshooting
484
491
485
492
Troubleshooting steps are different for Windows and Linux clients.
486
493
487
-
### [Windows](#tab/windows)
494
+
::: zone pivot="windows"
488
495
489
496
If you encounter problems when mounting your file share on Windows, follow these steps to enable verbose logging and collect diagnostic information.
490
497
@@ -494,17 +501,19 @@ If you encounter problems when mounting your file share on Windows, follow these
494
501
495
502
1. You should now have a file named `AzFilesSmbMILog.log`. Send the log file to [email protected] for assistance.
496
503
497
-
### [Linux](#tab/linux)
504
+
::: zone-end
505
+
506
+
::: zone pivot="linux"
498
507
499
508
If you encounter problems when mounting your file share on Linux, follow [these SMB diagnostics steps](https://github.com/Azure-Samples/azure-files-samples/tree/master/SMBDiagnostics).
500
509
501
-
---
510
+
::: zone-end
502
511
503
512
## Client library installation and integration options
504
513
505
514
The following information is for developers who need to integrate managed identities into their applications.
506
515
507
-
### [Windows](#tab/windows)
516
+
::: zone pivot="windows"
508
517
509
518
For developers who need to integrate managed identities into their Windows applications, multiple implementation approaches are available depending on your application architecture and requirements.
Linux developers can use the shared library that's automatically installed with the `azfilesauth` package. You can link against the library in your C/C++ applications for direct API access.
544
555
@@ -581,7 +592,7 @@ The following table lists the API commands and their usage. Returned values foll
581
592
|`extern_smb_list_credential()`| Lists all stored credentials. |
582
593
|`extern_smb_version()`| Returns the version string of the azfilesauth library. |
0 commit comments