Skip to content

Commit 3ba6bdd

Browse files
Merge pull request #312618 from khdownie/kendownie030426-6
Files OAuth over REST integrity check
2 parents 05205f4 + c5556b5 commit 3ba6bdd

1 file changed

Lines changed: 18 additions & 30 deletions

File tree

articles/storage/files/authorize-oauth-rest.md

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,14 @@ ms.custom:
1515

1616
# Access Azure file shares using Microsoft Entra ID with Azure Files OAuth over REST
1717

18+
:heavy_check_mark: **Applies to:** Classic file shares created with the Microsoft.Storage resource provider
19+
20+
:heavy_multiplication_x: **Doesn't apply to:** File shares created with the Microsoft.FileShares resource provider (preview)
21+
1822
By using Azure Files OAuth over REST, users and applications can get admin-level read and write access to Azure file shares through the [OAuth](https://oauth.net/) authentication protocol. This access method uses Entra ID for REST API based access. Users, groups, first-party services such as Azure portal, and third-party services and applications using REST interfaces can now use OAuth authentication and authorization with a Microsoft Entra account to access data in Azure Files. PowerShell cmdlets and Azure CLI commands that call REST APIs can also use OAuth to access Azure Files. You must call the REST API using an explicit header to indicate your intent to use the additional privilege. This requirement also applies to Azure PowerShell and Azure CLI access.
1923

2024
> [!IMPORTANT]
21-
> This article explains how to enable admin-level access to Azure file shares for specific [customer use cases](#customer-use-cases). For a more general article on identity-based authentication for end users, see [Overview of Azure Files identity-based authentication for SMB access](storage-files-active-directory-overview.md).
22-
23-
## Applies to
24-
| Management model | Billing model | Media tier | Redundancy | SMB | NFS |
25-
|-|-|-|-|:-:|:-:|
26-
| Microsoft.Storage | Provisioned v2 | HDD (standard) | Local (LRS) | ![Yes](../media/icons/yes-icon.png) | ![No](../media/icons/no-icon.png) |
27-
| Microsoft.Storage | Provisioned v2 | HDD (standard) | Zone (ZRS) | ![Yes](../media/icons/yes-icon.png) | ![No](../media/icons/no-icon.png) |
28-
| Microsoft.Storage | Provisioned v2 | HDD (standard) | Geo (GRS) | ![Yes](../media/icons/yes-icon.png) | ![No](../media/icons/no-icon.png) |
29-
| Microsoft.Storage | Provisioned v2 | HDD (standard) | GeoZone (GZRS) | ![Yes](../media/icons/yes-icon.png) | ![No](../media/icons/no-icon.png) |
30-
| Microsoft.Storage | Provisioned v1 | SSD (premium) | Local (LRS) | ![Yes](../media/icons/yes-icon.png) | ![Yes](../media/icons/yes-icon.png) |
31-
| Microsoft.Storage | Provisioned v1 | SSD (premium) | Zone (ZRS) | ![Yes](../media/icons/yes-icon.png) | ![Yes](../media/icons/yes-icon.png)|
32-
| Microsoft.Storage | Pay-as-you-go | HDD (standard) | Local (LRS) | ![Yes](../media/icons/yes-icon.png) | ![No](../media/icons/no-icon.png) |
33-
| Microsoft.Storage | Pay-as-you-go | HDD (standard) | Zone (ZRS) | ![Yes](../media/icons/yes-icon.png) | ![No](../media/icons/no-icon.png) |
34-
| Microsoft.Storage | Pay-as-you-go | HDD (standard) | Geo (GRS) | ![Yes](../media/icons/yes-icon.png) | ![No](../media/icons/no-icon.png) |
35-
| Microsoft.Storage | Pay-as-you-go | HDD (standard) | GeoZone (GZRS) | ![Yes](../media/icons/yes-icon.png) | ![No](../media/icons/no-icon.png) |
25+
> This article explains how to enable admin-level access to Azure file shares for specific [customer use cases](#customer-use-cases). For a more general article on identity-based authentication for end users, see [Overview of Azure Files identity-based authentication](storage-files-active-directory-overview.md).
3626
3727
## Limitations
3828

@@ -72,12 +62,12 @@ To use the Azure Files OAuth over REST feature, include extra permissions in the
7262

7363
Users, groups, or service principals who call the REST API by using OAuth must have either the `readFileBackupSemantics` or `writeFileBackupSemantics` action assigned to the role that grants data access. This is a requirement to use this feature. For details on the permissions required to call specific File service operations, see [Permissions for calling data operations](/rest/api/storageservices/authorize-with-azure-active-directory#permissions-for-calling-data-operations).
7464

75-
This feature provides two built-in roles that include these new actions.
65+
This feature provides two built-in roles that include these actions.
7666

7767
| **Role** | **Data actions** |
7868
|----------|------------------|
79-
| Storage File Data Privileged Reader | `Microsoft.Storage/storageAccounts/fileServices/fileShares/files/read`<br>`Microsoft.Storage/storageAccounts/fileServices/readFileBackupSemantics/action` |
80-
| Storage File Data Privileged Contributor | `Microsoft.Storage/storageAccounts/fileServices/fileShares/files/read`<br>`Microsoft.Storage/storageAccounts/fileServices/fileShares/files/write`<br>`Microsoft.Storage/storageAccounts/fileServices/fileShares/files/delete`<br>`Microsoft.Storage/storageAccounts/fileServices/writeFileBackupSemantics/action`<br>`Microsoft.Storage/storageAccounts/fileServices/fileshares/files/modifypermissions/action` |
69+
| [Storage File Data Privileged Reader](../../role-based-access-control/built-in-roles.md#storage-file-data-privileged-reader) | `Microsoft.Storage/storageAccounts/fileServices/fileshares/files/read`<br>`Microsoft.Storage/storageAccounts/fileServices/readFileBackupSemantics/action` |
70+
| [Storage File Data Privileged Contributor](../../role-based-access-control/built-in-roles.md#storage-file-data-privileged-contributor) | `Microsoft.Storage/storageAccounts/fileServices/fileshares/files/read`<br>`Microsoft.Storage/storageAccounts/fileServices/fileshares/files/write`<br>`Microsoft.Storage/storageAccounts/fileServices/fileshares/files/delete`<br>`Microsoft.Storage/storageAccounts/fileServices/writeFileBackupSemantics/action`<br>`Microsoft.Storage/storageAccounts/fileServices/fileshares/files/modifypermissions/action` |
8171

8272
These roles are similar to the [Storage File Data SMB Share Reader](../../role-based-access-control/built-in-roles.md#storage-file-data-smb-share-reader) and [Storage File Data SMB Share Elevated Contributor](../../role-based-access-control/built-in-roles.md#storage-file-data-smb-share-elevated-contributor) built-in roles, but there are some differences:
8373

@@ -176,9 +166,9 @@ You can also authorize access to file data by using the Azure portal, Azure Powe
176166

177167
# [Azure portal](#tab/portal)
178168

179-
The [Azure portal](https://portal.azure.com?azure-portal=true) can use either your Entra account or the storage account access key to access file data in an Azure storage account. Which authorization scheme the Azure portal uses depends on the Azure roles that are assigned to you.
169+
The [Azure portal](https://portal.azure.com?azure-portal=true) can use either your Entra account or the storage account access key to access file data in an Azure storage account. Which authorization method the Azure portal uses depends on the Azure roles that are assigned to you.
180170

181-
When you attempt to access file data, the Azure portal first checks whether you have an Azure role with `Microsoft.Storage/storageAccounts/listkeys/action`. If you have a role with this action, the Azure portal uses the account key for accessing file data via shared key authorization. If you don't have a role with this action, the Azure portal attempts to access data by using your Entra account.
171+
When you attempt to access file data, the Azure portal first checks whether you have an Azure role with `Microsoft.Storage/storageAccounts/listkeys/action`. If you have a role with this action, the Azure portal uses the storage account key for accessing file data via shared key authorization. If you don't have a role with this action, the Azure portal attempts to access data by using your Entra account.
182172

183173
To access file data from the Azure portal by using your Entra account, you need permissions to access file data, and you also need permissions to navigate through the storage account resources in the Azure portal. The built-in roles provided by Azure grant access to file resources, but they don't grant permissions to storage account resources. For this reason, access to the portal also requires assigning an Azure Resource Manager (ARM) role such as the **Reader** role, scoped to the level of the storage account or higher. The **Reader** role grants the most restrictive permissions, but any ARM role that grants access to storage account management resources is acceptable.
184174

@@ -202,17 +192,15 @@ The storage context with OAuth works only for operations on files and directorie
202192

203193
You need an Azure resource group and a storage account within that resource group. The storage account must be assigned a role that grants explicit permissions to perform data operations against file shares. Make sure that you have the required roles and permissions to access both the management services and data services. For details on the permissions required to call specific File service operations, see [Permissions for calling data operations](/rest/api/storageservices/authorize-with-azure-active-directory#permissions-for-calling-data-operations).
204194

205-
## Install Az.Storage module
206-
207-
This feature is available in the latest Az.Storage module. Install the module by using this command:
195+
You also need to install the latest [Az.Storage](https://www.powershellgallery.com/packages/Az.Storage/) module:
208196

209197
```azurepowershell-interactive
210198
Install-Module Az.Storage -Repository PsGallery
211199
```
212200

213201
## Authorize access to file data
214202

215-
To authorize access to file data, follow these steps.
203+
To authorize access to file data by using Azure PowerShell, follow these steps.
216204

217205
1. Sign in to your Azure account by using the `Connect-AzAccount` cmdlet.
218206

@@ -262,11 +250,11 @@ All commands under the `az storage file` and `az storage directory` command grou
262250

263251
You need an Azure resource group and a storage account within that resource group. The storage account must be assigned a role that grants explicit permissions to perform data operations against file shares. Make sure that you have the required roles and permissions to access both the management services and data services. For details on the permissions required to call specific File service operations, see [Permissions for calling data operations](/rest/api/storageservices/authorize-with-azure-active-directory#permissions-for-calling-data-operations).
264252

265-
## Installation and example commands
266-
267253
If you haven't already done so, [install the latest version of Azure CLI](/cli/azure/install-azure-cli).
268254

269-
### Authorize access to file data
255+
## Authorize access to file data
256+
257+
Follow these steps to authorize access to file data by using Azure CLI.
270258

271259
1. Sign in to your Azure account.
272260

@@ -280,16 +268,16 @@ If you haven't already done so, [install the latest version of Azure CLI](/cli/a
280268
az storage share create --name testshare1 --connection-string <connection-string>
281269
```
282270

283-
1. Create a test directory and upload a file into the file share by using `az storage directory create` and `az storage file upload`. Specify the `--auth` mode as `login` and pass the `--backup-intent` parameter.
271+
1. Create a test directory and upload a file into the file share by using `az storage directory create` and `az storage file upload`. Specify the `--auth-mode` as `login` and pass the `--backup-intent` parameter.
284272

285273
```azurecli
286274
az storage directory create --name testdir1 --account-name filesoauthsa --share-name testshare1 --auth-mode login --backup-intent
287275
az storage file upload --account-name filesoauthsa --share-name testshare1 --auth-mode login --backup-intent --source <source file path>
288276
```
289277

290-
Because the CLI commands use authentication type as `login` (`--auth mode` `login` and `--backup-intent` parameter), the file and directory are created by using Entra credentials.
278+
Because the CLI commands use authentication type as `login` (`--auth-mode login` with the `--backup-intent` parameter), the file and directory are created by using Entra credentials.
291279

292-
For more information, refer to the latest CLI documentation for supported commands:
280+
For more information, refer to the documentation for supported commands:
293281

294282
- [az storage file](/cli/azure/storage/file)
295283
- [az storage directory](/cli/azure/storage/directory)

0 commit comments

Comments
 (0)