azure shared access signature example

Azure Shared Access Signature (SAS) Example: Secure Cloud Resources

By Kevin Harris
AD

Azure Shared Access Signatures (SAS) empower you to delegate access to Azure Storage resources without sharing your access credentials. Thisatetoken-based mechanism allows precise control over resource access, ensuring robustness and security in your applications. Let's delve into the intricacies of Azure SAS with practical examples.

Firstly, Azure SAS are crucial for several scenarios, including allowing users to upload blobs directly, providing access to shared content, or integrating with third-party services. By utilizing SAS, you maintain a high level of security while providing controlled, temporary access to your resources.

Understanding Azure Shared Access Signatures

Azure SAS comprises of components that together provide fine-grained control. These include the storage account access key, start time, expiry time, permissions, and protocols.

AD
Getting Started with Azure Storage Explorer
Getting Started with Azure Storage Explorer
Exploration of Azure OpenAI
Exploration of Azure OpenAI
Mounting & accessing ADLS Gen2 in Azure Databricks using Service Principal and Secret Scopes | Towards Data Science
Mounting & accessing ADLS Gen2 in Azure Databricks using Service Principal and Secret Scopes | Towards Data Science

Take, for instance, a scenario where you need to grant a user the ability to list and read blobs in a container, starting from April 1, 2022, until April 7, 2022. You could construct a SAS token like this:

```sashttps://myaccount.blob.core.windows.net/mycontainer?sr=c&si=2022-04-01T00%3A00%3A00Z%2F2022-04-07T23%3A59%3A59Z%26sig=Gmz یا izY%3D&sv=2020-04-08```

Is SHE in the room with us?
Is SHE in the room with us?
Azure Key Vault Creation, RBAC Setup, User Addition, Secret Management
Azure Key Vault Creation, RBAC Setup, User Addition, Secret Management
Hands-On Azure for Developers
Hands-On Azure for Developers

The sig parameter is the signature, created using the access key and visible data. The sv parameter indicates the API version, in this case, 2020-04-08.

SAS Tokens for Blobs

Blob SAS tokens offer granular control over blobs and containers. You can create SAS for listing blobs, reading or writing blobs, deleting blobs, or creating snapshots of blobs.

AD

For example, to create a SAS for listing blobs in a container, use the following permissions: sp=c (list container) and sp=rl (read blob metadata).

Configuring Azure Active Directory Single Sign-On (SSO) with Azure AD Connect | KC's Blog
Configuring Azure Active Directory Single Sign-On (SSO) with Azure AD Connect | KC's Blog
a drawing of a person wearing a witches hat and holding a wand with music notes on it
a drawing of a person wearing a witches hat and holding a wand with music notes on it
Microsoft Addresses Azure AD nOAuth Flaw Allowing Account Takeover
Microsoft Addresses Azure AD nOAuth Flaw Allowing Account Takeover
Azure
Azure
Securing Access With Privileged Identity Management For Azure Active Directory Roles
Securing Access With Privileged Identity Management For Azure Active Directory Roles
Just-in-time Access on Azure VMs
Just-in-time Access on Azure VMs

SAS Tokens for Queues

Queue SAS tokens are valuable for managing Azure Queue messages. You can create SAS for sending, peeking, processing, or deleting messages.

Let's consider a scenario wherein you need to send messages to a queue. The sp (shared permissions) parameter would take the value Nad=sm (send and manage messages).

AD

Creating and Using SAS Tokens

You can use various methods to create and obtain SAS tokens, such as Azure PowerShell, Azure CLI, or the Azure REST API. Here's an example of creating a SAS token using Azure CLI.

Getting List Of Users Accessing PowerApp
Getting List Of Users Accessing PowerApp
Azure
Azure
azuuur
azuuur
Automate Azure Key Vault Key Refresh with Managed Identity
Automate Azure Key Vault Key Refresh with Managed Identity
5 Free eSignature Alternatives To DocuSign
5 Free eSignature Alternatives To DocuSign
How I Secured Azure Virtual Machines Using NSGs and ASGs
How I Secured Azure Virtual Machines Using NSGs and ASGs
Private Docker repositories for data science with Azure | Towards Data Science
Private Docker repositories for data science with Azure | Towards Data Science
How To Upload APNS Certificate To Azure Portal
How To Upload APNS Certificate To Azure Portal
⋆。‧˚ʚ Azure . . ɞ˚‧ Layout on discord idea. ɞ˚‧。 ⋆
⋆。‧˚ʚ Azure . . ɞ˚‧ Layout on discord idea. ɞ˚‧。 ⋆
Qué significa cuando una persona firma con su nombre completo
Qué significa cuando una persona firma con su nombre completo
Azure
Azure
Copy and Paste Your Signature Online – No Scanner Needed!
Copy and Paste Your Signature Online – No Scanner Needed!
Microsoft Azure Tutorial for Beginners
Microsoft Azure Tutorial for Beginners
Azure Automation Accounts and Security
Azure Automation Accounts and Security

```bashaz storage container generate-sas --name mycontainer --permissions rwl --expiry 2022-04-07T23:59:59.0000000Z```

The above command grants read, write, and list permissions to the container mycontainer, expiring on April 7, 2022.

AD

With the SAS token in hand, you can now use it to access resources. For instance, you could use this token within an HTTP GET request to list blobs in the container:

```curl https://myaccount.blob.core.windows.net/mycontainer?comp=list -H "Authorization: SharedKey myaccount:SAS_TOKEN"```

emanates the HTTPS call with the necessary authorization header, invoking the requested action using the SAS token.

In the world of cloud security, Azure SAS provides a powerful toolkit for granting temporary, fine-grained access to your storage resources. By harnessing its capabilities, you can maintain robust, secure systems while also enabling delegation and integration when required.

AD