CloudStorageAccount.ToString Method ()

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.]

Returns a connection string for this storage account, without sensitive data.

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

Usage

Visual Basic
Dim instance As CloudStorageAccount
Dim returnValue As String

returnValue = instance.ToString

Syntax

Visual Basic
Public Overrides Function ToString As String
C#
public override string ToString ()
C++
public:
virtual String^ ToString () override
J#
JScript

Return Value

Type: System.String

A connection string.

Example

The following code example creates a reference to a storage account from a connection string, then writes out the connection string, without sensitive data.

C# Copy Code
static void GetConnectionString()
{
    //Parse a connection string and return a reference to the storage account.
    CloudStorageAccount storageAccount = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["StorageAccountConnectionString"]);

    //Output the connection string, omitting sensitive data (for example, the account key, if based on account and key credentials).
    Console.WriteLine("Connection string without sensitive data: " + storageAccount.ToString());
}

Remarks

The string returned omits any sensitive information such as account key data or shared access tokens. The value returned will be in a format similar to the following example:

DefaultEndpointsProtocol=https;AccountName=mystorageaccount;AccountKey=[key hidden]

To return sensitive information in the string, call ToString and pass in true for the exportSecrets parameter.


Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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