Git Product home page Git Product logo

storage-blobs-go-quickstart's Introduction

page_type languages products description urlFragment
sample
go
azure
This repository contains a simple sample project to help you getting started with Azure storage using Go as the development language.
storage-blobs-go-quickstart

Transfer objects to and from Azure Blob storage using Go

This repository contains a simple sample project to help you getting started with Azure storage using Go as the development language.

Prerequisites

To complete this tutorial:

  • Install Go 1.8 or later

If you don't have an Azure subscription, create a free account before you begin.

Create a storage account using the Azure portal

First, create a new general-purpose storage account to use for this quickstart.

  1. Go to the Azure portal account creation menu and log in using your Azure account.
  2. Enter a unique name for your storage account. Keep these rules in mind for naming your storage account:
    • The name must be between 3 and 24 characters in length.
    • The name may contain numbers and lowercase letters only.
  3. Select your subscription.
  4. For Resource group, create a new one or use an existing resource group.
  5. Select the Location to use for your storage account.
  6. Check Pin to dashboard and click Create to create your storage account.

After your storage account is created, it's pinned to the dashboard. Select it to open it. Under Settings, select Access keys. Copy and paste the Storage account name and the Key under key1 into a text editor for later use.

Put the account name and key in environment variables

This solution requires your storage account name and key to be stored in environment variables securely on the machine running the sample. Follow one of the examples below depending on your operating System to create the environment variables. If using Windows, close out of your open IDE or shell and restart to ensure that the environment variables are initialized.

Linux

export AZURE_STORAGE_ACCOUNT="<youraccountname>"
export AZURE_STORAGE_ACCESS_KEY="<youraccountkey>"

Windows

setx AZURE_STORAGE_ACCOUNT "<youracountname>"
setx AZURE_STORAGE_ACCESS_KEY "<youraccountkey>"

Download and Install the Azure Storage Blob SDK for Go

From your GOPATH, execute the following command:

go get github.com/Azure/azure-storage-blob-go/2016-05-31/azblob

At this point, you can run this application. It creates its own file to upload, and then cleans up after itself by deleting everything at the end.

Run the application

Navigate to your application directory and run the application with the go run command.

go run storage-quickstart.go

More information

The Azure storage documentation includes a rich set of tutorials and conceptual articles, which serve as a good complement to the samples. For more samples on the Azure Storage SDK for GO, check out the examples here.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

storage-blobs-go-quickstart's People

Contributors

microsoftopensource avatar jeffreyrichter avatar msftgits avatar v-rajagt-zz avatar zezha-msft avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.