Skip to content

Latest commit

 

History

History
64 lines (42 loc) · 3.07 KB

File metadata and controls

64 lines (42 loc) · 3.07 KB

Learning Azure Storage REST APIs

A set of samples for onboarding to and exploring the Azure Storage Resource Provider REST API.

Prerequisites

Software

Setup

  1. Copy .env.sample.txt and create a new file called .env.

management.azure.com Endpoint

  1. Retrieve a bearer token for your Azure account and paste the value in the BEARER_TOKEN environment variable.

    Note: A bearer token can be retrieved through the REST API, the Azure CLI or through Azure PowerShell.

    PowerShell

    $tokenPoSh = ((New-Object Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient([Microsoft.Azure.Commands.Common.Authentication.Abstractions.AzureRmProfileProvider]::Instance.Profile)).AcquireAccessToken((Gaz account get-access-tokenId)).AccessToken
    Write-Output $tokenPosh

    Bash

    tokenCLI=$(az account get-access-token --query "accessToken" -o tsv)
    echo $tokenCLI
  2. Verify you can access your Azure subscription using the token by executing getsubscriptions.http.

  3. In the response, find the target subscriptionId and past the value into the SUBSCRIPTION_ID value in your .env file.

  4. Populate the remaining values in your .env file, including:

    Note: If you have an existing resource group and storage account you can use those values or you can use the samples in this repository to create the resources

storage.azure.com Endpoint

  1. Retrieve a bearer token for the resource https://storage.azure.com and paste the value in the BEARER_STORAGE environment variable.

    Bash

    tokenStorageCLI=$(az account get-access-token --resource=https://storage.azure.com/ --query "accessToken" -o tsv)
    echo $tokenStorageCLI

Samples