8

Calling Graph API from Azure Logic Apps using delegated permissions

 3 years ago
source link: https://techcommunity.microsoft.com/t5/integrations-on-azure/calling-graph-api-from-azure-logic-apps-using-delegated/ba-p/1997666?WT_mc_id=DOP-MVP-4025064
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Calling Graph API from Azure Logic Apps using delegated permissions%3CLINGO-SUB%20id%3D%22lingo-sub-1997666%22%20slang%3D%22en-US%22%3ECalling%20Graph%20API%20from%20Azure%20Logic%20Apps%20using%20delegated%20permissions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1997666%22%20slang%3D%22en-US%22%3E%3CP%3EMicrosoft%20Graph%20API%20is%20a%20powerful%20REST%20API%20that%20enables%20access%20to%20cloud%20resources%20and%20it%20supports%20two%20types%20of%20permissions%2C%20application%20and%20delegated%20permissions.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESome%20operations%20do%20not%20support%20application%20permissions%2C%20it%20only%20support%20delegated%20permissions.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20call%20Graph%20API%20from%20Azure%20Logic%20Apps%20using%20delegated%20permissions%2C%20follow%20the%20steps%20below%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E1.%20Register%20an%20app%2C%20add%20required%20delegated%20API%20permissions%20to%20your%20registered%20app%20and%20grant%20admin%20consent.%3C%2FP%3E%0A%3COL%20class%3D%22lia-list-style-type-lower-alpha%22%3E%0A%3CLI%3EGo%20to%20your%20Azure%20Active%20directory%3C%2FLI%3E%0A%3CLI%3EFrom%20left%20side%20menu%2C%20click%20on%20%3CSTRONG%3EManage%3C%2FSTRONG%3E%20-%26gt%3B%20%3CSTRONG%3EApp%20registerations%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3EClick%20%3CSTRONG%3E%2B%20New%20registeration%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3ESpecify%20a%20name%20for%20the%20registered%20app%20and%20click%20%3CSTRONG%3ERegister%3C%2FSTRONG%3E%2C%20app%20Overview%20is%20opened.%3C%2FLI%3E%0A%3CLI%3ECopy%20the%20Application%20(client)%20id%20and%20Directory%20(tenant)%20id%20to%20a%20text%20editor%20for%20later%20use%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Initialize.png%22%20style%3D%22width%3A%20414px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F243035i4149587EEBA7B05C%2Fimage-dimensions%2F414x60%3Fv%3D1.0%22%20width%3D%22414%22%20height%3D%2260%22%20role%3D%22button%22%20title%3D%22Initialize.png%22%20alt%3D%22Initialize.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3EFrom%20left%20side%20menu%2C%20click%20on%20%3CSTRONG%20style%3D%22font-family%3A%20inherit%3B%22%3EManage%3C%2FSTRONG%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3E%20-%26gt%3B%20%3C%2FSPAN%3E%3CSTRONG%20style%3D%22font-family%3A%20inherit%3B%22%3ECertificates%20%26amp%3B%20secrets%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3EUnder%20%3CSTRONG%3EClient%20secrets%3C%2FSTRONG%3E%2C%20click%20%3CSTRONG%3E%2B%20New%20client%20secret%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3ESpecify%20a%20description%2C%20select%20an%20expiry%20duration%20and%20click%20%3CSTRONG%3EAdd%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3ECopy%20the%20secret%20value%20to%20a%20text%20editor%20for%20later%20use%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Initialize.png%22%20style%3D%22width%3A%20413px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F243034i55D0244FC71CAD85%2Fimage-dimensions%2F413x78%3Fv%3D1.0%22%20width%3D%22413%22%20height%3D%2278%22%20role%3D%22button%22%20title%3D%22Initialize.png%22%20alt%3D%22Initialize.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3EFrom%20left%20side%20menu%2C%20click%20%3CSTRONG%3EManage%3C%2FSTRONG%3E%20-%26gt%3B%20%3CSTRONG%3EAPI%20permissions%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3EClick%20%3CSTRONG%3E%2B%20Add%20a%20permission%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3EFrom%20%3CSTRONG%3Eselect%20an%20API%3C%2FSTRONG%3E%2C%20select%20%3CSTRONG%3EMicrosoft%20Graph%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3ESelect%20%3CSTRONG%3EDelegated%20permissions%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3ESelect%20the%20permissions%20by%20checking%20the%20checkbox%20next%20to%20required%20permissions%20and%20click%20%3CSTRONG%3EAdd%20permissions%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3EClick%20%3CSTRONG%3EGrant%20admin%20consent%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E2.%20In%20your%20Logic%20app%2C%20before%20the%20Graph%20API%20HTTP%20action%2C%20add%20another%20%3CSTRONG%3EHTTP%20%3C%2FSTRONG%3Eaction%20to%20get%20an%20access%20token%20for%20Microsoft%20Graph%3A%3C%2FP%3E%0A%3COL%20class%3D%22lia-list-style-type-lower-alpha%22%3E%0A%3CLI%3EFrom%20%3CSTRONG%3EMethod%3C%2FSTRONG%3E%20dropdown%20list%2C%20select%20%3CSTRONG%3EPOST%3C%2FSTRONG%3E%20method%3C%2FLI%3E%0A%3CLI%3EFor%20%3CSTRONG%3EURI%3C%2FSTRONG%3E%2C%20enter%20%3CA%20href%3D%22https%3A%2F%2Fnam06.safelinks.protection.outlook.com%2F%3Furl%3Dhttps%253A%252F%252Fddec1-0-en-ctp.trendmicro.com%252Fwis%252Fclicktime%252Fv1%252Fquery%253Furl%253Dhttps%25253a%25252f%25252flogin.microsoftonline.com%25252fyour%25252520tenant%25252520id%25252foauth2%25252ftoken%2526umid%253D819406bc-0a81-454e-8265-cd84dd9c204f%2526auth%253Db6670b9751c5c90ededae23711566d84a7ddb070-c0014488dcebb5b1327c1e1645d379b8a7bb9922%26amp%3Bdata%3D02%257C01%257Ctalsaifi%2540microsoft.com%257C6605afdad4cb45f73d1d08d8648ce38f%257C72f988bf86f141af91ab2d7cd011db47%257C1%257C0%257C637369903598702102%26amp%3Bsdata%3DqYktJ4dGBiQhTZjG5GvJDxOhA6ZWN%252F7zQxNxSHdyTAY%253D%26amp%3Breserved%3D0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Flogin.microsoftonline.com%2F%3CSTRONG%3Eyour%20tenant%20id%3C%2FSTRONG%3E%2Foauth2%2Ftoken%3C%2FA%3E%2C%20for%20your%20tenant%20id%2C%20check%20step%201.e%20above%3C%2FLI%3E%0A%3CLI%3EAdd%20%3CSTRONG%3Eheader%3C%2FSTRONG%3E%20with%20key%3A%20%3CSTRONG%3EContent-Type%3C%2FSTRONG%3E%2C%20value%3A%20%3CSTRONG%3Eapplication%2Fx-www-form-urlencoded%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3EFor%20Body%2C%20enter%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3Egrant_type%3Dpassword%26amp%3Bresource%3D%3CA%20href%3D%22https%3A%2F%2Fgraph.microsoft.com%26amp%3Bclient_id%3D%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgraph.microsoft.com%26amp%3Bclient_id%3D%3C%2FA%3E%3CSTRONG%3Eyour%20client%20id%3C%2FSTRONG%3E%26amp%3Busername%3D%3CSTRONG%3Eservice%20account%20username%3C%2FSTRONG%3E%26amp%3Bpassword%3D%3CSTRONG%3Eservice%20account%20password%3C%2FSTRONG%3E%26amp%3Bclient_secret%3D%3CSTRONG%3Eclient%20secret%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3ENote%20that%20%3CSTRONG%3Eclient_id%3C%2FSTRONG%3E%26nbsp%3B(check%20step%201.e%20above)%20and%20%3CSTRONG%3Eclient_secret%3C%2FSTRONG%3E%26nbsp%3B(check%20step%201.i%20above)%20are%20for%20your%20registered%20App%2C%20%3CSTRONG%3Eservice%20account%20username%3C%2FSTRONG%3E%20and%20%3CSTRONG%3Epassword%3C%2FSTRONG%3E%20are%20for%20a%20user%20account%20in%20your%20active%20directory.%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Initialize.png%22%20style%3D%22width%3A%20411px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F243032i7096D42B4864FBD5%2Fimage-dimensions%2F411x276%3Fv%3D1.0%22%20width%3D%22411%22%20height%3D%22276%22%20role%3D%22button%22%20title%3D%22Initialize.png%22%20alt%3D%22Initialize.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E3.%20Add%20%3CSTRONG%3EData%20operations%3C%2FSTRONG%3E%20-%20%3CSTRONG%3EParse%20JSON%3C%2FSTRONG%3E%20action%3C%2FP%3E%0A%3COL%20class%3D%22lia-list-style-type-lower-alpha%22%3E%0A%3CLI%3EFor%20%3CSTRONG%3EContent%3C%2FSTRONG%3E%2C%20select%20%3CSTRONG%3EBody%3C%2FSTRONG%3E%20from%20the%20Dynamic%20content%20list%3C%2FLI%3E%0A%3CLI%3EFor%20%3CSTRONG%3ESchema%3C%2FSTRONG%3E%2C%20enter%20the%20following%20schema%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%7B%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%22properties%22%3A%26nbsp%3B%7B%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%22access_token%22%3A%26nbsp%3B%7B%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%22type%22%3A%26nbsp%3B%22string%22%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7D%2C%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%22expires_in%22%3A%26nbsp%3B%7B%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%22type%22%3A%26nbsp%3B%22string%22%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7D%2C%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%22expires_on%22%3A%26nbsp%3B%7B%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%22type%22%3A%26nbsp%3B%22string%22%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7D%2C%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%22ext_expires_in%22%3A%26nbsp%3B%7B%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%22type%22%3A%26nbsp%3B%22string%22%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7D%2C%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%22not_before%22%3A%26nbsp%3B%7B%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%22type%22%3A%26nbsp%3B%22string%22%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7D%2C%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%22resource%22%3A%26nbsp%3B%7B%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%22type%22%3A%26nbsp%3B%22string%22%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7D%2C%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%22token_type%22%3A%26nbsp%3B%7B%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%22type%22%3A%26nbsp%3B%22string%22%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7D%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7D%2C%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%22type%22%3A%26nbsp%3B%22object%22%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%7D%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Initialize.png%22%20style%3D%22width%3A%20411px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F243029i64F69850D43A59BC%2Fimage-dimensions%2F411x233%3Fv%3D1.0%22%20width%3D%22411%22%20height%3D%22233%22%20role%3D%22button%22%20title%3D%22Initialize.png%22%20alt%3D%22Initialize.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E4.%20Add%20%3CSTRONG%3EVariables%3C%2FSTRONG%3E%20-%20%3CSTRONG%3EInitialize%20variable%3C%2FSTRONG%3E%20action%3C%2FP%3E%0A%3COL%20class%3D%22lia-list-style-type-lower-alpha%22%3E%0A%3CLI%3EEnter%20%3CSTRONG%3Ename%3C%2FSTRONG%3E%20for%20the%20variable%3A%20%3CSTRONG%3EAuthorizationHeaderValue%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3EFrom%20%3CSTRONG%3EType%3C%2FSTRONG%3E%20dropdown%20list%2C%20select%20%3CSTRONG%3EString%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Initialize.png%22%20style%3D%22width%3A%20410px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F243026iD1918F33C30CE81E%2Fimage-dimensions%2F410x111%3Fv%3D1.0%22%20width%3D%22410%22%20height%3D%22111%22%20role%3D%22button%22%20title%3D%22Initialize.png%22%20alt%3D%22Initialize.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E5.%20Add%20%3CSTRONG%3EVariables%3C%2FSTRONG%3E%20-%20%3CSTRONG%3ESet%20variable%3C%2FSTRONG%3E%20action%3C%2FP%3E%0A%3COL%20class%3D%22lia-list-style-type-lower-alpha%22%3E%0A%3CLI%3EFrom%20%3CSTRONG%3Ename%3C%2FSTRONG%3E%20dropdown%20list%2C%20select%20%3CSTRONG%3EAuthorizationHeaderValue%3C%2FSTRONG%3E%20variable%3C%2FLI%3E%0A%3CLI%3EFor%20value%2C%20enter%20%3CSTRONG%3EBearer%3CSPAN%3E%20%26nbsp%3B%3C%2FSPAN%3Eaccess_token%3C%2FSTRONG%3E%3B%20note%20that%20there%20is%20a%20single%20space%20left%20after%20Bearer%2C%20and%20access_token%20is%20selected%20from%20Dynamic%20content%20list%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Initialize.png%22%20style%3D%22width%3A%20410px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F243028iA3E55DDBC0A34DA4%2Fimage-dimensions%2F410x88%3Fv%3D1.0%22%20width%3D%22410%22%20height%3D%2288%22%20role%3D%22button%22%20title%3D%22Initialize.png%22%20alt%3D%22Initialize.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E6.%20For%20the%20last%20step%2C%20the%20%3CSTRONG%3EHTTP%3C%2FSTRONG%3E%20action%20that%20calls%20Microsoft%20Graph%20API%3C%2FP%3E%0A%3COL%20class%3D%22lia-list-style-type-lower-alpha%22%3E%0A%3CLI%3EFrom%20%3CSTRONG%3EMethod%3C%2FSTRONG%3E%20dropdown%20list%2C%20select%20required%20method%3C%2FLI%3E%0A%3CLI%3EFor%20%3CSTRONG%3EURI%3C%2FSTRONG%3E%2C%20enter%20the%20graph%20API%20method%20you%20want%20to%20call%3C%2FLI%3E%0A%3CLI%3EAdd%20%3CSTRONG%3Eheader%3C%2FSTRONG%3E%20with%20key%3A%20%3CSTRONG%3EAuthorization%3C%2FSTRONG%3E%2C%20value%3A%20select%20%3CSTRONG%3EAuthorizationHeaderValue%3C%2FSTRONG%3E%20variable%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Initialize.png%22%20style%3D%22width%3A%20411px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F243030i76E9BCBB2FC48230%2Fimage-dimensions%2F411x230%3Fv%3D1.0%22%20width%3D%22411%22%20height%3D%22230%22%20role%3D%22button%22%20title%3D%22Initialize.png%22%20alt%3D%22Initialize.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYour%20workflow%20should%20look%20as%20follows%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22GraphDemo.png%22%20style%3D%22width%3A%20429px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F242716i1D58D3B5FB047AA8%2Fimage-dimensions%2F429x288%3Fv%3D1.0%22%20width%3D%22429%22%20height%3D%22288%22%20role%3D%22button%22%20title%3D%22GraphDemo.png%22%20alt%3D%22GraphDemo.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1997666%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22MicrosoftGraphAPI.png%22%20style%3D%22width%3A%20410px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F241350i89A60F1E6D219714%2Fimage-dimensions%2F410x205%3Fv%3D1.0%22%20width%3D%22410%22%20height%3D%22205%22%20role%3D%22button%22%20title%3D%22MicrosoftGraphAPI.png%22%20alt%3D%22MicrosoftGraphAPI.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3ECalling%20Graph%20API%20from%20Azure%20Logic%20Apps%20using%20delegated%20permissions%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1997666%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ELogic%20Apps%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E

Microsoft Graph API is a powerful REST API that enables access to cloud resources and it supports two types of permissions, application and delegated permissions. 

Some operations do not support application permissions, it only support delegated permissions.

To call Graph API from Azure Logic Apps using delegated permissions, follow the steps below:

1. Register an app, add required delegated API permissions to your registered app and grant admin consent.

  1. Go to your Azure Active directory
  2. From left side menu, click on Manage -> App registerations
  3. Click + New registeration
  4. Specify a name for the registered app and click Register, app Overview is opened.
  5. Copy the Application (client) id and Directory (tenant) id to a text editor for later use                                                                                       
  6. From left side menu, click on Manage -> Certificates & secrets
  7. Under Client secrets, click + New client secret
  8. Specify a description, select an expiry duration and click Add
  9. Copy the secret value to a text editor for later use                                                                                                                                           
  10. From left side menu, click Manage -> API permissions
  11. Click + Add a permission
  12. From select an API, select Microsoft Graph
  13. Select Delegated permissions
  14. Select the permissions by checking the checkbox next to required permissions and click Add permissions
  15. Click Grant admin consent

2. In your Logic app, before the Graph API HTTP action, add another HTTP action to get an access token for Microsoft Graph:

  1. From Method dropdown list, select POST method
  2. For URI, enter https://login.microsoftonline.com/your tenant id/oauth2/token, for your tenant id, check step 1.e above
  3. Add header with key: Content-Type, value: application/x-www-form-urlencoded
  4. For Body, enter:

grant_type=password&resource=https://graph.microsoft.com&client_id=your client id&username=service account username&password=service account password&client_secret=client secret

Note that client_id (check step 1.e above) and client_secret (check step 1.i above) are for your registered App, service account username and password are for a user account in your active directory.

3. Add Data operations - Parse JSON action

  1. For Content, select Body from the Dynamic content list
  2. For Schema, enter the following schema:

    "properties": {

        "access_token": {

            "type": "string"

        "expires_in": {

            "type": "string"

        "expires_on": {

            "type": "string"

        "ext_expires_in": {

           "type": "string"

        "not_before": {

            "type": "string"

        "resource": {

            "type": "string"

        "token_type": {

            "type": "string"

    "type": "object"

4. Add Variables - Initialize variable action

  1. Enter name for the variable: AuthorizationHeaderValue
  2. From Type dropdown list, select String

5. Add Variables - Set variable action

  1. From name dropdown list, select AuthorizationHeaderValue variable
  2. For value, enter Bearer  access_token; note that there is a single space left after Bearer, and access_token is selected from Dynamic content list

6. For the last step, the HTTP action that calls Microsoft Graph API

  1. From Method dropdown list, select required method
  2. For URI, enter the graph API method you want to call
  3. Add header with key: Authorization, value: select AuthorizationHeaderValue variable

Your workflow should look as follows:

You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK