microsoft-azure-storage/src/com/microsoft/azure/storage/table/CloudTable.java
public String generateSharedAccessSignature(
            final SharedAccessTablePolicy policy, final String accessPolicyIdentifier, final String startPartitionKey,
            final String startRowKey, final String endPartitionKey, final String endRowKey, final IPRange ipRange,
            final SharedAccessProtocols protocols)
            throws InvalidKeyException, StorageException {

        if (!StorageCredentialsHelper.canCredentialsSignRequest(this.tableServiceClient.getCredentials())) {
            throw new IllegalArgumentException(SR.CANNOT_CREATE_SAS_WITHOUT_ACCOUNT_KEY);
        }

        final String resourceName = this.getSharedAccessCanonicalName();

        final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForTable(
                policy, accessPolicyIdentifier, resourceName, ipRange, protocols,
                startPartitionKey, startRowKey, endPartitionKey, endRowKey, this.tableServiceClient);

        final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForTable(
                policy, startPartitionKey, startRowKey, endPartitionKey, endRowKey, accessPolicyIdentifier,
                ipRange, protocols, this.name,  signature);

        return builder.toString();
    }
public String generateSharedAccessSignature(
            final SharedAccessTablePolicy policy, final String accessPolicyIdentifier, final String startPartitionKey,
            final String startRowKey, final String endPartitionKey, final String endRowKey, final IPRange ipRange,
            final SharedAccessProtocols protocols)
            throws InvalidKeyException, StorageException {

        if (!StorageCredentialsHelper.canCredentialsSignRequest(this.tableServiceClient.getCredentials())) {
            throw new IllegalArgumentException(SR.CANNOT_CREATE_SAS_WITHOUT_ACCOUNT_KEY);
        }

        final String resourceName = this.getSharedAccessCanonicalName();

        final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForTable(
                policy, accessPolicyIdentifier, resourceName, ipRange, protocols,
                startPartitionKey, startRowKey, endPartitionKey, endRowKey, this.tableServiceClient);

        final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForTable(
                policy, startPartitionKey, startRowKey, endPartitionKey, endRowKey, accessPolicyIdentifier,
                ipRange, protocols, this.name,  signature);

        return builder.toString();
    }
Creates a shared access signature for the table.

@param policy
A {@link SharedAccessTablePolicy} object which represents the access policy for the shared access
signature.
@param accessPolicyIdentifier
A <code>String</code> which represents a table-level access policy.
@param startPartitionKey
A <code>String</code> which represents the starting partition key.
@param startRowKey
A <code>String</code> which represents the starting row key.
@param endPartitionKey
A <code>String</code> which represents the ending partition key.
@param endRowKey
A <code>String</code> which represents the ending end key.
@param ipRange
A {@link IPRange} object containing the range of allowed IP addresses.
@param protocols
A {@link SharedAccessProtocols} representing the allowed Internet protocols.

@return A <code>String</code> containing the shared access signature for the table.

@throws InvalidKeyException
If an invalid key was passed.
@throws StorageException
If a storage service error occurred.
@throws IllegalArgumentException
If an unexpected value is passed.