Skip to content

Latest commit

 

History

History
59 lines (38 loc) · 3.27 KB

storage-account-sas-create-dotnet.md

File metadata and controls

59 lines (38 loc) · 3.27 KB
title titleSuffix description services author ms.service ms.topic ms.date ms.author ms.reviewer ms.subservice ms.devlang ms.custom
Create an account SAS with .NET
Azure Storage
Learn how to create an account shared access signature (SAS) using the .NET client library.
storage
pauljewellmsft
azure-storage
how-to
09/21/2023
pauljewell
dineshm
storage-common-concepts
csharp
devx-track-csharp, devguide-csharp, devx-track-dotnet

Create an account SAS with .NET

[!INCLUDE storage-dev-guide-selector-account-sas]

[!INCLUDE storage-auth-sas-intro-include]

This article shows how to use the storage account key to create an account SAS with the Azure Storage client library for .NET.

About the account SAS

An account SAS is created at the level of the storage account. By creating an account SAS, you can:

  • Delegate access to service-level operations that aren't currently available with a service-specific SAS, such as Get Blob Service Properties, Set Blob Service Properties and Get Blob Service Stats.
  • Delegate access to more than one service in a storage account at a time. For example, you can delegate access to resources in both Azure Blob Storage and Azure Files by using an account SAS.

Stored access policies aren't supported for an account SAS.

Create an account SAS

An account SAS is signed with the account access key. You can use the StorageSharedKeyCredential class to create the credential that is used to sign the SAS.

The following code example shows how to create a new AccountSasBuilder object and call the ToSasQueryParameters method to get the account SAS token string.

:::code language="csharp" source="~/azure-storage-snippets/blobs/howto/dotnet/BlobDevGuideBlobs/CreateSas.cs" id="Snippet_CreateAccountSAS":::

Use an account SAS from a client

To use the account SAS to access service-level APIs for the Blob service, create a BlobServiceClient object using the account SAS and the Blob Storage endpoint for your storage account.

:::code language="csharp" source="~/azure-storage-snippets/blobs/howto/dotnet/BlobDevGuideBlobs/CreateSas.cs" id="Snippet_UseAccountSAS":::

Resources

To learn more about creating an account SAS using the Azure Blob Storage client library for .NET, see the following resources.

[!INCLUDE storage-dev-guide-resources-dotnet]

See also