Azure SDK – Getting Started

Welcome to the Azure SDK

This guide will help you get up and running with the Azure SDK for .NET, Java, JavaScript, and Python. You’ll learn how to install the SDK, authenticate, and run a simple example that creates a storage account.

Prerequisites

Installation

Select your language and run the appropriate command.

.NET

# Install the Azure SDK package for storage
dotnet add package Azure.Storage.Blobs

Java

// Maven dependency
<dependency>
    <groupId>com.azure</groupId>
    <artifactId>azure-storage-blob</artifactId>
    <version>12.23.0</version>
</dependency>

Node.js

# Install via npm
npm install @azure/storage-blob

Python

# Install via pip
pip install azure-storage-blob

Quick Start

The following example creates a new container in a storage account and uploads a text file.

.NET Example

using System;
using Azure.Storage.Blobs;

class Program
{
    static async Task Main()
    {
        string connectionString = Environment.GetEnvironmentVariable("AZURE_STORAGE_CONNECTION_STRING");
        BlobServiceClient serviceClient = new BlobServiceClient(connectionString);
        BlobContainerClient container = await serviceClient.CreateBlobContainerAsync("quickstart");
        BlobClient blob = container.GetBlobClient("hello.txt");
        await blob.UploadAsync(BinaryData.FromString("Hello Azure!"));
        Console.WriteLine("File uploaded to container 'quickstart'.");
    }
}

Python Example

import os
from azure.storage.blob import BlobServiceClient

conn_str = os.getenv("AZURE_STORAGE_CONNECTION_STRING")
service = BlobServiceClient.from_connection_string(conn_str)
container = service.get_container_client("quickstart")
container.create_container()
blob = container.get_blob_client("hello.txt")
blob.upload_blob(b"Hello Azure!", overwrite=True)
print("File uploaded to container 'quickstart'.")

Next Steps