(For Admins/Users) Power Automate vs Logic Apps และการใช้งาน

Narisorn Limpaswadpaisarn
EchoO365
Published in
7 min readJul 29, 2020

Content difficulty — Technical

Power Automate vs Logic Apps

เห็นหลายๆคนสงสัยกันเข้ามาเยอะระหว่าง Service สองตัวนี้เนื่องจากการทำงานมันคือเป็นรูปแบบ Workflow automation เหมือนกัน ในส่วน main หลักถ้าเข้าใจใน Power Automate (ชื่อเก่าคือ Microsoft Flow) แล้วก็สามารถทำ Logic Apps (มาแทน Azure Scheduler) ได้ไม่ยาก ด้วยตัวของ service ทั้งคู่ทำเพื่อมา integrate กับระบบ Software as a Service (SaaS) อื่นๆทั้งของ Microsoft เองหรือ 3rd Party SaaS Applications โดย Power Automate ก็มีพื้นฐานโครงสร้างมาจาก Azure Logic Apps และทั้งคู่ก็เป็น Serverless หรือ เรียกว่า IPaaS (Integration Platform as a Service)

Power Automate (web-based)
Azure Logic Apps (web-based) สามารถ edit แบบนี้ได้ใน Visual Studio ได้เช่นกัน

รูปแบบการให้บริการและการใช้งาน

ในส่วนของ Power Automate จะเป็นในรูปแบบที่เป็น Software as a Service (SaaS) ซึ่งใช้ผ่าน Portal บน Microsoft 365 ผ่าน https://flow.microsoft.com/ ซึ่ง Account ไหนมี license แล้วก็สามารถเข้าไปใช้ได้เลยไม่ต้องติดตั้งแต่อย่างใด ส่วนของ Logic Apps จะต้องมีการสร้าง Service ผ่าน Resource Group บน Azure Portal ก่อนคือจาก https://portal.azure.com โดยไปเลือกว่าจะสร้างแบบ Consumption หรือ Standard และจะต้องมีการกำหนดชื่อ resources, Resource Group, กำหนด Region หรือ properties ส่วนที่เราสามารถไป config กับ Azure Log Analytics ได้ด้วย จริงๆแล้ว Logic Apps ถึงจะมองเป็น SaaS แต่เราอาจจะต้องจัดการ properties อื่นๆด้วย

ในส่วน identity โดยการใช้งานของ Power Automate ก็จะเป็น user, group identities แต่กับ Logic Apps นั้นเราอาจจะมีให้ทั้ง user, group หรือ services identity (Service Principal) เข้ามาเรียกใช้งาน เช่น Web application ต่างๆใน solution ของเรา

การสร้าง workflow, การ run, approve งาน หรือ monitor การใช้งานของ Power Automate มาจากการทั้งเข้าผ่าน web-based (https://make.powerautomate.com) หรือ จาก Application ในมือถือ (สามารถ Download ได้ทั้ง iOS และ Android) แต่ส่วน Logic Apps เข้าจาก web-based บน Azure Portal(https://portal.azure.com) หรือทำผ่าน Visual Studio ก็ได้ และสามารถ edit ตัว JSON Definition ตรงๆเลยก็ได้

ควบคุมการ run, ดู history จากมือถือ (Power Automate)
VS Code Extension สำหรับ Logic Apps

License

Power Automate license ก็จะขายเป็น per user ที่สามารถ connect กับ Premium connector, Custom connector หรือ on-premise connector ได้, per flow ที่ fixed cost ตาม flow ที่เราสร้างเลย connect ได้เท่ากับ per-user, Plan ที่มาพร้อมกับ Power Apps plans ก็สามารถใช้งานได้เช่นกัน (ในมุมของการใช้ Trigger ที่มาจาก Power Apps) ส่วน plan ที่แถมมากับ Office 365 (บาง plans) ก็จะได้แค่ Standard connector ซึ่งแต่ละ plan มี performance Profile ที่ต่างกันตามนี้ https://docs.microsoft.com/en-us/power-automate/limits-and-config#performance-profiles

นอกจากนี้ยังมี Plan ที่สามารถใช้ในมุม Robotic Process Automation (RPA) ด้วยเพื่อทำ automate action ให้กับระบบ software เก่าๆที่ไม่ support ตัว REST API ทั้งที่เป็นแบบ Attended และ Unattended

รายละเอียดของ Attended และ Unattended ไปดูได้ที่ https://link.medium.com/j7YYe9seoob

Azure Logic Apps license ก็จะเป็นแบบ Consumption (multi-tenant) หรือ Standard (single tenant)

ซึ่งแบบ Consumption จะเป็นแบบ Multi-tenant ราคาคิด per execution (ไม่ว่า Failed หรือ Success) และมี Storage อยู่ในตัว Service ซึ่งจะเหมาะกับงานส่วนใหญ่

ส่วนแบบ Standard จะเป็น Single tenant ซึ่ง throughput, สามารถ Integrate กับ Virtual Networks (VNETs) + Private Endpoint, custom connector ดีกว่าราคา fixed ตาม hosting plan แต่มีความยืดหยุ่นที่เราสามารถ attach ตัว Azure Storage Account ของเราที่สร้างมาเองตะหากได้เพื่อ control ที่มากขึ้น

สำหรับ On-premise connector จะต้องตั้ง Server ที่เป็น Gateway ด้วยทั้ง Power Automate หรือ Logic Apps

ผู้ที่ใช้งาน

ตัว Power Automate จะเหมาะสำหรับ users, power users หรือ admins ที่อยากจะทำระบบ automation process ภายในองค์กร ส่วนใหญ่ตัว services ที่มาใช้ใน flow ก็จะเป็นพวก user-based เช่น Office 365 อย่าง Outlook, Excel, OneDrive, SharePoint หรือ 3rd party SaaS อย่าง Google Drive, Twitter, Eventbrite, Marketo, ระบบ Calendar ต่างๆ, ระบบ Survey, จด Note, พวก communication/collaboration platform ไปจนถึงระบบ Database หรือ ERP หรือถ้าในมุมการทำ Low-code Application ก็จะใช้กับพวก Power Platform เช่น Power Apps หรือ Power BI

ตัว Logic Apps จะถูก Design มาใช้การทำ web development project, API development เช่น ทำในส่วนของการ integrate กับ event-based service เช่น Azure Functions, Azure Storage, Azure Service Bus, Azure Application Insight เพื่อให้ Application หลังบ้านคุยกันได้, การไป connect ระบบเพื่อส่ง mail notification แจ้งเตือนทีม Dev หรือ Azure Admin โดยใช้ connector อย่าง Gmail หรือ SendGrid หรือ งานของ Security Admin ที่ต้องรับ Alert จาก Azure Security Center เพื่อให้ทีมงานได้รับทราบหรือส่งต่อไประบบอื่นๆ

อย่างไรก็ตามตัว list ของ connectors ทั้งสองจะมีเหมือนกัน, เท่ากัน และต่อได้ทั้งคู่ อย่าง SQL Server, Azure Data Lake ก็สามารถที่จะ connect ได้ทั้ง Power Automate หรือ Logic Apps อยู่ที่ว่าใช้ credential ใคร, manage project ฝั่งไหน, service connect มาจากฝั่งไหน

ถ้าผู้ใช้ทำในส่วน project แบบ Low-code, no-code ฝั่งที่เป็นการ integrate มาใช้กับ Excel, Power Apps, SharePoint (หรือ SQL Server บางกรณี) ก็คนทำเป็น Power user ไม่ใช่ developer แบบนี้ควรทำใน Power Automate แต่ถ้าเป็นงานระบบ back-end application หลังบ้านของทางทีม Dev ก็อาจจะสร้างจากฝั่ง Logic Apps เพื่ออยู่ใน Resource group เดียวกับ service อื่นๆของ Project ของ app ที่ run อยู่บน Azure เหมาะสมกว่าในมุม Management หรือในงานที่เป็นแนว DevOps ก็อาจจะใช้ร่วมกับ Azure DevOps

ทั้งสองยังส่งข้อมูลหาระหว่างกันได้ เช่น จะทำ flow แล้วใช้ action อย่าง HTTP สามารถ Request หรือ Response ก็ส่งค่าไปกลับระหว่าง Flow ใน Power Automate และ Logic Apps ได้เพื่อให้ trigger run อีกระบบ

Features อื่นๆ

Power Automate มีการต่อกับ Power Automate Desktop (Desktop Flow) เพื่อทำ RPA solutions มี concept ในการไป run ใน Child Flow หรือใช้ทำ Flow type ประเภท Business Process Flow ที่ต่อกับ Dataverse

การเอาไป run ต่อใน Desktop Flow หรือ Child Flow

ส่วนของ Azure Logic Apps จะไม่ได้ไป run ต่อที่ Child Flow แต่จะเรียกว่า Nested Logic Apps แทน

Nested Logic Apps

Power Automate มี pre-made template หลากหลายที่ให้เราไปเลือกใช้และ modify ต่อได้เลย

Power Automate มีการทำ Approval ได้ผ่าน Approval connector และ notification ผ่าน Send Notification connector

Power Automate มี performance profile ที่หลากหลายแต่โดยรวม ตัว Azure Logic App จะมี performance ที่ดีกว่า

Power Automate มี feature ในการ comment หรือ note ที่ช่วยเรื่อง co-authoring กับผู้อื่นในขณะที่ Azure Logic Apps ยังไม่มี

Power Automate มีระบบ Comment ที่คุยเป็น message thread

Power Automate มี limit ตัว API request ในแต่ละวันตาม License ที่เจ้าของ Flow นั้นมี (ยิ่งใน 1 flow มี action เยอะก็กิน API ต่อการ run แต่ละครั้งเยอะ) ถ้าหมดก็อาจจะมีการ queue หยุดการทำงานเพื่อรอวันต่อไป ซึ่ง paid license ก็จะมี quota ต่อวันที่เยอะกว่าและ performance ดีกว่า

Azure Logic Apps สามารถ Monitor โดยการใช้ Azure Tools แต่ Logic App จะ monitor หลักๆผ่าน Analytics ใน Flow นั้นๆ หรือรวมผ่าน Power Platform Admin Center

Azure Logic Apps มีการทำ error handling ที่หลากหลายกว่า

Azure Logic App สามารถทำการ trigger service แบบ event based จากพวก Azure Event Grid ได้จึงสามารถรับพวก Infrastructure level event หรือ webhook trigger ได้เพื่อ run flow ซึ่งตรงนี้ตัว Power Automate ไม่ได้มีมาให้แบบ built in แต่สามารถทำ integrate ได้ในส่วนของ custom connector เพิ่มเติม

Power Automate สามารถทำการ Peek code เพื่อดู JSON Schema ได้แต่ไม่สามารถ Edit ได้แบบ Azure Logic App

Azure Logic App สามารถทำได้ทั้ง peek code และ edit ตัว JSON data

ทั้งคู่สามารถทำงานร่วมกันได้ เช่น run flow จาก Power Automate ส่งค่า ไป run flow ของ Azure Logic App ต่อได้

Export and Share

ของ Power Automate สามารถ export เข้าไปที่ Power Automate ของ user อื่นทั้งในและนอกองค์กรก็ได้ซึ่งเป็น .zip file หรือ export เพื่อใช้ใน Logic App ได้เป็น .json

ตัว Power Automate สามารถ package รวมกับ Power Apps หรือ component dependencies อื่นๆของ Power Platform ไปในรูปแบบของ Solutions เพื่อไป deploy ลง Environment หรือ tenant อื่นๆได้

*** ตอนนี้ Flow ที่สร้างหลัง Aug 2020 จะไม่สามารถ Export เป็น .json เพื่อเอาไปใช้สร้าง Logic App ได้แล้วเนื่องจากทาง Microsoft ทำการ standardize ตัว protocol engine ของ Open API 2.0 ซึ่งไม่ compatible กับการ import ไปที่ Logic App workflow

Export template

ในส่วนของ Logic Apps เองสามารถ Export เพื่อมาใช้ใน Power Automate ได้ซึ่งเราต้องกำหนดว่าไปที่ Environment ไหน แต่ในที่นี้คำว่า Export คือเป็น custom connector ให้เราไปใช้ใน flow ใน Power Automate เรามาเรียก Logic App ให้เริ่มทำงาน

กรณีนี้เราต้องมี License ที่สามารถเรียก custom connector/premium ได้ในฝั่ง Power Automate

สมมุติ trigger ของ Logic Apps รับ body ของ HTTP
Export to Power Automate from Azure Logic Apps
สามารถ trigger ไป Logic Apps ได้แบบ custom connector
ใส่ข้อมูล input ที่เป็น HTTP body เพื่อส่งไป run ที่ Logic Apps
มา list อยู่ใน custom connectors ในหน้า Power Apps

การ share access เพื่อเข้ามา edit หรือ config ใน Power Automate ทำได้เลยซึ่ง flow นั้น share เป็น user หรือ group ซึ่งพอสำเร็จแล้วจาก My flow เมื่อ share จะเป็น Teams flows

การ share จะเป็นการให้ full access กับคนๆนั้นกับการ connection ใน connector ต่างๆ (ที่ flowนั้นใช้) ควรระวังให้ดี

สามารถแชร์ไปที่ SharePoint site ที่ต้องการให้สมาชิกของ SharePoint site นั้นๆสามารถ access ได้

ใน Flow แบบ Manual trigger (Instant cloud flow)ก็สามารถ set ให้ เป็นประเภท Run as account โดยใช้ credential ของ user คนนั้นเองได้ทำให้เราไม่ต้องให้เขามาเป็น Owner ของ flow

Flow sharing
Team flows

ส่วนการ share access เพื่อเข้ามา edit หรือ config ใน Logic Apps มาจาก Role-based Access Control จาก Azure Portal ซึ่ง assign เป็น user หรือ Service Principal (service account) ได้

Role-Based Access Control (RBAC)

Security

ตัว Power Automate สามารถใช้ Data policies (Data Loss Prevention Policy) ในการควบคุมได้เพื่อ limit การ run เฉพาะ Environment นั้นๆเพื่อแยก Data Group ซึ่งมี Business, Non-Business และ Blocked ว่าอนุญาต connector ให้ run คุยกันได้ในกลุ่ม Business เท่านั้น หรือ สามารถคุยและใช้ร่วมกันได้ใน Non-Business กันเอง แต่ไม่สามารถคุยกันข้ามระหว่าง Business และ Non-Business ได้ และกลุ่ม Blocked ก็คือคนที่สร้าง App และ Flow ใน Environment นั้นจะไม่สามารถใช้งาน connector นี้ได้เลย

ตัว Power Automate มี Admin Center เป็นของตัวเองโดย URL คือ https://admin.flow.microsoft.com/ (หรือพิมพ์ว่า https://aka.ms/ppac)

Environment คือ container ที่เก็บ flow, Common Data Services (CDS) หรือ App บน Power Apps ซึ่งใน tenant สามารถ create ได้หลาย Environment

แต่ด้วยตัว Data ใน Data Center เองเป็น encryption at rest อยู่แล้ว ส่วน Identity ก็ผ่าน Azure Active Directory และ connector ก็ตาม Account ของ Owner ว่ามี License (บาง 3rd Party app เป็น Bring Your Own License) หรือ connector ต้องใช้ credential เพื่อ Authenticate เพิ่มหรือไม่ เช่น SQL Server

Data Group เลือก connector ที่ใช้ในแต่ละกลุ่ม
Data policies นี้จะใช้ใน Environment ไหนบ้าง หรือเป็น Global ทุก Environment

ส่วนฝั่ง Logic Apps ก็ค่อนข้างมีความซับซ้อนกว่าโดยรวม เช่น มีเรื่องการกำหนด IP Ranges ได้, การทำ Managed Identities เพื่อใช้ Connector, Shared Access Signature เพื่อ http requests หรือ การแยก connector เพื่อ isolate ไม่ให้ run ในระบบผ่าน Azure Policy ซึ่ง concept จะมีมากกว่าบน Power Automate

ด้วยตัว Data ใน Data Center เองเป็น encryption at rest เหมือนของ Power Automate เพราะเป็นพื้นฐานของ Azure Storage เช่นกัน

--

--

Narisorn Limpaswadpaisarn
EchoO365

Office 365 and Modern Workplaces: Please follow my publication https://medium.com/echoo365 for Microsoft 365 & Power Platform Blog (In Thai)