StorageCredentials StorageCredentials StorageCredentials Class

Definition

Represents a set of credentials used to authenticate access to a Microsoft Azure storage account.

public sealed class StorageCredentials
type StorageCredentials = class
Public NotInheritable Class StorageCredentials
Inheritance
StorageCredentialsStorageCredentialsStorageCredentials

Examples


// Create a CloudStorageAccount object using account name and key.
// The account name should be just the name of a Storage Account, not a URI, and 
// not including the suffix. The key should be a base-64 encoded string that you
// can acquire from the portal, or from the management plane.
// This will have full permissions to all operations on the account.
StorageCredentials storageCredentials = new StorageCredentials(myAccountName, myAccountKey);
CloudStorageAccount cloudStorageAccount = new CloudStorageAccount(storageCredentials, useHttps: true);

// Create a CloudBlobClient object from the storage account.
// This object is the root object for all operations on the 
// blob service for this particular account.
CloudBlobClient blobClient = cloudStorageAccount.CreateCloudBlobClient();

// Get a reference to a CloudBlobContainer object in this account. 
// This object can be used to create the container on the service, 
// list blobs, delete the container, etc. This operation does not make a 
// call to the Azure Storage service.  It neither creates the container 
// on the service, nor validates its existence.
CloudBlobContainer container = blobClient.GetContainerReference("container1");


// Create a CloudQueueClient object from the storage account.
// This object is the root object for all operations on the 
// queue service for this particular account.
CloudQueueClient queueClient = cloudStorageAccount.CreateCloudQueueClient();

// Get a reference to a CloudQueue object in this account. 
// This object can be used to create the queue on the service, 
// delete the queue, add messages, etc. This operation does not
// make a call to the Azure Storage service.  It neither creates 
// the queue on the service, nor validates its existence.
CloudQueue queue = queueClient.GetQueueReference("queue1");


// Create a CloudTableClient object from the storage account.
// This object is the root object for all operations on the 
// table service for this particular account.
CloudTableClient tableClient = cloudStorageAccount.CreateCloudTableClient();

// Get a reference to a CloudTable object in this account. 
// This object can be used to create the table on the service, 
// delete the table, insert entities, etc. This operation does 
// not make a call to the Azure Storage service.  It neither 
// creates the table on the service, nor validates its existence.
CloudTable table = tableClient.GetTableReference("table1");


// Create a CloudFileClient object from the storage account.
// This object is the root object for all operations on the 
// file service for this particular account.
CloudFileClient fileClient = cloudStorageAccount.CreateCloudFileClient();

// Get a reference to a CloudFileShare object in this account. 
// This object can be used to create the share on the service, 
// delete the share, list files and directories, etc. This operation 
// does not make a call to the Azure Storage service. It neither 
// creates the share on the service, nor validates its existence.
CloudFileShare share = fileClient.GetShareReference("share1");

Constructors

StorageCredentials() StorageCredentials() StorageCredentials()

Initializes a new instance of the StorageCredentials class.

StorageCredentials(TokenCredential) StorageCredentials(TokenCredential) StorageCredentials(TokenCredential)

Initializes a new instance of the StorageCredentials class with the specified bearer token.

StorageCredentials(String) StorageCredentials(String) StorageCredentials(String)

Initializes a new instance of the StorageCredentials class with the specified shared access signature token.

StorageCredentials(String, Byte[]) StorageCredentials(String, Byte[]) StorageCredentials(String, Byte[])

Initializes a new instance of the StorageCredentials class with the specified account name and key value.

StorageCredentials(String, String) StorageCredentials(String, String) StorageCredentials(String, String)

Initializes a new instance of the StorageCredentials class with the specified account name and key value.

StorageCredentials(String, Byte[], String) StorageCredentials(String, Byte[], String) StorageCredentials(String, Byte[], String)

Initializes a new instance of the StorageCredentials class with the specified account name, key value, and key name.

StorageCredentials(String, String, String) StorageCredentials(String, String, String) StorageCredentials(String, String, String)

Initializes a new instance of the StorageCredentials class with the specified account name, key value, and key name.

Properties

AccountName AccountName AccountName

Gets the associated account name for the credentials.

IsAnonymous IsAnonymous IsAnonymous

Gets a value indicating whether the credentials are for anonymous access.

IsSAS IsSAS IsSAS

Gets a value indicating whether the credentials are a shared access signature token.

IsSharedKey IsSharedKey IsSharedKey

Gets a value indicating whether the credentials are a shared key.

IsToken IsToken IsToken

Gets a value indicating whether the credentials are a bearer token.

KeyName KeyName KeyName

Gets the associated key name for the credentials.

SASSignature SASSignature SASSignature

Gets the value of the shared access signature token's sig parameter.

SASToken SASToken SASToken

Gets the associated shared access signature token for the credentials.

Methods

Equals(StorageCredentials) Equals(StorageCredentials) Equals(StorageCredentials)

Determines whether an other StorageCredentials object is equal to this one by comparing their SAS tokens, account names, key names, and key values.

ExportBase64EncodedKey() ExportBase64EncodedKey() ExportBase64EncodedKey()

Exports the value of the account access key to a Base64-encoded string.

ExportKey() ExportKey() ExportKey()

Returns the account key for the credentials.

TransformUri(StorageUri) TransformUri(StorageUri) TransformUri(StorageUri)

Transforms a resource URI into a shared access signature URI, by appending a shared access token.

TransformUri(Uri) TransformUri(Uri) TransformUri(Uri)

Transforms a resource URI into a shared access signature URI, by appending a shared access token.

UpdateKey(Byte[]) UpdateKey(Byte[]) UpdateKey(Byte[])

Updates the key value for the credentials.

UpdateKey(String) UpdateKey(String) UpdateKey(String)

Updates the key value for the credentials.

UpdateKey(Byte[], String) UpdateKey(Byte[], String) UpdateKey(Byte[], String)

Updates the key value and key name for the credentials.

UpdateKey(String, String) UpdateKey(String, String) UpdateKey(String, String)

Updates the key value and key name for the credentials.

UpdateSASToken(String) UpdateSASToken(String) UpdateSASToken(String)

Updates the shared access signature (SAS) token value for storage credentials created with a shared access signature.

Extension Methods

IsDefined(Object) IsDefined(Object) IsDefined(Object)

Determines if a certain property is defined or not.

IsNull(Object) IsNull(Object) IsNull(Object)

Determines if a certain property is null or not.

IsPrimitive(Object) IsPrimitive(Object) IsPrimitive(Object)

Determines if a certain property is of premitive JSON type.

Applies to