Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
MSDN Library

CloudStorageAccount Constructor (StorageCredentialsAccountAndKey, Boolean)

Updated: September 24, 2013

[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
Dim storageCredentialsAccountAndKey As StorageCredentialsAccountAndKey
Dim useHttps As Boolean

Dim instance As New CloudStorageAccount(storageCredentialsAccountAndKey, useHttps)

public CloudStorageAccount (
	StorageCredentialsAccountAndKey storageCredentialsAccountAndKey,
	bool useHttps
)

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.

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.

ImportantImportant
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:


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


Development Platforms

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

 

Reference

CloudStorageAccount Class
CloudStorageAccount Members
Microsoft.WindowsAzure Namespace

Other Resources

Authenticating Access to Your Storage Account

Show:
© 2015 Microsoft