Show / Hide Table of Contents

Class AccountSasBuilder

AccountSasBuilder is used to generate an account level Shared Access Signature (SAS) for Azure Storage services. For more information, see Create an account SAS.

Inheritance
System.Object
AccountSasBuilder
Namespace: System.Dynamic.ExpandoObject
Assembly: Azure.Storage.Common.dll
Syntax
public class AccountSasBuilder

Constructors

AccountSasBuilder()

Initializes a new instance of the AccountSasBuilder class.

Declaration
[System.ComponentModel.EditorBrowsable]
public AccountSasBuilder ();
Remarks

This constructor has been deprecated. Please consider using AccountSasBuilder(AccountSasPermissions, DateTimeOffset, AccountSasServices, AccountSasResourceTypes) to create a Service SAS. This change does not have any impact on how your application generates or makes use of SAS tokens.

AccountSasBuilder(AccountSasPermissions, DateTimeOffset, AccountSasServices, AccountSasResourceTypes)

Initializes a new instance of the AccountSasBuilder class to create a Blob Container Service Sas.

Declaration
public AccountSasBuilder (Azure.Storage.Sas.AccountSasPermissions permissions, DateTimeOffset expiresOn, Azure.Storage.Sas.AccountSasServices services, Azure.Storage.Sas.AccountSasResourceTypes resourceTypes);
Parameters
AccountSasPermissions permissions

The time at which the shared access signature becomes invalid. This field must be omitted if it has been specified in an associated stored access policy.

System.DateTimeOffset expiresOn

The time at which the shared access signature becomes invalid. This field must be omitted if it has been specified in an associated stored access policy.

AccountSasServices services

Specifies the services accessible from an account level shared access signature.

AccountSasResourceTypes resourceTypes

Specifies the resource types accessible from an account level shared access signature.

Properties

EncryptionScope

Optional. Encryption scope to use when sending requests authorized with this SAS URI.

Declaration
public string EncryptionScope { get; set; }
Property Value
System.String

ExpiresOn

The time at which the shared access signature becomes invalid. This field must be omitted if it has been specified in an associated stored access policy.

Declaration
public DateTimeOffset ExpiresOn { get; set; }
Property Value
System.DateTimeOffset

IPRange

Specifies an IP address or a range of IP addresses from which to accept requests. If the IP address from which the request originates does not match the IP address or address range specified on the SAS token, the request is not authenticated. When specifying a range of IP addresses, note that the range is inclusive.

Declaration
public Azure.Storage.Sas.SasIPRange IPRange { get; set; }
Property Value
SasIPRange

Permissions

The permissions associated with the shared access signature. The user is restricted to operations allowed by the permissions. The AccountSasPermissions type can be used to create the permissions string.

Declaration
public string Permissions { get; }
Property Value
System.String

Protocol

The optional signed protocol field specifies the protocol permitted for a request made with the SAS. Possible values are HttpsAndHttp, Https, and None.

Declaration
public Azure.Storage.Sas.SasProtocol Protocol { get; set; }
Property Value
SasProtocol

ResourceTypes

The resource types associated with the shared access signature. The user is restricted to operations on the specified resources.

Declaration
public Azure.Storage.Sas.AccountSasResourceTypes ResourceTypes { get; set; }
Property Value
AccountSasResourceTypes

Services

The services associated with the shared access signature. The user is restricted to operations with the specified services.

Declaration
public Azure.Storage.Sas.AccountSasServices Services { get; set; }
Property Value
AccountSasServices

StartsOn

Optionally specify the time at which the shared access signature becomes valid. If omitted when DateTimeOffset.MinValue is used, start time for this call is assumed to be the time when the storage service receives the request.

Declaration
public DateTimeOffset StartsOn { get; set; }
Property Value
System.DateTimeOffset

Version

The storage service version to use to authenticate requests made with this shared access signature, and the service version to use when handling requests made with this shared access signature.

Declaration
[System.ComponentModel.EditorBrowsable]
public string Version { get; set; }
Property Value
System.String

Remarks

This property has been deprecated and we will always use the latest

storage SAS version of the Storage service supported. This change

does not have any impact on how your application generates or makes

use of SAS tokens.

Methods

Equals(Object)

Check if two AccountSasBuilder instances are equal.

Declaration
[System.ComponentModel.EditorBrowsable]
public override bool Equals (object obj);
Parameters
System.Object obj

The instance to compare to.

Returns
System.Boolean

True if they're equal, false otherwise.

GetHashCode()

Get a hash code for the AccountSasBuilder.

Declaration
[System.ComponentModel.EditorBrowsable]
public override int GetHashCode ();
Returns
System.Int32

Hash code for the AccountSasBuilder.

SetPermissions(AccountSasPermissions)

Sets the permissions for an account SAS.

Declaration
public void SetPermissions (Azure.Storage.Sas.AccountSasPermissions permissions);
Parameters
AccountSasPermissions permissions

AccountSasPermissions containing the allowed permissions.

SetPermissions(String)

Sets the permissions for the SAS using a raw permissions string.

Declaration
public void SetPermissions (string rawPermissions);
Parameters
System.String rawPermissions

Raw permissions string for the SAS.

ToSasQueryParameters(StorageSharedKeyCredential)

Use an account's StorageSharedKeyCredential to sign this shared access signature values to produce the proper SAS query parameters for authenticating requests.

Declaration
public Azure.Storage.Sas.SasQueryParameters ToSasQueryParameters (Azure.Storage.StorageSharedKeyCredential sharedKeyCredential);
Parameters
StorageSharedKeyCredential sharedKeyCredential

The storage account's StorageSharedKeyCredential.

Returns
SasQueryParameters

The SasQueryParameters used for authenticating requests.

ToSasQueryParameters(StorageSharedKeyCredential, String)

Use an account's StorageSharedKeyCredential to sign this shared access signature values to produce the proper SAS query parameters for authenticating requests.

Declaration
public Azure.Storage.Sas.SasQueryParameters ToSasQueryParameters (Azure.Storage.StorageSharedKeyCredential sharedKeyCredential, out string stringToSign);
Parameters
StorageSharedKeyCredential sharedKeyCredential

The storage account's StorageSharedKeyCredential.

System.String stringToSign

For debugging purposes only. This string will be overwritten with the string to sign that was used to generate the SasQueryParameters.

Returns
SasQueryParameters

The SasQueryParameters used for authenticating requests.

ToString()

Returns a string that represents the current object.

Declaration
[System.ComponentModel.EditorBrowsable]
public override string ToString ();
Returns
System.String

A string that represents the current object.

Back to top Azure SDK for .NET