...

/

Using Provisioned Azure Infrastructure

Using Provisioned Azure Infrastructure

Learn to use cloud storage infrastructure to store files and provide constrained access by using shared access signatures.

In this lesson, we will pair a provisioning infrastructure with the Azure control plane and use the infrastructure through the provisioned service's data plane.

In this lesson, we are going to build a cloud storage infrastructure. We will use Azure Storage to store files and provide constrained access to those files via shared access signatures. We will learn how to use ARM to fetch account keys and use those keys to provide constrained access to storage resources.

Building an Azure Storage account

Let's get started by running the example, and then we'll delve into the code for building the infrastructure and using the provisioned storage account. To execute the example, run the following:

Press + to interact
az login
echo -e "AZURE_SUBSCRIPTION_ID=$(az account show --query 'id' -o tsv)\nSSH_PUBLIC_KEY_PATH=./.ssh/id_rsa.pub" >> .env
go run ./cmd/storage/main.go
Terminal 1
Terminal
Loading...

As we can see from the previous output, the example creates a resource group and a storage account, fetches an account key, and then uploads all of the images in ./blobs to the cloud. Finally, the example prints out URIs for each of the images using shared access signatures. If we go to one of those URIs, we should be able to download the image we uploaded to the storage account.

What happens when we try to download img1.jpeg without the query string – for example, using the https://fallingrain.blob.core.windows ...