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
@@ -4,7 +4,7 @@ description: This article explains how you can authenticate managed identities t
4
4
author: khdownie
5
5
ms.service: azure-file-storage
6
6
ms.topic: how-to
7
-
ms.date: 03/04/2026
7
+
ms.date: 03/16/2026
8
8
ms.author: kendownie
9
9
ms.custom:
10
10
- devx-track-azurepowershell
@@ -41,15 +41,15 @@ Benefits include:
41
41
42
42
Azure provides two types of managed identities: **system assigned** and **user assigned**.
43
43
44
-
A system assigned managed identity is restricted to one per resource and is tied to the lifecycle of this resource. You can grant permissions to the managed identity by using Azure role-based access control (Azure RBAC). The managed identity is authenticated with Microsoft Entra ID, so you don’t have to store any credentials in code. System assigned managed identities aren't supported on Linux VMs.
44
+
A system assigned managed identity is restricted to one per resource and is tied to the lifecycle of this resource. You can grant permissions to the managed identity by using Azure role-based access control (Azure RBAC). The managed identity is authenticated with Microsoft Entra ID, so you don’t have to store any credentials in code.
45
45
46
46
User assigned managed identities enable Azure resources to authenticate to cloud services without storing credentials in code. You create this type of managed identity as a standalone Azure resource with its own lifecycle. A single resource, like a VM, can use multiple user assigned managed identities. Also, multiple VMs can share a single user assigned managed identity.
47
47
48
-
You can configure both user assigned and system assigned managed identities on Windows VMs.
48
+
Although you can configure both user assigned and system assigned managed identities on a single VM, we recommend using one or the other.
49
49
50
50
## Prerequisites
51
51
52
-
This article assumes that you have an Azure subscription with permissions to create storage accounts and assign Azure RBAC roles. To assign roles, you need role assignments write permission (Microsoft.Authorization/roleAssignments/write) at the scope you want to assign the role.
52
+
This article assumes that you have an Azure subscription with permissions to create storage accounts and assign Azure RBAC roles. To assign roles, you need role assignments write permission (`Microsoft.Authorization/roleAssignments/write`) at the scope you want to assign the role.
53
53
54
54
The clients that need to authenticate by using a managed identity shouldn't be joined to any domain.
55
55
@@ -155,7 +155,7 @@ The enablement steps described here are for Azure VMs. If you want to enable a m
155
155
156
156
### Enable managed identity on an Azure VM
157
157
158
-
Follow these steps to enable a managed identity on an Azure VM.
158
+
Follow these steps to enable a managed identity on a Windows VM running in Azure.
159
159
160
160
1. Sign in to the Azure portal and create a Windows VM. Your VM must run Windows Server 2019 or higher for server versions, or any Windows client version. See [Create a Windows virtual machine in the Azure portal](/azure/virtual-machines/windows/quick-create-portal).
161
161
@@ -188,14 +188,27 @@ Follow these steps to assign the built-in Azure RBAC role [Storage File Data SMB
188
188
189
189
### [Linux](#tab/linux)
190
190
191
-
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, or Ubuntu 24.04.
191
+
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+.
192
192
193
-
> [!NOTE]
194
-
> System assigned managed identities aren't supported on Linux VMs. You must create a user assigned managed identity.
193
+
### Enable managed identity on an Azure VM
194
+
195
+
The managed identity can be either [system assigned or user assigned](/entra/identity/managed-identities-azure-resources/overview#differences-between-system-assigned-and-user-assigned-managed-identities). If the VM has both system assigned and user assigned managed identities, Azure defaults to system assigned. Assign only one for best results.
196
+
197
+
#### Enable a system assigned managed identity
195
198
196
-
1. Sign in to the Azure portal and [create a user assigned managed identity](/entra/identity/managed-identities-azure-resources/manage-user-assigned-managed-identities-azure-portal#create-a-user-assigned-managed-identity).
199
+
1. Sign in to the Azure portal.
200
+
201
+
1. You can enable a system assigned managed identity during VM creation on the **Management** tab. See [Create a Linux virtual machine in the Azure portal](/azure/virtual-machines/linux/quick-create-portal).
202
+
203
+
:::image type="content" source="media/managed-identities/enable-system-assigned-managed-identity.png" alt-text="Screenshot showing how to enable system assigned managed identity when creating a new VM using the Azure portal." border="true":::
197
204
198
-
1. Go to the managed identity you just created and copy the **Client ID**. You need this value later.
205
+
#### Enable a user assigned managed identity
206
+
207
+
1. Sign in to the Azure portal and follow the steps to [create a user assigned managed identity](/entra/identity/managed-identities-azure-resources/manage-user-assigned-managed-identities-azure-portal#create-a-user-assigned-managed-identity).
208
+
209
+
1. Go to the user assigned managed identity you just created and copy the **Client ID**. You need this value later.
210
+
211
+
### Assign a built-in RBAC role to the managed identity
199
212
200
213
1. Go to the storage account that contains the file share you want to mount by using a managed identity. Select **Access Control (IAM)** from the service menu.
201
214
@@ -207,15 +220,19 @@ To configure a managed identity on a Linux VM running in Azure, follow these ste
207
220
208
221
1. Under **Members**, select **+ Select members**. The **Select managed identities** pane appears.
209
222
210
-
1. Under **Managed identity**, select the user assigned managed identity that you created, and then click **Select**.
223
+
1. Under **Managed identity**, select the managed identity, and then click **Select**.
211
224
212
225
1. You should now see the managed identity listed under **Members**. Select **Next**.
213
226
214
227
1. Select **Review + assign** to add the role assignment to the storage account.
215
228
229
+
### Add user assigned managed identity to VM
230
+
231
+
If you created a user assigned managed identity, follow these steps to add it to your VM.
232
+
216
233
1. Go to your VM. From the service menu, under **Security**, select **Identity**.
217
234
218
-
1. Select the **User assigned** tab, and then select **Add user assigned managed identity**. Select the user assigned managed identity you created, and then select **Add**.
235
+
1. Select the **User assigned** tab, and then select **Add user assigned managed identity**. Select the managed identity you created, and then select **Add**.
219
236
220
237
---
221
238
@@ -284,6 +301,50 @@ tdnf update
284
301
tdnf install azfilesauth
285
302
```
286
303
304
+
#### RHEL 9.6+
305
+
306
+
Run the following commands to install `azfilesauth` on RHEL 9.6+:
You have two options for configuring authentication on Linux:
316
377
317
-
-**Use a VM managed identity:** Select this option when your VM has a user-assigned managed identity assigned.
378
+
- **Use a VM managed identity:** Select this option if your VM has a managed identity assigned.
318
379
- **Supply the OAuth token directly**: Select this option if you're managing OAuth tokens yourself.
319
380
320
381
#### Option 1: Use a VM managed identity
321
382
322
-
If your VM has a user-assigned managed identity, run the following commands. Be sure to replace `<client-id>` with the client ID of your managed identity. If you don't have the Client ID, go to the managed identity and copy the Client ID.
383
+
You can use a system assigned or user assigned managed identity to configure authentication.
384
+
385
+
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.
386
+
387
+
```bash
388
+
sudo azfilesauthmanager set https://<storage-account-name>.file.core.windows.net --imds-client-id <client-id>
389
+
```
390
+
391
+
If your VM has a system assigned managed identity, use the `--system` flag:
392
+
393
+
```bash
394
+
sudo azfilesauthmanager set https://<storage-account-name>.file.core.windows.net --imds-client-id <client-id> --system
395
+
```
396
+
397
+
Verify the ticket was created properly:
323
398
324
399
```bash
325
-
# Get a token from the Azure Instance Metadata Service (IMDS) and store it automatically
326
-
sudo azfilesauthmanager set https://<storage_account>.file.core.windows.net --imds-client-id <client-id>
327
-
# Verify the ticket was created properly
328
400
sudo azfilesauthmanager list
329
401
```
330
402
@@ -357,10 +429,10 @@ For more information, see [Mount SMB Azure file share on Windows](storage-how-to
357
429
358
430
### [Linux](#tab/linux)
359
431
360
-
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`
432
+
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. For a system assigned managed identity, omit the mount option `username=<client-id>`.
361
433
362
434
```bash
363
-
sudo mount -t cifs //<storage-account-name>.file.core.windows.net/<file-share-name> /mnt/smb -o sec=krb5,cruid=<credential-id>,dir_mode=0755,file_mode=0755,serverino,nosharesock,mfsymlinks,actimeo=30
435
+
sudo mount -t cifs //<storage-account-name>.file.core.windows.net/<file-share-name> /mnt/smb -o sec=krb5,cruid=<credential-id>,username=<client-id>,dir_mode=0755,file_mode=0755,serverino,nosharesock,mfsymlinks,actimeo=30
364
436
```
365
437
366
438
Verify that the mount succeeded:
@@ -373,14 +445,20 @@ For more information, see [Mount SMB Azure file shares on Linux clients](storage
373
445
374
446
### Refresh your credentials
375
447
376
-
After you mount the file share for the first time, start the refresh service to keep credentials up to date. You can only refresh credentials if your VM has a user-assigned managed identity assigned. If you're supplying the OAuth token directly, the refresh doesn't work.
448
+
The refresh service automatically detects and refreshes credentials. After you mount the file share for the first time, start the refresh service to keep credentials up to date. You can only refresh credentials if your VM has a managed identity assigned. If you're supplying the OAuth token directly, the refresh doesn't work.
377
449
378
450
```bash
379
-
sudo systemctl start azfilesauth
451
+
sudo systemctl start azfilesrefresh
380
452
```
381
453
382
454
You should refresh your credentials periodically to avoid access interruptions. You can refresh credentials manually by using the `azfilesauthmanager set` command as described in [Configure authentication](#configure-authentication), or you can automate the refresh by using the shared library APIs.
383
455
456
+
To persist the settings and enable the refresh service to start on every boot up:
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.
524
+
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.
447
525
448
526
Be sure to include the [public header](https://github.com/Azure/AzFilesAuthenticator/blob/main/include/azfilesauth.h).
0 commit comments