Azure Storage Management REST API

Introduction to Azure Storage Management REST API

The Azure Storage Management REST API allows you to programmatically manage your Azure Storage accounts. You can perform operations such as creating, updating, deleting, and listing storage accounts, as well as managing their associated keys and configurations.

This API is built on REST principles and uses standard HTTP methods (GET, POST, PUT, DELETE) and common status codes. Requests and responses are typically formatted in JSON.

Authentication

All requests to the Azure Storage Management REST API must be authenticated. Azure Active Directory (Azure AD) is the recommended authentication method. You will typically need to obtain an OAuth 2.0 access token and include it in the Authorization header of your requests.

Authorization: Bearer <Your-Access-Token>

Common Operations

List Storage Accounts

GET /subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts?api-version=2021-09-01

Retrieves a list of all storage accounts within a specified subscription.

Parameters:

  • subscriptionId string The ID of the subscription. (Required)
  • api-version string Specifies the API version to use. (Required)

Example Response Body (JSON):

{
    "value": [
        {
            "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount1",
            "name": "mystorageaccount1",
            "location": "eastus",
            "sku": { "name": "Standard_LRS", "tier": "Standard" },
            "kind": "StorageV2",
            "tags": { "environment": "production" },
            "properties": {
                "primaryEndpoints": {
                    "blob": "https://mystorageaccount1.blob.core.windows.net/",
                    "file": "https://mystorageaccount1.file.core.windows.net/",
                    "queue": "https://mystorageaccount1.queue.core.windows.net/",
                    "table": "https://mystorageaccount1.table.core.windows.net/"
                },
                "creationTime": "2023-01-15T10:30:00Z",
                "provisioningState": "Succeeded"
            }
        }
    ]
}

Get Storage Account Properties

GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}?api-version=2021-09-01

Retrieves the properties of a specific storage account.

Parameters:

  • subscriptionId string The ID of the subscription. (Required)
  • resourceGroupName string The name of the resource group. (Required)
  • accountName string The name of the storage account. (Required)
  • api-version string Specifies the API version to use. (Required)

Create Storage Account

PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}?api-version=2021-09-01

Creates or updates a storage account.

URL Parameters:

  • subscriptionId string The ID of the subscription. (Required)
  • resourceGroupName string The name of the resource group. (Required)
  • accountName string The name of the storage account. (Required)
  • api-version string Specifies the API version to use. (Required)

Request Body (JSON):

{
    "location": "eastus",
    "sku": {
        "name": "Standard_LRS",
        "tier": "Standard"
    },
    "kind": "StorageV2",
    "tags": {
        "environment": "development"
    },
    "properties": {
        "accessTier": "Hot"
    }
}

List Keys

POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listkeys?api-version=2021-09-01

Retrieves the primary and secondary access keys for a storage account.

URL Parameters:

  • subscriptionId string The ID of the subscription. (Required)
  • resourceGroupName string The name of the resource group. (Required)
  • accountName string The name of the storage account. (Required)
  • api-version string Specifies the API version to use. (Required)

Example Response Body (JSON):

{
    "keys": [
        {
            "keyName": "key1",
            "permissions": "Full",
            "value": "YOUR_PRIMARY_ACCESS_KEY_HERE"
        },
        {
            "keyName": "key2",
            "permissions": "Full",
            "value": "YOUR_SECONDARY_ACCESS_KEY_HERE"
        }
    ]
}

Regenerate Keys

POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regeneratekey?api-version=2021-09-01

Regenerates the primary or secondary access key for a storage account.

URL Parameters:

  • subscriptionId string The ID of the subscription. (Required)
  • resourceGroupName string The name of the resource group. (Required)
  • accountName string The name of the storage account. (Required)
  • api-version string Specifies the API version to use. (Required)

Request Body (JSON):

{
    "keyName": "key1"
}

Delete Storage Account

DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}?api-version=2021-09-01

Deletes a storage account.

URL Parameters:

  • subscriptionId string The ID of the subscription. (Required)
  • resourceGroupName string The name of the resource group. (Required)
  • accountName string The name of the storage account. (Required)
  • api-version string Specifies the API version to use. (Required)

Further Reading