[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
CloudBlobClient class using the specified Blob service endpoint and account credentials.
Namespace: Microsoft.WindowsAzure.StorageClient
Assembly: Microsoft.WindowsAzure.StorageClient (in Microsoft.WindowsAzure.StorageClient.dll)
Usage
Visual Basic |
---|
Dim baseAddress As String
Dim credentials As StorageCredentials
Dim instance As New CloudBlobClient(baseAddress, credentials) |
Syntax
Visual Basic |
---|
Public Sub New ( _
baseAddress As String, _
credentials As StorageCredentials _
) |
C# |
---|
public CloudBlobClient (
string baseAddress,
StorageCredentials credentials
) |
C++ |
---|
public:
CloudBlobClient (
String^ baseAddress,
StorageCredentials^ credentials
) |
Parameters
- baseAddress
Type: System.String
The Blob service endpoint to use to create the client.
- credentials
Type: Microsoft.WindowsAzure.StorageCredentials
The account credentials.
Example
The following code example creates a credentialed service client and uploads text content to a blob.
C# | Copy Code |
---|
static void UploadBlobFromFile(string blobEndpoint, string accountName, string accountKey)
{
//Create service client for credentialed access to the Blob service.
CloudBlobClient blobClient =
new CloudBlobClient(blobEndpoint, new StorageCredentialsAccountAndKey(accountName, accountKey));
//Get a reference to a container, which may or may not exist.
CloudBlobContainer container = blobClient.GetContainerReference("mycontainer");
//Create a new container, if it does not exist
container.CreateIfNotExist();
//Get a reference to a blob, which may or may not exist.
CloudBlob blob = container.GetBlobReference("myfile.txt");
//Upload content to the blob, which will create the blob if it does not already exist.
blob.UploadFile("c:\\myfile.txt");
}
|
Platforms
Change History
See Also