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
+95-19Lines changed: 95 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -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,25 @@ 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 identities, Azure defaults to system assigned. Assign only one for best results.
196
+
197
+
#### Enable a system assigned managed identity
198
+
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
+
#### Enable a user assigned managed identity
195
204
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).
205
+
1. Sign in to the Azure portal and follow the steps in [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).
197
206
198
-
1. Go to the managed identity you just created and copy the **Client ID**. You need this value later.
207
+
1. Go to the user assigned managed identity you just created and copy the **Client ID**. You need this value later.
208
+
209
+
### Assign a built-in RBAC role to the managed identity
199
210
200
211
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
212
@@ -207,15 +218,19 @@ To configure a managed identity on a Linux VM running in Azure, follow these ste
207
218
208
219
1. Under **Members**, select **+ Select members**. The **Select managed identities** pane appears.
209
220
210
-
1. Under **Managed identity**, select the user assigned managed identity that you created, and then click **Select**.
221
+
1. Under **Managed identity**, select the managed identity, and then click **Select**.
211
222
212
223
1. You should now see the managed identity listed under **Members**. Select **Next**.
213
224
214
225
1. Select **Review + assign** to add the role assignment to the storage account.
215
226
227
+
### Add user assigned managed identity to VM
228
+
229
+
If you created a user assigned managed identity, follow these steps.
230
+
216
231
1. Go to your VM. From the service menu, under **Security**, select **Identity**.
217
232
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**.
233
+
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
234
220
235
---
221
236
@@ -284,6 +299,50 @@ tdnf update
284
299
tdnf install azfilesauth
285
300
```
286
301
302
+
#### RHEL 9.6+
303
+
304
+
Run the following commands to install `azfilesauth` on RHEL 9.6+:
You have two options for configuring authentication on Linux:
316
375
317
-
-**Use a VM managed identity:** Select this option when your VM has a user-assigned managed identity assigned.
376
+
- **Use a VM managed identity:** Select this option if your VM has a managed identity assigned.
318
377
- **Supply the OAuth token directly**: Select this option if you're managing OAuth tokens yourself.
319
378
320
379
#### Option 1: Use a VM managed identity
321
380
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.
381
+
You can use a system assigned or user assigned managed identity to configure authentication.
382
+
383
+
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 `<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.
323
384
324
385
```bash
325
-
# Get a token from the Azure Instance Metadata Service (IMDS) and store it automatically
326
386
sudo azfilesauthmanager set https://<storage_account>.file.core.windows.net --imds-client-id <client-id>
327
-
# Verify the ticket was created properly
387
+
```
388
+
389
+
If your VM has a system assigned managed identity, use the `--system` flag:
390
+
391
+
```bash
392
+
sudo azfilesauthmanager set https://<storage_account>.file.core.windows.net --imds-client-id <client-id> --system
393
+
```
394
+
395
+
Verify the ticket was created properly:
396
+
397
+
```bash
328
398
sudo azfilesauthmanager list
329
399
```
330
400
@@ -357,10 +427,10 @@ For more information, see [Mount SMB Azure file share on Windows](storage-how-to
357
427
358
428
### [Linux](#tab/linux)
359
429
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`
430
+
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
431
362
432
```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
433
+
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
434
```
365
435
366
436
Verify that the mount succeeded:
@@ -373,14 +443,20 @@ For more information, see [Mount SMB Azure file shares on Linux clients](storage
373
443
374
444
### Refresh your credentials
375
445
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.
446
+
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
447
378
448
```bash
379
-
sudo systemctl start azfilesauth
449
+
sudo systemctl start azfilesrefresh
380
450
```
381
451
382
452
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
453
454
+
To persist the settings and enable the refresh service to start on every boot up:
0 commit comments