Skip to content

Commit be40cb5

Browse files
More edits
1 parent 7e0823e commit be40cb5

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

articles/storage/blobs/storage-quickstart-blobs-go.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,15 @@ Get started with the Azure Blob Storage client library for Go to manage blobs an
2222

2323
- Azure subscription - [create one for free](https://azure.microsoft.com/free/)
2424
- Azure storage account - [create a storage account](../common/storage-account-create.md)
25-
- [Go 1.18 or above](https://go.dev/dl/)
26-
- [Azure Blob Storage SDK for Go](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/), using the following command:
25+
- [Go 1.18+](https://go.dev/dl/)
26+
27+
## Setting up
28+
29+
This section walks you through preparing a project to work with the Azure Blob Storage client library for Go.
30+
31+
### Install the packages
32+
33+
- To work with blob and container resources in a storage account, install the [azblob](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/) package using the following command:
2734

2835
```
2936
go get github.com/Azure/azure-sdk-for-go/sdk/storage/azblob
@@ -34,7 +41,7 @@ Get started with the Azure Blob Storage client library for Go to manage blobs an
3441
go get github.com/Azure/azure-sdk-for-go/sdk/azidentity
3542
```
3643
37-
## Download the sample application
44+
### Download the sample application
3845
3946
The [sample application](https://github.com/Azure-Samples/storage-blobs-go-quickstart.git) used in this quickstart is a basic Go application.
4047
@@ -46,7 +53,7 @@ git clone https://github.com/Azure-Samples/storage-blobs-go-quickstart
4653

4754
This command clones the repository to your local git folder. To open the Go sample for Blob storage, look for `storage-quickstart.go` file.
4855

49-
### Authenticate to Azure and authorize access to blob data
56+
## Authenticate to Azure and authorize access to blob data
5057

5158
[!INCLUDE [storage-quickstart-passwordless-auth-intro](../../../includes/storage-quickstart-passwordless-auth-intro.md)]
5259

@@ -56,11 +63,11 @@ The order and locations in which `DefaultAzureCredential` looks for credentials
5663

5764
For example, your app can authenticate using your Azure CLI sign-in credentials with when developing locally. Your app can then use a [managed identity](../../active-directory/managed-identities-azure-resources/overview.md) once it has been deployed to Azure. No code changes are required for this transition.
5865

59-
#### Assign roles to your Azure AD user account
66+
### Assign roles to your Azure AD user account
6067

6168
[!INCLUDE [assign-roles](../../../includes/assign-roles.md)]
6269

63-
#### Sign-in and connect your app code to Azure using DefaultAzureCredential
70+
### Sign-in and connect your app code to Azure using DefaultAzureCredential
6471

6572
You can authorize access to data in your storage account using the following steps:
6673

@@ -76,7 +83,7 @@ You can authorize access to data in your storage account using the following ste
7683
go get github.com/Azure/azure-sdk-for-go/sdk/azidentity
7784
```
7885
79-
Azure CLI authentication isn't recommended for applications running in Azure. When deployed to Azure, this same code can be used to authorize requests to Azure Storage from an application running in Azure. However, you'll need to enable managed identity on your app in Azure. Then configure your storage account to allow that managed identity to connect. For detailed instructions on configuring this connection between Azure services, see the [Auth from Azure-hosted apps](/developer/go/azure-sdk-authentication-managed-identity) tutorial.
86+
Azure CLI authentication isn't recommended for applications running in Azure. When deployed to Azure, this same code can be used to authorize requests to Azure Storage from an application running in Azure. However, you need to enable managed identity on your app in Azure and configure your storage account to allow that managed identity to connect. For detailed instructions on configuring this connection between Azure services, see the [Auth from Azure-hosted apps](/developer/go/azure-sdk-authentication-managed-identity) tutorial.
8087
8188
To learn more about different authentication methods, check out [Azure authentication with the Azure SDK for Go](/azure/developer/go/azure-sdk-authentication).
8289
@@ -150,10 +157,10 @@ handleError(err)
150157
```
151158

152159
### Create a container
153-
The code sample creates a new container resource in the storage account. If a container with the same name already exists, a `ResourceExistsError` will be raised.
160+
The code sample creates a new container resource in the storage account. If a container with the same name already exists, a `ResourceExistsError` is raised.
154161

155162
> [!IMPORTANT]
156-
> Container names must be lowercase. See [Naming and Referencing Containers, Blobs, and Metadata](/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata) for more information about container and blob names.
163+
> Container names must be lowercase. To learn more about naming requirements for containers and blobs, see [Naming and Referencing Containers, Blobs, and Metadata](/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata).
157164
158165
The following code example creates a new container called *quickstart-sample-container* in the storage account:
159166

@@ -207,7 +214,7 @@ for pager.More() {
207214

208215
### Download the blob
209216

210-
The code sample downloads a blob using the [DownloadStream](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob#Client.DownloadStream) method, and creates a retry reader for reading data. If a connection fails while reading, the retry reader will make other requests to re-establish a connection and continue reading. You can specify retry reader options using the [RetryReaderOptions](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob#RetryReaderOptions) struct.
217+
The code sample downloads a blob using the [DownloadStream](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob#Client.DownloadStream) method, and creates a retry reader for reading data. If a connection fails while reading, the retry reader makes other requests to re-establish a connection and continue reading. You can specify retry reader options using the [RetryReaderOptions](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob#RetryReaderOptions) struct.
211218

212219
The following code example downloads a blob and writes the contents to the console:
213220

@@ -255,5 +262,5 @@ To see Blob storage sample apps, continue to:
255262
> [!div class="nextstepaction"]
256263
> [Azure Blob Storage library for Go samples](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob#example-package)
257264
258-
- To learn more, see the [Azure Blob Storage client libraries for Go](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/storage/azblob).
265+
- To learn more, see the [Azure Blob Storage client library for Go](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/storage/azblob).
259266
- For tutorials, samples, quickstarts, and other documentation, visit [Azure for Go Developers](/azure/developer/go/overview).

0 commit comments

Comments
 (0)