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
@@ -42,101 +42,257 @@ For more information about Azure Storage Explorer, see [Get started with Storage
42
42
43
43
### Getting Started with Storage API
44
44
45
-
One important difference to remember when connecting with the Storage API is that the URL for storage in Azure Government is different than the URL for storage in commercial Azure. Specifically, the domain ends with "core.usgovcloudapi.net", rather than "core.windows.net".
45
+
One important difference to remember when connecting with the Storage API is that the URL for storage in Azure Government is different than the URL for storage in commercial Azure. Specifically, the domain ends with `core.usgovcloudapi.net`, rather than `core.windows.net`. These endpoint differences must be taken into account when you connect to storage in Azure Government with a client library.
46
46
47
-
These endpoint differences must be taken into account when you connect to storage in Azure Government with C#.
48
-
1. Go to the [Azure Government portal](https://portal.azure.us) and select your storage account and then click the "Access Keys" tab:
47
+
Application requests to Azure Storage must be authorized. Using the `DefaultAzureCredential` class provided by the Azure Identity client library is the recommended approach for implementing passwordless connections to Azure services in your code.
2. Copy/paste the storage account connection string.
49
+
You can also authorize requests to Azure Storage by using the account access key. However, this approach should be used with caution. Developers must be diligent to never expose the access key in an unsecure location. Anyone who has the access key is able to authorize requests against the storage account, and effectively has access to all the data. `DefaultAzureCredential` offers improved management and security benefits over the account key to allow passwordless authentication. Both options are demonstrated in the following examples.
52
50
53
-
#### C#
51
+
#### C#/.NET
54
52
55
-
1.Open Visual Studio and create a new project. Add a reference to the [Azure Tables client library for .NET](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/tables/Azure.Data.Tables). This package contains classes for connecting to your Storage Table account.
53
+
Open Visual Studio and create a new project. Add a reference to the [Azure Tables client library for .NET](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/tables/Azure.Data.Tables). This package contains classes for connecting to your Storage Table account.
An easy and secure way to authorize access and connect to Azure Storage is to obtain an OAuth token by creating a [DefaultAzureCredential](/dotnet/api/azure.identity.defaultazurecredential) instance. You can then use that credential to create a `TableServiceClient` object, as shown in the following code example:
To learn more about authorizing access to data in Azure Storage, see [Authenticate to Azure and authorize access to data](../../articles/storage/blobs/storage-quickstart-blobs-dotnet.md#authenticate-to-azure-and-authorize-access-to-blob-data).
73
+
74
+
#### [Connection string](#tab/connectionstring)
75
+
76
+
Add these lines of C# code to connect using a connection string:
> The account access key should be used with caution. If your account access key is lost or accidentally placed in an insecure location, your service may become vulnerable. Anyone who has the access key is able to authorize requests against the storage account, and effectively has access to all the data. `DefaultAzureCredential` provides enhanced security features and benefits and is the recommended approach for managing authorization to Azure services.
95
+
96
+
---
97
+
98
+
At this point, we can interact with Storage as we normally would. The following example shows how to retrieve a specific entity from Table Storage:
1. Download the [Azure Tables client library for Java](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/tables/azure-data-tables) and configure your project correctly.
75
-
2. Create a "test" class where we'll access Azure Table Storage using the Azure Tables client library.
76
-
77
-
Copy and paste the code below, and **paste** your Storage Account connection string into the `AZURE_STORAGE_CONNECTION_STRING` environment variable.
Download the [Azure Tables client library for Java](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/tables/azure-data-tables) and configure your project correctly.
An easy and secure way to authorize access and connect to Azure Storage is to obtain an OAuth token by creating a [DefaultAzureCredential](/java/api/overview/azure/identity-readme#defaultazurecredential) instance. You can then use that credential to create a `TableServiceClient` object, as shown in the following code example:
To learn more about authorizing access to data in Azure Storage, see [Authenticate to Azure and authorize access to data](../../articles/storage/blobs/storage-quickstart-blobs-java.md#authenticate-to-azure-and-authorize-access-to-blob-data).
155
+
156
+
#### [Connection string](#tab/connectionstring)
157
+
158
+
Create a "test" class where we'll access Azure Table Storage using the Azure Tables client library.
159
+
160
+
Copy and paste the code below, and **paste** your Storage Account connection string into the `AZURE_STORAGE_CONNECTION_STRING` environment variable.
> The account access key should be used with caution. If your account access key is lost or accidentally placed in an insecure location, your service may become vulnerable. Anyone who has the access key is able to authorize requests against the storage account, and effectively has access to all the data. `DefaultAzureCredential` provides enhanced security features and benefits and is the recommended approach for managing authorization to Azure services.
198
+
199
+
---
112
200
113
201
#### Node.js
114
-
1.Download the [AzureStorageBlob client library forNode.js](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-blob) and configure your application correctly.
115
-
2.The following code below connects to AzureBlobStorage and creates a Container using the AzureStorageAPI.
116
-
**Paste** your AzureStorage account connection string into the `AZURE_STORAGE_CONNECTION_STRING` environment variable.
117
-
118
-
```javascript
119
-
var { BlobServiceClient } = require("@azure/storage-blob");
120
-
var storageConnectionString = process.env["AZURE_STORAGE_CONNECTION_STRING"];
121
-
var blobServiceClient =BlobServiceClient.fromConnectionString(storageConnectionString);
122
-
var containerClient = blobServiceClient.getContainerClient('testing');
123
-
containerClient.createIfNotExists();
124
-
```
202
+
203
+
Download the [Azure Storage Blob client library for Node.js](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-blob) and configure your application correctly.
An easy and secure way to authorize access and connect to Azure Storage is to obtain an OAuth token by creating a [DefaultAzureCredential](/javascript/api/overview/azure/identity-readme#defaultazurecredential) instance. You can then use that credential to create a `BlobServiceClient` object, as shown in the following code example:
var containerClient =blobServiceClient.getContainerClient('testing');
229
+
containerClient.createIfNotExists();
230
+
```
231
+
232
+
To learn more about authorizing access to data in Azure Storage, see [Authenticate to Azure and authorize access to data](../../articles/storage/blobs/storage-quickstart-blobs-nodejs.md#authenticate-to-azure-and-authorize-access-to-blob-data).
233
+
234
+
#### [Connection string](#tab/connectionstring)
235
+
236
+
The following code below connects to Azure Blob Storage and creates a Container using the Azure Storage API.
237
+
**Paste** your Azure Storage account connection string into the `AZURE_STORAGE_CONNECTION_STRING` environment variable.
238
+
239
+
```javascript
240
+
var { BlobServiceClient } =require("@azure/storage-blob");
241
+
var storageConnectionString =process.env["AZURE_STORAGE_CONNECTION_STRING"];
242
+
var blobServiceClient =BlobServiceClient.fromConnectionString(storageConnectionString);
243
+
var containerClient =blobServiceClient.getContainerClient('testing');
244
+
containerClient.createIfNotExists();
245
+
```
246
+
247
+
> [!IMPORTANT]
248
+
> The account access key should be used with caution. If your account access key is lost or accidentally placed in an insecure location, your service may become vulnerable. Anyone who has the access key is able to authorize requests against the storage account, and effectively has access to all the data. `DefaultAzureCredential` provides enhanced security features and benefits and is the recommended approach for managing authorization to Azure services.
249
+
250
+
---
125
251
126
252
#### Python
127
-
1.Download the [AzureStorageBlob client library forPython](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob).
128
-
2.When using the Storage library forPython to connect to AzureGovernment, paste your Azure storage connection string in the `AZURE_STORAGE_CONNECTION_STRING` environment variable.
253
+
254
+
Download the [Azure Storage Blob client library for Python](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-blob).
An easy and secure way to authorize access and connect to Azure Storage is to obtain an OAuth token by creating a [DefaultAzureCredential](/python/api/overview/azure/identity-readme#defaultazurecredential) instance. You can then use that credential to create a `BlobServiceClient` object, as shown in the following code example:
259
+
260
+
```python
261
+
from azure.identity import DefaultAzureCredential, AzureAuthorityHosts
To learn more about authorizing access to data in Azure Storage, see [Authenticate to Azure and authorize access to data](../../articles/storage/blobs/storage-quickstart-blobs-python.md#authenticate-to-azure-and-authorize-access-to-blob-data).
276
+
277
+
#### [Connection string](#tab/connectionstring)
278
+
279
+
When using the Storage library for Python to connect to Azure Government, paste your Azure storage connection string in the `AZURE_STORAGE_CONNECTION_STRING` environment variable.
129
280
130
-
```python
131
-
# Create the BlobServiceClient that is used to call the Blob service for the storage account
> The account access key should be used with caution. If your account access key is lost or accidentally placed in an insecure location, your service may become vulnerable. Anyone who has the access key is able to authorize requests against the storage account, and effectively has access to all the data. `DefaultAzureCredential` provides enhanced security features and benefits and is the recommended approach for managing authorization to Azure services.
0 commit comments