Generating a Shared Access Signature (SAS) token for your Azure Storage is important for managing secure access to different storage resources. In this article, I will walk you through all the approaches to doing this.
How To Generate SAS Token For Azure Storage
A SAS token for Azure storage can help you secure access to a resource inside your Azure storage account. Let’s discuss each method individually.
Approach-1: Using Azure Portal
To Generate SAS Token For Azure Storage, Follow the below steps.
1. Log in to the Azure Portal.
2. Search for Storage accounts and then click on the search result Storage accounts as shown in the screenshot below.

3. Click on the specific storage from the lists for the one you wish to generate the SAS access token.

4. Expand the Security + networking tab, then click on the Shared access signature link as shown in the screenshot below.

5. Select the required options for Allowed permissions, set the start and expiration date, etc., based on your requirements, and finally, click on the Generate SAS and connection string button, as highlighted in the screenshot below.


Now, the SAS token is generated successfully below the button, as shown in the screenshot below.

Check out: Create a storage account in Azure
Approach-2: Using PowerShell
We can execute the below PowerShell script to generate the SAS access token for the alazureml7822510715 storage account.
$strgact_name = "alazureml7822510715"
$strgact_key = "ogCGYSTLBnJkYtO5O9lPdB5K4uRjEKF9a8x+21JouWOYeiDi/mBq4eq7M7CAsyCv0r6RvqoB5sq3+ASttMeBSg=="
$mycontext = New-AzStorageContext -StorageAccountName $strgact_name -StorageAccountKey $strgact_key
#you can also add other parameters like ExpiryTime etc based on your requirement.
New-AzStorageAccountSASToken -Service Blob -ResourceType Service,Container,Object -Permission rl -Context $mycontextThe query executed successfully and the SAS token also got generated successfully as shown in the screenshot below.
