မင်္ဂလာပါ၊ Mindgnite.com ရဲ့ Cloud Knowledge Sharing မှ ပြန်လည်ကြိုဆိုပါတယ်။ ယခင် article မှာ Azure Blob Storage ရဲ့ အခြေခံ သဘောတရားတွေနဲ့ Blob container တစ်ခုကို ဘယ်လိုတည်ဆောက်ရမလဲဆိုတာ လေ့လာခဲ့ပြီးပါပြီ။ ဒီနေ့တော့ Blob Storage Security ကို ဘယ်လိုထိန်းသိမ်းရမလဲဆိုတာကို အသေးစိတ် ရှင်းပြပေးသွားမှာဖြစ်ပါတယ်။
Azure Storage Security ရဲ့ အဓိကနည်းလမ်းများ
Azure Storage ကို လုံခြုံအောင်ထားဖို့အတွက် နည်းလမ်းများစွာရှိပါတယ်။
- Shared Key (Access Key):
- Storage Account တစ်ခု ဖန်တီးလိုက်တာနဲ့
Access Keys
(primary key နဲ့ secondary key) နှစ်ခုကို ရရှိပါမယ်။ ဒီ keys တွေကို အသုံးပြုပြီး Storage Account တစ်ခုလုံးကို အပြည့်အဝ ထိန်းချုပ်နိုင်ပါတယ်။ - (အားနည်းချက်): ဒီ keys တွေဟာ အလွန်အစွမ်းထက်ပြီး အန္တရာယ်များပါတယ်။ တစ်စုံတစ်ယောက်က ဒီ key ကို ရရှိသွားမယ်ဆိုရင် သင့်ရဲ့ data တွေကို အလွယ်တကူ access လုပ်နိုင်ပြီး၊ အကုန်လုံးကို ဖျက်ဆီးပစ်နိုင်ပါတယ်။ ဒါကြောင့် production မှာ Shared Key ကို တိုက်ရိုက်အသုံးပြုခြင်းကို ရှောင်ကြဉ်သင့်ပါတယ်။
- Storage Account တစ်ခု ဖန်တီးလိုက်တာနဲ့
- Shared Access Signature (SAS):
- SAS ဆိုတာကတော့ Storage Account ရဲ့ Resources တွေကို အချိန်အတိုင်းအတာတစ်ခုအထိ ကန့်သတ်ထားတဲ့ access rights ပေးဖို့အတွက် အသုံးပြုနိုင်တဲ့ string တစ်ခုဖြစ်ပါတယ်။
- အဓိကအသုံးပြုပုံ: သင်ဟာ သုံးစွဲသူတစ်ဦးကို သတ်မှတ်ထားတဲ့ Blob တစ်ခုကို download လုပ်ခွင့် ပေးချင်တယ်ဆိုရင်၊ သတ်မှတ်ထားတဲ့အချိန်နဲ့ download လုပ်ခွင့်သာ ပေးနိုင်တဲ့ SAS တစ်ခုကို ဖန်တီးပေးနိုင်ပါတယ်။ SAS ကိုအသုံးပြုခြင်းဖြင့် Shared Key ပေါက်ကြားမှုကို ကာကွယ်နိုင်ပါတယ်။
- Role-Based Access Control (RBAC):
- Azure RBAC ကို အသုံးပြုပြီး Storage Account ရဲ့ resources တွေကို access လုပ်နိုင်ဖို့အတွက် သီးခြား permission တွေ ပေးနိုင်ပါတယ်။
- အဓိကအသုံးပြုပုံ: Developers အဖွဲ့ကို Blob Container တစ်ခုထဲမှာ files တွေ upload လုပ်ခွင့် ပေးချင်တယ်ဆိုရင်
Storage Blob Data Contributor
role ကို ပေးနိုင်ပါတယ်။ ဒီ role ဟာ files တွေကို upload, download နဲ့ delete လုပ်နိုင်ပေမယ့် Storage Account ရဲ့ key တွေကိုတော့ မြင်နိုင်မှာ မဟုတ်ပါဘူး။
- Azure Active Directory (Azure AD):
- Storage ကို access လုပ်ဖို့အတွက် Azure AD ကို အသုံးပြုနိုင်ပါတယ်။ ဒါက Shared Key ကို အသုံးပြုခြင်းထက် ပိုမိုလုံခြုံတဲ့ နည်းလမ်းဖြစ်ပါတယ်။
- အဓိကအသုံးပြုပုံ: Azure AD မှာရှိတဲ့ User, Group သို့မဟုတ် Service Principal တွေကို RBAC roles တွေနဲ့ တွဲဖက်ပြီး Storage Resources တွေကို access လုပ်ခွင့်ပေးနိုင်ပါတယ်။
လက်တွေ့လေ့ကျင့်ခန်း: Shared Access Signature (SAS) ကို ဖန်တီးခြင်း
Storage Account အတွက် SAS တစ်ခုကို ဘယ်လိုဖန်တီးရမလဲဆိုတာ လက်တွေ့လေ့လာကြည့်ရအောင်။
အဆင့် ၁: Storage Account သို့ သွားပါ Azure Portal မှာ သင့်ရဲ့ Storage Account ကို ရှာဖွေပြီး Overview page ကို သွားပါ။
အဆင့် ၂: Shared Access Signature (SAS) ကို ရွေးပါ ဘယ်ဘက်ခြမ်း menu က Security + networking အောက်မှာရှိတဲ့ Shared access signature ကို ရွေးပါ။
အဆင့် ၃: SAS ကို Configure လုပ်ပါ
- Allowed services:
Blob
ကို ရွေးပါ။ - Allowed resource types:
Container
နဲ့Object
ကို ရွေးပါ။ - Allowed permissions:
Read
ကိုသာ ရွေးပါ။ ဒါမှသာ data တွေကို ဖတ်ရုံပဲလုပ်နိုင်ပြီး edit, delete လုပ်နိုင်မှာ မဟုတ်ပါဘူး။ - Start and expiry date/time: SAS သက်တမ်းရှိမယ့် အချိန်ကာလကို သတ်မှတ်ပေးပါ။
- Allowed IP addresses: ဒီ SAS ကို အသုံးပြုခွင့်ရှိမယ့် IP Address တွေကို သတ်မှတ်နိုင်ပါတယ်။ (optional)
အဆင့် ၄: SAS token ကို ဖန်တီးပါ အချက်အလက်အားလုံး ဖြည့်ပြီးရင် Generate SAS and connection string
ကို နှိပ်ပါ။ ပြီးရင် SAS token
ကို ရရှိမှာဖြစ်ပါတယ်။ ဒီ token ကို အသုံးပြုပြီး သတ်မှတ်ထားတဲ့ Blob ကိုသာ ဖတ်ရှုနိုင်မှာ ဖြစ်ပါတယ်။
နောက်လာမယ့် article မှာတော့ Azure Storage ရဲ့ နောက်ထပ်အရေးကြီးတဲ့ အပိုင်းဖြစ်တဲ့ Data Protection (Backup & Recovery) အကြောင်းကို ဆက်လက်လေ့လာသွားပါမယ်။
English Version
Cloud Knowledge Sharing Article from Mindgnite.com
Welcome back to the Cloud Knowledge Sharing Article from Mindgnite.com. In a previous article, we learned about the basics of Azure Blob Storage and how to create a blob container. Today, we’ll dive into how to secure your Blob Storage.
Key Methods for Azure Storage Security
There are several methods to secure your Azure Storage.
- Shared Key (Access Key):
- When you create a Storage Account, you get two
Access Keys
(a primary key and a secondary key). These keys provide full control over the entire Storage Account. - Cons: These keys are very powerful and dangerous. If someone gets access to a key, they can access and delete all of your data. Therefore, you should avoid using Shared Keys directly in a production environment.
- When you create a Storage Account, you get two
- Shared Access Signature (SAS):
- An SAS is a string that can be used to grant limited access to Storage Account resources for a specific period.
- Primary Use Case: If you want to give a user permission to download a specific blob, you can create an SAS that only allows them to download it for a limited time. Using an SAS helps prevent the exposure of your Shared Key.
- Role-Based Access Control (RBAC):
- You can use Azure RBAC to grant specific permissions to access Storage Account resources.
- Primary Use Case: If you want to give a team of developers permission to upload files to a blob container, you can assign them the
Storage Blob Data Contributor
role. This role allows them to upload, download, and delete files but does not allow them to see the Storage Account keys.
- Azure Active Directory (Azure AD):
- You can use Azure AD to access Storage, which is a more secure method than using a Shared Key.
- Primary Use Case: You can grant access to Storage Resources by associating Azure AD users, groups, or Service Principals with RBAC roles.
Practical Lab: Creating a Shared Access Signature (SAS)
Let’s go through the steps to create an SAS for a Storage Account.
Step 1: Go to the Storage Account In the Azure Portal, search for your Storage Account and navigate to the Overview page.
Step 2: Select Shared Access Signature (SAS) In the left-hand menu, under Security + networking, select Shared access signature.
Step 3: Configure the SAS
- Allowed services: Select
Blob
. - Allowed resource types: Select
Container
andObject
. - Allowed permissions: Only select
Read
. This will ensure the user can only read the data and cannot edit or delete it. - Start and expiry date/time: Set the duration for which the SAS will be valid.
- Allowed IP addresses: You can specify the IP addresses that are allowed to use this SAS. (optional)
Step 4: Generate the SAS token After filling in all the information, click Generate SAS and connection string
. You will then receive the SAS token
. This token can be used to access only the specific blob you want.
In the next article, we will continue our learning journey by exploring Data Protection (Backup & Recovery), another critical aspect of Azure Storage.