microsoft-azure-storage/src/com/microsoft/azure/storage/CloudStorageAccount.java
public static CloudStorageAccount parse(final String connectionString) throws URISyntaxException,
            InvalidKeyException {
        if (connectionString == null || connectionString.length() == 0) {
            throw new IllegalArgumentException(SR.INVALID_CONNECTION_STRING);
        }

        // 1. Parse connection string in to key / value pairs
        final Map<String, String> settings = Utility.parseAccountString(connectionString);

        // 2 Validate General Settings rules,
        // - only setting value per key
        // - setting must have value.
        for (final Entry<String, String> entry : settings.entrySet()) {
            if (entry.getValue() == null || entry.getValue().equals(Constants.EMPTY_STRING)) {
                throw new IllegalArgumentException(SR.INVALID_CONNECTION_STRING);
            }
        }

        // 3. Validate scenario specific constraints
        CloudStorageAccount account = tryConfigureDevStore(settings);
        if (account != null) {
            return account;
        }

        account = tryConfigureServiceAccount(settings);
        if (account != null) {
            return account;
        }

        throw new IllegalArgumentException(SR.INVALID_CONNECTION_STRING);
    }
public static CloudStorageAccount parse(final String connectionString) throws URISyntaxException,
            InvalidKeyException {
        if (connectionString == null || connectionString.length() == 0) {
            throw new IllegalArgumentException(SR.INVALID_CONNECTION_STRING);
        }

        // 1. Parse connection string in to key / value pairs
        final Map<String, String> settings = Utility.parseAccountString(connectionString);

        // 2 Validate General Settings rules,
        // - only setting value per key
        // - setting must have value.
        for (final Entry<String, String> entry : settings.entrySet()) {
            if (entry.getValue() == null || entry.getValue().equals(Constants.EMPTY_STRING)) {
                throw new IllegalArgumentException(SR.INVALID_CONNECTION_STRING);
            }
        }

        // 3. Validate scenario specific constraints
        CloudStorageAccount account = tryConfigureDevStore(settings);
        if (account != null) {
            return account;
        }

        account = tryConfigureServiceAccount(settings);
        if (account != null) {
            return account;
        }

        throw new IllegalArgumentException(SR.INVALID_CONNECTION_STRING);
    }
public static CloudStorageAccount parse ( final String connectionString ) throws URISyntaxException , InvalidKeyException { if ( connectionString == null || connectionString . length ( ) == 0 ) { throw new IllegalArgumentException ( SR . INVALID_CONNECTION_STRING ) ; } // 1. Parse connection string in to key / value pairs final Map < String , String > settings = Utility . parseAccountString ( connectionString ) ; // 2 Validate General Settings rules, // - only setting value per key // - setting must have value. for ( final Entry < String , String > entry : settings . entrySet ( ) ) { if ( entry . getValue ( ) == null || entry . getValue ( ) . equals ( Constants . EMPTY_STRING ) ) { throw new IllegalArgumentException ( SR . INVALID_CONNECTION_STRING ) ; } } // 3. Validate scenario specific constraints CloudStorageAccount account = tryConfigureDevStore ( settings ) ; if ( account != null ) { return account ; } account = tryConfigureServiceAccount ( settings ) ; if ( account != null ) { return account ; } throw new IllegalArgumentException ( SR . INVALID_CONNECTION_STRING ) ; }
Parses a connection string and returns a cloud storage account created from the connection string.
<p>
The connection string should be in the <a href="http://msdn.microsoft.com/library/azure/ee758697.aspx">Azure
connection string</a> format.
<p>
Note that while a connection string may include a SAS token, it is often easier to use the
{@link CloudBlobContainer#CloudBlobContainer(URI)}, {@link CloudQueue#CloudQueue(URI)},
{@link CloudTable#CloudTable(URI)} constructors directly. To do this, create a
{@link StorageCredentialsSharedAccessSignature#StorageCredentialsSharedAccessSignature(String)} object with your
SAS token, use the {@link StorageCredentialsSharedAccessSignature#transformUri(URI)} method on the container,
queue, or table URI, and then use that URI to construct the object.

@param connectionString
A <code>String</code> that represents the connection string to parse.

@return A {@link CloudStorageAccount} object that represents the cloud storage account constructed from the
values provided in the connection string.

@throws InvalidKeyException
If credentials in the connection string contain an invalid key.
@throws URISyntaxException
If the connection string specifies an invalid URI.
Parses a connection string and returns a cloud storage account created from the connection string . <p > The connection string should be in the <a href = http : // msdn . microsoft . com / library / azure / ee758697 . aspx > Azure connection string< / a > format . <p > Note that while a connection string may include a SAS token it is often easier to use the { @link CloudBlobContainer#CloudBlobContainer ( URI ) } { @link CloudQueue#CloudQueue ( URI ) } { @link CloudTable#CloudTable ( URI ) } constructors directly . To do this create a { @link StorageCredentialsSharedAccessSignature#StorageCredentialsSharedAccessSignature ( String ) } object with your SAS token use the { @link StorageCredentialsSharedAccessSignature#transformUri ( URI ) } method on the container queue or table URI and then use that URI to construct the object .