Skip to content
Michael J. Ryan edited this page May 21, 2015 · 1 revision

azureUtil.storage()

The azure-config-util object instance presents a storage(...) method that returns a promise, that will resolve to an azure-storage-simple storage instance.

This method is used by blob(name), queue(name), and table(name) to establish an azure-storage-simple connection wrapper.

  • storage(connectionString)
    • When passed an Azure Storage connectionString, it will be used to create the storage instance directly.
  • storage(accountName,accountKey)
    • When passed an Azure Storage accountName and accountKey, it will be used to create the storage instance directly.
  • storage(name)
    • When a name is specified, config() is used in order to determin the connection settings for the named connection.
  • storage()
    • When no name is passed, or "default" is used (without a matching storage.name configuration value), the storage account for the azureUtil instance is used.

Table Values

When using a named, or "default" storage configuration, a matching Key should be present under the Section field set to "storage"

JsonValue (object)

  • account - The Azure Storage Connection String, or the name of the Azure Storage Account, if different than the Key field.
  • key - The Azure Storage Account Key, if the account is not set to a connection string.

Example

Table Values

Section Key JsonValue
storage account {"account":"otherAccountName","key":"..."}
storage account2 {"key":"..."}

Usage

//no string, use configured default
let default = await azureUtil.storage(); // use azureUtil's configured storage

// look for "default" key first, fallback to configured storage account
let default = await azureUtil.storage('default');default

// storage wrapper for the "otherAccountName" Azure Storage account using specified key.
let account1 = await azureUtil.storage('account'); 

// storage wrapper for the "account2" Azure STorage account using specified key.
let account2 = await azureUtil.storage('account2');

Closing

As you should see by now, this provides a flexible means to specify azure storage connections, or by default utilize the azureUtil instance's storage account by default.

Clone this wiki locally