Get started with Azure Stack Hub storage development tools

Microsoft Azure Stack Hub provides a set of storage services that includes blob, table, and queue storage.

Use this article as a guide to get started using Azure Stack Hub storage development tools. You can find more detailed information and sample code in corresponding Azure storage tutorials.

Note

There are differences between Azure Stack Hub storage and Azure storage, including specific requirements for each platform. For example, there are specific client libraries and endpoint suffix requirements for Azure Stack Hub. For more information, see Azure Stack Hub storage: Differences and considerations.

Azure client libraries

For the storage client libraries, be aware of the version that is compatible with the REST API. You must also specify the Azure Stack Hub endpoint in your code.

2301 update and newer

Client library Azure Stack Hub supported version Link Endpoint specification
.NET Common: 12.9.0
Blob: 12.10.0
Queue: 12.8.0
NuGet package:
Common: https://www.nuget.org/packages/Azure.Storage.common/12.9.0
Blob: https://www.nuget.org/packages/Azure.Storage.Blobs/12.10.0
Queue: https://www.nuget.org/packages/Azure.Storage.queues/12.8.0

GitHub release:
Common: https://github.com/Azure/azure-sdk-for-net/tree/Azure.Storage.Common_12.9.0/sdk/storage/Azure.Storage.Common
Blob: https://github.com/Azure/azure-sdk-for-net/tree/Azure.Storage.Blobs_12.10.0/sdk/storage/Azure.Storage.Blobs
Queue: https://github.com/Azure/azure-sdk-for-net/tree/Azure.Storage.Queues_12.8.0/sdk/storage/Azure.Storage.Queues
app.config file
Java Common: 12.12.0
Blob: 12.14.3
Queue: 12.11.3
Maven package:
Common: https://mvnrepository.com/artifact/com.azure/azure-storage-common/12.12.0
Blob: https://mvnrepository.com/artifact/com.azure/azure-storage-blob/12.14.3
Queue: https://mvnrepository.com/artifact/com.azure/azure-storage-queue/12.11.3

GitHub release:
Common: https://github.com/Azure/azure-sdk-for-java/tree/azure-storage-common_12.12.0/sdk/storage/azure-storage-common
Blob: https://github.com/Azure/azure-sdk-for-java/tree/azure-storage-blob_12.14.3/sdk/storage/azure-storage-blob
Queue: https://github.com/Azure/azure-sdk-for-java/tree/azure-storage-queue_12.11.3/sdk/storage/azure-storage-queue
Connection string setup
Node.js 2.8.3 NPM link:
https://www.npmjs.com/package/azure-storage
(Run: npm install azure-storage@2.8.3)

GitHub release:
https://github.com/Azure/azure-storage-node/releases/tag/v2.8.3
Service instance declaration
C++ Blob: 12.2.0
Queue: 12.0.0
GitHub release:
Blob: https://github.com/Azure/azure-sdk-for-cpp/tree/azure-storage-blobs_12.2.0
Queue: https://github.com/Azure/azure-sdk-for-cpp/tree/azure-storage-queues_12.0.0
Connection string setup
PHP 1.2.0 GitHub release:
Common: https://github.com/Azure/azure-storage-php/releases/tag/v1.2.0-common
Blob: https://github.com/Azure/azure-storage-php/releases/tag/v1.2.0-blob
Queue:
https://github.com/Azure/azure-storage-php/releases/tag/v1.1.1-queue
Table: https://github.com/Azure/azure-storage-php/releases/tag/v1.1.0-table

Install via Composer (To learn more, see the details below.)
Connection string setup
Python Blob: 12.9.0
Queue: 12.1.6
GitHub release:
Blob:
https://github.com/Azure/azure-sdk-for-python/tree/azure-storage-blob_12.9.0/sdk/storage/azure-storage-blob
Queue:
https://github.com/Azure/azure-sdk-for-python/tree/azure-storage-queue_12.1.6/sdk/storage/azure-storage-queue
Service instance declaration
Ruby 1.0.1 RubyGems package:
Common:
https://rubygems.org/gems/azure-storage-common/versions/1.0.1
Blob: https://rubygems.org/gems/azure-storage-blob/versions/1.0.1
Queue: https://rubygems.org/gems/azure-storage-queue/versions/1.0.1
Table: https://rubygems.org/gems/azure-storage-table/versions/1.0.1

GitHub release:
Common: https://github.com/Azure/azure-storage-ruby/releases/tag/v1.0.1-common
Blob: https://github.com/Azure/azure-storage-ruby/releases/tag/v1.0.1-blob
Queue: https://github.com/Azure/azure-storage-ruby/releases/tag/v1.0.1-queue
Table: https://github.com/Azure/azure-storage-ruby/releases/tag/v1.0.1-table
Connection string setup

Note

There is a high severity vulnerability in old version of .NET and Java client library, because of the dependencies on a vulnerable version of Jackson package. It is strongly suggested to use the latest supported version of .NET and Java client library to avoid security issue.

Install PHP client via Composer - current

To install via Composer: (take the blob as an example).

  1. Create a file named composer.json in the root of the project with following code:

    {
      "require": {
      "Microsoft/azure-storage-blob":"1.2.0"
      }
    }
    
  2. Download composer.phar to the project root.

  3. Run: php composer.phar install.

Specify API version

To use the new .NET client library (Common: v12.9.0 / Blob: v12.10.0 / Queue: v12.8.0) and Java client library (Common: v12.12.0 / Blob: v12.13.0 / Queue: v12.10.0), you must explicitly specify the serviceVersion in each client class (including BlobServiceClient, BlobContainerClient, BlobClient, QueueServiceClient, and QueueClient), because the default version in the client class is not currently supported by Azure Stack Hub.

Examples

.NET
BlobClientOptions options = new BlobClientOptions(BlobClientOptions.ServiceVersion.V2019_07_07);
BlobServiceClient client = new BlobServiceClient("<connection_string>", options);
Java
BlobServiceVersion version = BlobServiceVersion.V2019_07_07; 
BlobServiceClient blobServiceClient = new BlobServiceClientBuilder()
    .endpoint("<your_endpoint>")
    .sasToken("<your_SAS_token>")
    .serviceVersion(version)
    .buildClient();

2008 update and newer

Client library Azure Stack Hub supported version Link Endpoint specification
.NET Common: 12.9.0
Blob: 12.10.0
Queue: 12.8.0
NuGet package:
Common: https://www.nuget.org/packages/Azure.Storage.common/12.9.0
Blob: https://www.nuget.org/packages/Azure.Storage.Blobs/12.10.0
Queue: https://www.nuget.org/packages/Azure.Storage.queues/12.8.0

GitHub release:
Common: https://github.com/Azure/azure-sdk-for-net/tree/Azure.Storage.Common_12.9.0/sdk/storage/Azure.Storage.Common
Blob: https://github.com/Azure/azure-sdk-for-net/tree/Azure.Storage.Blobs_12.10.0/sdk/storage/Azure.Storage.Blobs
Queue: https://github.com/Azure/azure-sdk-for-net/tree/Azure.Storage.Queues_12.8.0/sdk/storage/Azure.Storage.Queues
app.config file
Java Common: 12.12.0
Blob: 12.13.0
Queue: 12.10.0
Maven package:
Common: https://mvnrepository.com/artifact/com.azure/azure-storage-common/12.12.0
Blob: https://mvnrepository.com/artifact/com.azure/azure-storage-blob/12.13.0
Queue: https://mvnrepository.com/artifact/com.azure/azure-storage-queue/12.10.0

GitHub release:
Common: https://github.com/Azure/azure-sdk-for-java/tree/azure-storage-common_12.12.0/sdk/storage/azure-storage-common
Blob: https://github.com/Azure/azure-sdk-for-java/tree/azure-storage-blob_12.13.0/sdk/storage/azure-storage-blob
Queue: https://github.com/Azure/azure-sdk-for-java/tree/azure-storage-queue_12.10.0/sdk/storage/azure-storage-queue
Connection string setup
Node.js 2.8.3 NPM link:
https://www.npmjs.com/package/azure-storage
(Run: npm install azure-storage@2.8.3)

GitHub release:
https://github.com/Azure/azure-storage-node/releases/tag/v2.8.3
Service instance declaration
C++ 7.2.0 GitHub release:
https://github.com/Azure/azure-storage-cpp/releases/tag/v7.2.0
Connection string setup
PHP 1.2.0 GitHub release:
Common: https://github.com/Azure/azure-storage-php/releases/tag/v1.2.0-common
Blob: https://github.com/Azure/azure-storage-php/releases/tag/v1.2.0-blob
Queue:
https://github.com/Azure/azure-storage-php/releases/tag/v1.1.1-queue
Table: https://github.com/Azure/azure-storage-php/releases/tag/v1.1.0-table

Install via Composer (To learn more, see the details below.)
Connection string setup
Python Blob: 12.3.1
Queue: 12.1.6
GitHub release:
Blob:
https://github.com/Azure/azure-sdk-for-python/tree/azure-storage-blob_12.3.1/sdk/storage/azure-storage-blob
Queue:
https://github.com/Azure/azure-sdk-for-python/tree/azure-storage-queue_12.1.6/sdk/storage/azure-storage-queue
Service instance declaration
Ruby 1.0.1 RubyGems package:
Common:
https://rubygems.org/gems/azure-storage-common/versions/1.0.1
Blob: https://rubygems.org/gems/azure-storage-blob/versions/1.0.1
Queue: https://rubygems.org/gems/azure-storage-queue/versions/1.0.1
Table: https://rubygems.org/gems/azure-storage-table/versions/1.0.1

GitHub release:
Common: https://github.com/Azure/azure-storage-ruby/releases/tag/v1.0.1-common
Blob: https://github.com/Azure/azure-storage-ruby/releases/tag/v1.0.1-blob
Queue: https://github.com/Azure/azure-storage-ruby/releases/tag/v1.0.1-queue
Table: https://github.com/Azure/azure-storage-ruby/releases/tag/v1.0.1-table
Connection string setup

Install PHP client via Composer - current

To install via Composer: (take the blob as an example).

  1. Create a file named composer.json in the root of the project with following code:

    {
      "require": {
      "Microsoft/azure-storage-blob":"1.2.0"
      }
    }
    
  2. Download composer.phar to the project root.

  3. Run: php composer.phar install.

Specify API version

To use the new .NET client library (Common: v12.9.0 / Blob: v12.10.0 / Queue: v12.8.0) and Java client library (Common: v12.12.0 / Blob: v12.13.0 / Queue: v12.10.0), you must explicitly specify the serviceVersion in each client class (including BlobServiceClient, BlobContainerClient, BlobClient, QueueServiceClient, and QueueClient), because the default version in the client class is not currently supported by Azure Stack Hub.

Examples

.NET
BlobClientOptions options = new BlobClientOptions(BlobClientOptions.ServiceVersion.V2019_07_07);
BlobServiceClient client = new BlobServiceClient("<connection_string>", options);
Java
BlobServiceVersion version = BlobServiceVersion.V2019_07_07; 
BlobServiceClient blobServiceClient = new BlobServiceClientBuilder()
    .endpoint("<your_endpoint>")
    .sasToken("<your_SAS_token>")
    .serviceVersion(version)
    .buildClient();

2005 update

Client library Azure Stack Hub supported version Link Endpoint specification
.NET 11.0.0 NuGet package:
Common: https://www.nuget.org/packages/Microsoft.Azure.Storage.Common/11.0.0
Blob: https://www.nuget.org/packages/Microsoft.Azure.Storage.Blob/11.0.0
Queue:
https://www.nuget.org/packages/Microsoft.Azure.Storage.Queue/11.0.0

GitHub release:
https://github.com/Azure/azure-storage-net/releases/tag/v11.0.0
app.config file
Java 12.0.0-preview.3 Maven package:
https://mvnrepository.com/artifact/com.azure/azure-storage-blob/12.0.0-preview.3

GitHub release:
https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/storage
Connection string setup
Node.js 2.8.3 NPM link:
https://www.npmjs.com/package/azure-storage
(Run: npm install azure-storage@2.8.3)

GitHub release:
https://github.com/Azure/azure-storage-node/releases/tag/v2.8.3
Service instance declaration
C++ 7.1.0 GitHub release:
https://github.com/Azure/azure-storage-cpp/releases/tag/v7.1.0
Connection string setup
PHP 1.2.0 GitHub release:
Common: https://github.com/Azure/azure-storage-php/releases/tag/v1.2.0-common
Blob: https://github.com/Azure/azure-storage-php/releases/tag/v1.2.0-blob
Queue:
https://github.com/Azure/azure-storage-php/releases/tag/v1.1.1-queue
Table: https://github.com/Azure/azure-storage-php/releases/tag/v1.1.0-table

Install via Composer (To learn more, see the details below.)
Connection string setup
Python 2.1.0 GitHub release:
Common:
https://github.com/Azure/azure-storage-python/releases/tag/v2.1.0-common
Blob:
https://github.com/Azure/azure-storage-python/releases/tag/v2.1.0-blob
Queue:
https://github.com/Azure/azure-storage-python/releases/tag/v2.1.0-queue
Service instance declaration
Ruby 1.0.1 RubyGems package:
Common:
https://rubygems.org/gems/azure-storage-common/versions/1.0.1
Blob: https://rubygems.org/gems/azure-storage-blob/versions/1.0.1
Queue: https://rubygems.org/gems/azure-storage-queue/versions/1.0.1
Table: https://rubygems.org/gems/azure-storage-table/versions/1.0.1

GitHub release:
Common: https://github.com/Azure/azure-storage-ruby/releases/tag/v1.0.1-common
Blob: https://github.com/Azure/azure-storage-ruby/releases/tag/v1.0.1-blob
Queue: https://github.com/Azure/azure-storage-ruby/releases/tag/v1.0.1-queue
Table: https://github.com/Azure/azure-storage-ruby/releases/tag/v1.0.1-table
Connection string setup

Install PHP client via Composer - current

To install via Composer: (take the blob as an example).

  1. Create a file named composer.json in the root of the project with following code:

    {
      "require": {
      "Microsoft/azure-storage-blob":"1.2.0"
      }
    }
    
  2. Download composer.phar to the project root.

  3. Run: php composer.phar install.

Endpoint declaration

An Azure Stack Hub endpoint includes two parts: the name of a region and the Azure Stack Hub domain. In the Azure Stack Development Kit, the default endpoint is local.azurestack.external. Contact your cloud admin if you're not sure about your endpoint.

Examples

.NET

For Azure Stack Hub, the endpoint suffix is specified in the app.config file:

<add key="StorageConnectionString"
value="DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=mykey;
EndpointSuffix=local.azurestack.external;" />

Java

For Azure Stack Hub, the endpoint suffix is specified in the setup of connection string:

public static final String storageConnectionString =
    "DefaultEndpointsProtocol=http;" +
    "AccountName=your_storage_account;" +
    "AccountKey=your_storage_account_key;" +
    "EndpointSuffix=local.azurestack.external";

Node.js

For Azure Stack Hub, the endpoint suffix is specified in the declaration instance:

var blobSvc = azure.createBlobService('myaccount', 'mykey',
'myaccount.blob.local.azurestack.external');

C++

For Azure Stack Hub, the endpoint suffix is specified in the setup of connection string:

const utility::string_t storage_connection_string(U("DefaultEndpointsProtocol=https;
AccountName=your_storage_account;
AccountKey=your_storage_account_key;
EndpointSuffix=local.azurestack.external"));

PHP

For Azure Stack Hub, the endpoint suffix is specified in the setup of connection string:

$connectionString = 'BlobEndpoint=https://<storage account name>.blob.local.azurestack.external/;
QueueEndpoint=https:// <storage account name>.queue.local.azurestack.external/;
TableEndpoint=https:// <storage account name>.table.local.azurestack.external/;
AccountName=<storage account name>;AccountKey=<storage account key>'

Python

For Azure Stack Hub, the endpoint suffix is specified in the declaration instance:

block_blob_service = BlockBlobService(account_name='myaccount',
account_key='mykey',
endpoint_suffix='local.azurestack.external')

Ruby

For Azure Stack Hub, the endpoint suffix is specified in the setup of connection string:

set
AZURE_STORAGE_CONNECTION_STRING=DefaultEndpointsProtocol=https;
AccountName=myaccount;
AccountKey=mykey;
EndpointSuffix=local.azurestack.external

Blob storage

The following Azure Blob storage tutorials are applicable to Azure Stack Hub. Note the specific endpoint suffix requirement for Azure Stack Hub described in the previous Examples section.

Queue storage

The following Azure Queue storage tutorials are applicable to Azure Stack Hub. Note the specific endpoint suffix requirement for Azure Stack Hub described in the previous Examples section.

Table storage

The following Azure Table storage tutorials are applicable to Azure Stack Hub. Note the specific endpoint suffix requirement for Azure Stack Hub described in the previous Examples section.

Next steps