CloudStorageAccount Constructor (StorageCredentialsAccountAndKey, Boolean)

Storage Client Library NET API

[This topic is part of the Microsoft Azure Storage Client Library 1.7, which has been deprecated. See Storage Client Library for the latest version.]

Initializes a new instance of the CloudStorageAccount class using the specified account credentials and the default service endpoints.

Namespace: Microsoft.WindowsAzure
Assembly: Microsoft.WindowsAzure.StorageClient (in Microsoft.WindowsAzure.StorageClient.dll)

Usage

Visual Basic
Dim storageCredentialsAccountAndKey As StorageCredentialsAccountAndKey
Dim useHttps As Boolean

Dim instance As New CloudStorageAccount(storageCredentialsAccountAndKey, useHttps)

Syntax

Visual Basic
Public Sub New ( _
	storageCredentialsAccountAndKey As StorageCredentialsAccountAndKey, _
	useHttps As Boolean _
)
C#
public CloudStorageAccount (
	StorageCredentialsAccountAndKey storageCredentialsAccountAndKey,
	bool useHttps
)
C++
public:
CloudStorageAccount (
	StorageCredentialsAccountAndKey^ storageCredentialsAccountAndKey, 
	bool useHttps
)
J#
JScript

Parameters

storageCredentialsAccountAndKey

Type: Microsoft.WindowsAzure.StorageCredentialsAccountAndKey

An object of type StorageCredentialsAccountAndKey that specifies the account name and account key for the storage account.

useHttps

Type: System.Boolean

True to use HTTPS to connect to storage service endpoints; otherwise, false.

Remarks

The CloudStorageAccount object is constructed using the default storage service endpoints. The default storage service endpoints are [http|https]://myaccount.blob.core.windows.net; [http|https]://myaccount.queue.core.windows.net; and [http|https]://myaccount.table.core.windows.net, where myaccount is the name of your storage account.

Access to the CloudStorageAccount may be via HTTP or HTTPS, as specified by the useHttps parameter.

Important
HTTPS can be required when a proxy server configuration blocks HTTP traffic, or modifies HTTP request headers, causing requests to fail.

The credentials provided when constructing the CloudStorageAccount object are used to authenticate all further requests against resources that are accessed via the CloudStorageAccount object or a client object created from it. A client object may be a CloudBlobClient, CloudQueueClient, or CloudTableClient.

The following code example creates an object of type StorageCredentialsAccountAndKey, then constructs the CloudStorageAccount, followed by a CloudBlobClient object. Pass in your account name and account key for the accountName and accountKey variables:

C# Copy Code
StorageCredentialsAccountAndKey credentials = new StorageCredentialsAccountAndKey(accountName, accountKey);
CloudStorageAccount storageAccount = new CloudStorageAccount(credentials, true);
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

Platforms

Development Platforms

Windows Vista, Windows 7, Windows Server 2008, Windows 8.1, Windows Server 2012 R2, Windows 8 and Windows Server 2012

Change History

See Also