Powered by AppSignal & Oban Pro

Getting Started with AzureSDK

livebooks/getting_started.livemd

Getting Started with AzureSDK

Mix.install([
  {:azure_sdk, path: Path.expand("..", __DIR__)}
])

Azurite setup

Start Azurite with Docker:

docker compose up -d

Create a client

credential =
  AzureSDK.Identity.SharedKeyCredential.new(
    "devstoreaccount1",
    "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="
  )

client =
  AzureSDK.Storage.Client.new(
    account: "devstoreaccount1",
    credential: credential,
    endpoint: "http://127.0.0.1:10000/devstoreaccount1"
  )

First upload

container = "livebook-demo"

{:ok, _} = AzureSDK.Storage.Container.create(client, container)
{:ok, blob} = AzureSDK.Storage.Blob.upload(client, container, "hello.txt", "Hello from Livebook!")
blob.name