0
0
Azurecloud~30 mins

Storage access keys and SAS tokens in Azure - Mini Project: Build & Apply

Choose your learning style9 modes available
Storage access keys and SAS tokens
📖 Scenario: You are managing access to an Azure Storage account for a small company. You need to set up the initial storage account keys, then create a Shared Access Signature (SAS) token to allow limited access to a container without sharing the full keys.
🎯 Goal: Build a simple Azure Storage configuration that defines storage account keys and generates a SAS token with specific permissions.
📋 What You'll Learn
Create a dictionary called storage_keys with two keys: primary_key and secondary_key with exact string values.
Add a variable called container_name with the exact value mycontainer.
Write a function called generate_sas_token that takes container_name and returns a SAS token string with read and write permissions.
Create a final dictionary called storage_access that includes storage_keys, container_name, and the SAS token from generate_sas_token.
💡 Why This Matters
🌍 Real World
Managing access to Azure Storage accounts securely by using keys and SAS tokens is common in cloud applications to control who can read or write data.
💼 Career
Understanding storage keys and SAS tokens is essential for cloud engineers and developers working with Azure Storage to implement secure and flexible access controls.
Progress0 / 4 steps
1
Create storage account keys dictionary
Create a dictionary called storage_keys with the exact keys 'primary_key' and 'secondary_key' and their values as 'abc123primary' and 'xyz789secondary' respectively.
Azure
Need a hint?

Use curly braces to create a dictionary with the exact keys and values.

2
Add container name variable
Add a variable called container_name and set it to the string 'mycontainer'.
Azure
Need a hint?

Assign the exact string 'mycontainer' to the variable container_name.

3
Write SAS token generation function
Write a function called generate_sas_token that takes one parameter container_name and returns the string 'sas_token_for_' + container_name + '_rw' to simulate a SAS token with read and write permissions.
Azure
Need a hint?

Define a function that returns the SAS token string by concatenating fixed parts with the container_name parameter.

4
Create final storage access dictionary
Create a dictionary called storage_access with keys 'keys', 'container', and 'sas_token'. Assign storage_keys to 'keys', container_name to 'container', and the result of generate_sas_token(container_name) to 'sas_token'.
Azure
Need a hint?

Create a dictionary with the exact keys and assign the correct variables and function call as values.