Demystifying Service Principal (SP) and Managed Identity (MI)

Azure Cloud Architect တွေ ခေါင်း အစားရဆုံး ကတော့ ဘယ်အချိန်မှာ Service Principal  (SP) ကိုသုံးပြီး ဘယ်အချိန်မှာ Managed Identity (MI) ကို သုံးမလဲ ဆိုတာပါပဲ။

တကယ်က SP နဲ့  MI ရဲ့  နောက်ကွယ်က အလုပ်လုပ်ပုံ အမှန်တရားက အတူတူပါပဲ။

ကျတော် တို့ အရင် On-Premise AD တွေ သုံးတုန်းကဆိုရင် Application တွေ Service တွေ မှာ သုံးဖို့ Service Account ဆိုတာ Create လုပ်ပြီး သုံးကြ ရပါတယ်။

အဲဒီမှာ ပြဿနာက AD account တွေ ရဲ့ ထုံးစံ အရ Password Expiry Date ရှိနေတာပါပဲ။ Non-expired လုပ်ထားရင်လဲ Security အရ non-compliance ဖြစ်တဲ့ အတွက် ထားမရပါဘူး။

ဒီတော့ Password renew လုပ်ရတဲ့ Integrate လုပ်ထားတဲ့ Application, Service တွေ မှာ Password update လုပ်ရပါတယ်။

ဒီအခါမှာ Application, Network, System နဲ့ Infra သမားတို့ ထုံးစံ အတိုင်း ဘယ်နေရာ တွေမှာ Account ကို သုံးထားလဲ အကုန်မသိတဲ့ အခါ Production down တဲ့ impact မျိုးတွေ ကြုံ ရတာပါပဲ။

Azure Cloud မှာတော့ ဒီပြဿနာကို ဖြေရှင်း ဖို့ Service Principal (SP) နဲ့ Managed Identity (MI) ဆို တာ ရှိလာပါတယ်။

Service Prinicpal ဆိုတာက Create လုပ်လိုက်တာနဲ့ ID နဲ့ Credential ဆိုတာ ရလာပြီး၊ ရလာတဲ့ ID, Credential ကို Azure Keyvault လို Key, Secret Management Service တခုခုမှာ သိမ်းထားရပါတယ်။

ပြီး မှ Service Principal (SP) ကို Keyvault မှာ Role Base Access Control ပေးပြီး ပြန် သုံးရတာပါ။

SP ကို ဘယ်မှာ သုံးသင့်လဲ ဆိုတော့ AzureDevOps, Ansible, Terraform လို Automation Tools တွေ , Third Party Application, Enterprise Application တွေ မှာ Integrate လုပ်ပြီး Token Base Authenticaion တွေ နဲ့ သုံးသင့်ပါတယ်။



Managed Identity (MI) မှာ တော့ System-Assigned နဲ့ User-Assigned ဆိုပြီး နှစ်မျိုး ရှိပါတယ်။

System-Assigned ဆိုတာကတော့ Resource တခုမှာ ID တခု Assigned လုပ်ထားတာ ဖြစ်ပြီး Resource မရှိတော့ တာနဲ့ ID လဲ မရှိတော့ပါဘူး။

User-Assigned ကတော့ Azure AD မှာ Create လုပ်ပြီး Resource တွေ မှာ Assign ပြန်လုပ်ပြီး သုံးရတာပါ။

MI ရဲ့ ထူးခြား ချက်က Credential ကို မသိရတာပါပဲ။ ဒါကြောင့် ပဲ သူ့ အတွက် Credential ကို Azure Keyvault လို Secret Management Service တခုခုမှာ သွားသိမ်းစရာ မလိုတော့ပါဘူး။

သူကတော့ Azure Resource တွေ နဲ့ Link လုပ်ပြီး သုံးရတဲ့ အမျိုးအစားပါ။

ဥပမာ Azure File Share service ကို သုံးမယ့် Server VM တွေ အတွက် User-Assigned Storage Account Access MI တခု Create လုပ်ပြီး Server VM အားလုံးမှာ assign လုပ်တာမျိုးပေါ့။ 


အနှစ်ချုပ် ရမယ်ဆိုရင် ...

Service Prinicipal ကို Applications, Third Party Tools, Automation Tools တွေမှာ Integrate လုပ်ပြီး သုံးရမှာ ဖြစ်ပါတယ်။

သူ့ ကို သုံးမယ်ဆိုရင် Credential အတွက် Secret Key Management Service တခုခုလိုအပ်ပြီး၊ အနည်းငယ် ရှုပ်ထွေး ပြီး ပိုများ တဲ့ RBAC အဆင့်တွေ ကို အသုံးပြု ဖို့ လိုအပ်ပါတယ်။


Managed Identity ကို တော့ Azure Resource တွေ နဲ့ Link လုပ်ပြီး သုံးရမှာ ဖြစ်ပါတယ်။

သူ့ကို သုံးမယ်ဆိုရင်တော့ User-Assigned MI က‌တော့ Recommend ဖြစ်ပေမယ့် ကိုယ့် Architecture ပေါ် မူတည်ပြီး System-Assigned MI ကို လဲ သုံးသင့်ရင် သုံးရမှာပဲ ဖြစ်ပါတယ်။ System-Assigned ရဲ့ Life Cycle ကတော့ Resource ရဲ့ Life Cycle နဲ့ အတူတူပဲ ရှိတာကိုတော့ သတိချပ်ဖို့လိုပါတယ်။


ဒီလောက်ဆို SP နဲ့ MI အကြောင်း တီးမိခေါက်မိလောက်ပြီ ထင်ပါတယ်။


ကျေးဇူးတင်ပါတယ်။


ပျော်ရွှင်ပါစေ။

(Be knowledgeable, pass it on then)







No comments :

Post a Comment