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/hdinsight/hdinsight-storage-sharedaccesssignature-permissions.md
+16-19Lines changed: 16 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,9 +5,9 @@ author: hrasheed-msft
5
5
ms.author: hrasheed
6
6
ms.reviewer: jasonh
7
7
ms.service: hdinsight
8
-
ms.custom: hdinsightactive
9
8
ms.topic: conceptual
10
-
ms.date: 11/13/2019
9
+
ms.custom: hdinsightactive
10
+
ms.date: 04/14/2020
11
11
---
12
12
13
13
# Use Azure Storage Shared Access Signatures to restrict access to data in HDInsight
@@ -22,8 +22,6 @@ HDInsight has full access to data in the Azure Storage accounts associated with
22
22
23
23
## Prerequisites
24
24
25
-
* An Azure subscription.
26
-
27
25
* An SSH client. For more information, see [Connect to HDInsight (Apache Hadoop) using SSH](./hdinsight-hadoop-linux-use-ssh-unix.md).
28
26
29
27
* An existing [storage container](../storage/blobs/storage-quickstart-blobs-portal.md).
@@ -36,7 +34,7 @@ HDInsight has full access to data in the Azure Storage accounts associated with
36
34
37
35
* If using C#, Visual Studio must be version 2013 or higher.
38
36
39
-
* The [URI scheme](./hdinsight-hadoop-linux-information.md#URI-and-scheme) for your storage account. This would be `wasb://` for Azure Storage, `abfs://` for Azure Data Lake Storage Gen2 or `adl://` for Azure Data Lake Storage Gen1. If secure transfer is enabled for Azure Storage, the URI would be `wasbs://`. See also, [secure transfer](../storage/common/storage-require-secure-transfer.md).
37
+
* The [URI scheme](./hdinsight-hadoop-linux-information.md#URI-and-scheme) for your storage account. This scheme would be `wasb://` for Azure Storage, `abfs://` for Azure Data Lake Storage Gen2 or `adl://` for Azure Data Lake Storage Gen1. If secure transfer is enabled for Azure Storage, the URI would be `wasbs://`. See also, [secure transfer](../storage/common/storage-require-secure-transfer.md).
40
38
41
39
* An existing HDInsight cluster to add a Shared Access Signature to. If not, you can use Azure PowerShell to create a cluster and add a Shared Access Signature during cluster creation.
42
40
@@ -51,11 +49,11 @@ HDInsight has full access to data in the Azure Storage accounts associated with
51
49
52
50
There are two forms of Shared Access Signatures:
53
51
54
-
* Ad hoc: The start time, expiry time, and permissions for the SAS are all specified on the SAS URI.
52
+
*`Ad hoc`: The start time, expiry time, and permissions for the SAS are all specified on the SAS URI.
55
53
56
-
* Stored access policy: A stored access policy is defined on a resource container, such as a blob container. A policy can be used to manage constraints for one or more shared access signatures. When you associate a SAS with a stored access policy, the SAS inherits the constraints - the start time, expiry time, and permissions - defined for the stored access policy.
54
+
*`Stored access policy`: A stored access policy is defined on a resource container, such as a blob container. A policy can be used to manage constraints for one or more shared access signatures. When you associate a SAS with a stored access policy, the SAS inherits the constraints - the start time, expiry time, and permissions - defined for the stored access policy.
57
55
58
-
The difference between the two forms is important for one key scenario: revocation. A SAS is a URL, so anyone who obtains the SAS can use it, regardless of who requested it to begin with. If a SAS is published publicly, it can be used by anyone in the world. A SAS that is distributed is valid until one of four things happens:
56
+
The difference between the two forms is important for one key scenario: revocation. A SAS is a URL, so anyone who obtains the SAS can use it. It doesn't matter who requested it to begin with. If a SAS is published publicly, it can be used by anyone in the world. A SAS that is distributed is valid until one of four things happens:
59
57
60
58
1. The expiry time specified on the SAS is reached.
61
59
@@ -77,7 +75,7 @@ For more information on Shared Access Signatures, see [Understanding the SAS mod
77
75
78
76
## Create a stored policy and SAS
79
77
80
-
Save the SAS token that is produced at the end of each method. The token will look similar to the following:
78
+
Save the SAS token that is produced at the end of each method. The token will look similar to the following output:
@@ -200,29 +198,28 @@ Open the `SASToken.py` file and replace `storage_account_name`, `storage_account
200
198
201
199
You may need to execute `pip install --upgrade azure-storage` if you receive the error message `ImportError: No module named azure.storage`.
202
200
203
-
### Using C#
201
+
### Using C\#
204
202
205
203
1. Open the solution in Visual Studio.
206
204
207
205
2. In Solution Explorer, right-click on the **SASExample** project and select **Properties**.
208
206
209
207
3. Select **Settings** and add values for the following entries:
210
208
211
-
* StorageConnectionString: The connection string for the storage account that you want to create a stored policy and SAS for. The format should be `DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=mykey` where `myaccount` is the name of your storage account and `mykey` is the key for the storage account.
212
-
213
-
* ContainerName: The container in the storage account that you want to restrict access to.
214
-
215
-
* SASPolicyName: The name to use for the stored policy to create.
216
-
217
-
* FileToUpload: The path to a file that is uploaded to the container.
209
+
|Item |Description |
210
+
|---|---|
211
+
|StorageConnectionString|The connection string for the storage account that you want to create a stored policy and SAS for. The format should be `DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=mykey` where `myaccount` is the name of your storage account and `mykey` is the key for the storage account.|
212
+
|ContainerName|The container in the storage account that you want to restrict access to.|
213
+
|SASPolicyName|The name to use for the stored policy to create.|
214
+
|FileToUpload|The path to a file that is uploaded to the container.|
218
215
219
216
4. Run the project. Save the SAS policy token, storage account name, and container name. These values are used when associating the storage account with your HDInsight cluster.
220
217
221
218
## Use the SAS with HDInsight
222
219
223
-
When creating an HDInsight cluster, you must specify a primary storage account and you can optionally specify additional storage accounts. Both of these methods of adding storage require full access to the storage accounts and containers that are used.
220
+
When creating an HDInsight cluster, you must specify a primary storage account. You can also specify additional storage accounts. Both of these methods of adding storage require full access to the storage accounts and containers that are used.
224
221
225
-
To use a Shared Access Signature to limit access to a container, add a custom entry to the **core-site** configuration for the cluster. You can add the entry during cluster creation using PowerShell or after cluster creation using Ambari.
222
+
Use a Shared Access Signature to limit container access. Add a custom entry to the **core-site** configuration for the cluster. You can add the entry during cluster creation using PowerShell or after cluster creation using Ambari.
0 commit comments