%3CLINGO-SUB%20id%3D%22lingo-sub-1342121%22%20slang%3D%22en-US%22%3EWorking%20with%20Logic%20App%20Parameters%20While%20Building%20Azure%20Security%20Center%20Automations%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1342121%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3EIn%20this%20%3C%2FSPAN%3E%3CSPAN%3Eb%3C%2FSPAN%3E%3CSPAN%3Elog%20post%20we%20will%20explore%20how%20to%20work%20with%20Logic%20App%20%3C%2FSPAN%3E%3CSPAN%3Eparameters%20when%20working%20with%20Azure%20Security%20Center%20Workflow%20Automation.%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%3EDuring%20workflow%20execution%2C%20%3C%2FSPAN%3Esome%20scenarios%3CSPAN%3E%20require%20parsing%20variables%20to%20match%20a%20correct%20URI%20syntax.%26nbsp%3B%20S%3C%2FSPAN%3E%3CSPAN%3Ep%3C%2FSPAN%3E%3CSPAN%3Eecifically%2C%3C%2FSPAN%3E%20%3CSPAN%3Eto%20do%20this%2C%20%3C%2FSPAN%3E%3CSPAN%3Ewe%20will%20work%20with%20the%20%3CEM%3Eproperties.resourceDetails.id%20%3C%2FEM%3EReturn%20type%20and%20extract%20several%20variables%20to%20accomplish%20our%20task.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EObjectives%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3ECreate%20a%20Logic%20App%20for%20an%20Azure%20Security%20Center%20Recommendation%3C%2FLI%3E%0A%3CLI%3ECreate%20Workflow%20Automation%20and%20wire%20it%20to%20the%20Logic%20App%3C%2FLI%3E%0A%3CLI%3EUnderstand%20the%20logic%20to%20parse%20variables%20from%20the%20%3CEM%3E%3CSPAN%3Eproperties.resourceDetails.id%3C%2FSPAN%3E%3C%2FEM%3E%3C%2FLI%3E%0A%3CLI%3ESend%20an%20email%20with%20the%20parsed%20variables%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%3EWhen%20%3C%2FSPAN%3E%3CSPAN%3Ewe%3C%2FSPAN%3E%3CSPAN%3E%20create%20a%20Logic%20App%20to%20perform%20a%20Remediation%20task%2C%20the%20most%20important%20Return%20type%20is%20the%20%3CEM%3Eproperties.resourceDetails.id%3C%2FEM%3E%3C%2FSPAN%3E%3CSPAN%3E.%26nbsp%3B%20%3C%2FSPAN%3EThis%20Return%20type%20can%20be%20used%20to%20parse%20out%20variables%20that%20are%20required%20to%20form%20a%20URI%20to%20make%20an%20Azure%20REST%20API%20call.%26nbsp%3B%20%3CSPAN%3EThere%20are%20many%20other%20R%3C%2FSPAN%3E%3CSPAN%3Eeturn%20types%20to%20work%20with%20as%20well.%26nbsp%3B%20For%20details%2C%20take%20a%20look%20at%20the%20Connector%20reference%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fconnectors%2Fascassessment%2F%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EThe%20%3CEM%3Eproperties.resourceDetails.id%3C%2FEM%3E%20is%20the%20full%20Resource%20Id%20of%20the%20Azure%20Resource%20%3C%2FSPAN%3E%3CSPAN%3Ewe%3C%2FSPAN%3E%3CSPAN%3E%20need%20to%20remediate.%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%3EA%20sample%20Resource%20Id%3C%2FSPAN%3E%3CSPAN%3E%20looks%20like%20this%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-60px%22%3E%3CEM%3E%3CSPAN%3E%2Fsubscriptions%2F%3CREMOVE-SUBSCRIPTION-ID%3E%2FresourceGroups%2Frg-usc-vms-01%2Fproviders%2FMicrosoft.Compute%2FvirtualMachines%2F%20virtualmachine01%3C%2FREMOVE-SUBSCRIPTION-ID%3E%3C%2FSPAN%3E%3C%2FEM%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-60px%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EIn%20order%20for%20us%20to%20remediate%20an%20item%2C%20we%20can%20use%20the%20%3CEM%3EResource%3C%2FEM%3E%3CEM%3E%20Id%3C%2FEM%3E%20to%20create%20the%20correct%20syntax%20to%20send%20out%20a%20HTTP%20PUT%20request%20that%20looks%20similar%20to%20this%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%20data-unlink%3D%22true%22%3E%3CEM%3Ehttps%3A%2F%2Fmanagement.azure.com%2Fsubscriptions%2F%40%7Bvariables('SubscriptionId')%7D%2FresourceGroups%2F%40%7Bvariables('ResourceGroupName')%7D%2Fproviders%2FMicrosoft.Security%2Flocations%2F%40%7Bvariables('vmLocation')%7D%2FjitNetworkAccessPolicies%2F%40%7Bfirst(skip(split(triggerBody()%3F%5B'properties'%5D%3F%5B'resourceDetails'%5D%3F%5B'id'%5D%2C'%2F')%2C8))%7DJITPolicy%3Fapi-version%3D2020-01-01%26nbsp%3B%3C%2FEM%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-indent-padding-left-30px%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EIn%20the%20URI%2C%20Subscription%20Id%2C%20Resource%20Group%20Name%2C%20Resource%20Name%2C%20and%20Location%20need%20to%20be%20parsed%20and%20set%20in%20the%20correct%20location%20to%20create%20the%20URI%20that%20will%20carry%20out%20the%20PUT%20request%20on%20a%20resource.%26nbsp%3B%20Although%20we%20will%20not%20walk%20through%20the%20entire%20remediation%20process%2C%20we%20will%20discuss%20how%20to%20parse%20variables%20from%20the%20properties.resourceDetails.id%20Return%20type%20so%20that%20%3C%2FSPAN%3E%3CSPAN%3Ewe%3C%2FSPAN%3E%3CSPAN%3E%20can%20form%20the%20correct%20URI%20syntax.%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3ETo%20setup%20a%20Logic%20App%20for%20Workflow%20Automation%20and%20more%20details%2C%20see%20the%20public%20documentation%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fsecurity-center%2Fworkflow-automation%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1355452239%22%20id%3D%22toc-hId--1355452239%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22toc-hId-1132060594%22%20id%3D%22toc-hId-1132060594%22%3E%3CFONT%20color%3D%22%23666699%22%3E%3CSPAN%3EBuild%3C%2FSPAN%3Eing%3CSPAN%3E%20the%20Logic%20App%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FH2%3E%0A%3CP%3E%3CSPAN%3EIn%20this%20section%2C%20we%20will%20create%20a%20Logic%20App%20in%20your%20Azure%20Subscription.%20%26nbsp%3BThen%20we%20will%20add%20the%20logic%20to%20parse%20the%20variables%20we%20need.%26nbsp%3B%20Last%2C%20we%20will%20trigger%20the%20Logic%20App%20to%20send%20an%20email%20with%20our%20parsed%20variables.%3C%2FSPAN%3E%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EIn%20the%20Azure%20Portal%2C%20click%20on%20%3CSPAN%20style%3D%22font-weight%3A%20normal%20!msorm%3B%22%3E%3CSTRONG%3EAll%20services%3C%2FSTRONG%3E%3C%2FSPAN%3E%2C%20in%20the%20search%20box%20type%3A%20%3CSPAN%20style%3D%22font-weight%3A%20normal%20!msorm%3B%22%3E%3CSTRONG%3E%3CEM%3E%3CI%3Elogic%20app%3C%2FI%3E%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CEM%3E%2C%20%3C%2FEM%3Eand%20click%20on%20the%20%3CSPAN%20style%3D%22font-weight%3A%20normal%20!msorm%3B%22%3E%3CSTRONG%3ELogic%20App%3C%2FSTRONG%3E%3C%2FSPAN%3E%20in%20the%20results%3C%2FLI%3E%0A%3CLI%3EClick%20on%20%3CSPAN%3E%3CSTRONG%3EAdd%3C%2FSTRONG%3E%3C%2FSPAN%3E%20to%20create%20a%20new%20Logic%20App%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22CreateNewLogicApp.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F187032iA2534EB10D544D6B%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22CreateNewLogicApp.png%22%20alt%3D%22CreateNewLogicApp.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3EChoose%20a%20%3CSPAN%20style%3D%22font-weight%3A%20normal%20!msorm%3B%22%3E%3CSTRONG%3EResource%20Group%3C%2FSTRONG%3E%3C%2FSPAN%3E%20to%20store%20the%20Logic%20App%2C%20type%20a%20%3CSPAN%20style%3D%22font-weight%3A%20normal%20!msorm%3B%22%3E%3CSTRONG%3Ename%3C%2FSTRONG%3E%3C%2FSPAN%3E%2C%20and%20click%20%3CSPAN%20style%3D%22font-weight%3A%20normal%20!msorm%3B%22%3E%3CSTRONG%3EReview%20%2B%20create%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22CreateNewLogicApp2.png%22%20style%3D%22width%3A%20850px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F187060iA75FB1727629EDD0%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22CreateNewLogicApp2.png%22%20alt%3D%22CreateNewLogicApp2.png%22%20%2F%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3C%2FLI%3E%0A%3CLI%3EAfter%20the%20review%20completes%2C%20click%20on%20%3CSPAN%20style%3D%22font-weight%3A%20normal%20!msorm%3B%22%3E%3CSTRONG%3ECreate%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3EGive%20it%20a%20few%20minutes%20and%20then%20click%20%3CSPAN%20style%3D%22font-weight%3A%20normal%20!msorm%3B%22%3E%3CSTRONG%3EGo%20to%20Resource%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3EIn%20the%20Logic%20App%20Designer%2C%20click%20%3CSPAN%20style%3D%22font-weight%3A%20normal%20!msorm%3B%22%3E%3CSTRONG%3EBlank%20Logic%20App%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22CreateNewLogicApp3.png%22%20style%3D%22width%3A%20958px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F187061i4D42C7DB66257834%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22CreateNewLogicApp3.png%22%20alt%3D%22CreateNewLogicApp3.png%22%20%2F%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3C%2FLI%3E%0A%3CLI%3EOn%20the%20Designer%20canvas%2C%20type%3A%20%3CSPAN%20style%3D%22font-weight%3A%20normal%20!msorm%3B%22%3E%3CSTRONG%3ESecurity%20Center%3C%2FSTRONG%3E%3C%2FSPAN%3E.%20Then%2C%20down%20in%20the%20Triggers%2C%20click%20on%20%3CSPAN%20style%3D%22font-weight%3A%20normal%20!msorm%3B%22%3E%3CSTRONG%3E%3CSPAN%3EWhen%20an%20Azure%20Security%20Center%20Recommendation%20is%20created%20or%20triggered%3C%2FSPAN%3E%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22CreateNewLogicApp4.png%22%20style%3D%22width%3A%20810px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F187062iB3FAABB43305FCC9%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22CreateNewLogicApp4.png%22%20alt%3D%22CreateNewLogicApp4.png%22%20%2F%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3C%2FLI%3E%0A%3CLI%3EIn%20the%20Logic%20App%20Designer%2C%20%3CSPAN%3Eclick%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-weight%3A%20normal%20!msorm%3B%22%3E%3CSTRONG%3ENew%20step%3C%2FSTRONG%3E%3C%2FSPAN%3E%20and%20in%20the%20search%20box%20type%3A%20%3CSPAN%20style%3D%22font-weight%3A%20normal%20!msorm%3B%22%3E%3CSTRONG%3Esend%20an%20email%3C%2FSTRONG%3E%3C%2FSPAN%3E.%20Choose%20the%20type%20of%20email%20%3CSPAN%3Eto%3C%2FSPAN%3E%20use.%20%26nbsp%3BFor%20this%20demo%2C%20I%20will%20use%20outlook.com%3C%2FLI%3E%0A%3CLI%3EOnce%20%3CSPAN%3Ewe%20%3C%2FSPAN%3Echoose%20an%20email%20type%2C%20scroll%20down%20the%20list%20and%20%3CSPAN%3Eclick%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-weight%3A%20normal%20!msorm%3B%22%3E%3CSTRONG%3ESend%20an%20email%20(V2)%3C%2FSTRONG%3E%3C%2FSPAN%3E%20to%20add%20it%20to%20the%20Designer.%3CP%3E%3CFONT%20size%3D%222%22%3E%3CSPAN%20style%3D%22font-style%3A%20normal%20!msorm%3B%22%3E%3CSTRONG%3E%3CEM%3ENote%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-style%3A%20normal%20!msorm%3B%22%3E%3CEM%3E%3A%20you%20will%20need%20to%20signin%20to%20you%3C%2FEM%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-style%3A%20normal%20!msorm%3B%22%3E%3CEM%3Er%3C%2FEM%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-style%3A%20normal%20!msorm%3B%22%3E%3CEM%3E%20email%20provide%3C%2FEM%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-style%3A%20normal%20!msorm%3B%22%3E%3CEM%3Er%3C%2FEM%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-style%3A%20normal%20!msorm%3B%22%3E%3CEM%3E%20and%20grant%20permissions%20for%20the%20Logic%20App%20to%20send%20email%20using%20your%20account%3C%2FEM%3E%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3EIn%20the%20Send%20an%20email%20(V2)%2C%20add%20your%20email%20address%20to%20the%20To%20line%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3EClick%20in%20the%20%3CSPAN%3E%3CSTRONG%3ESubject%20box%3C%2FSTRONG%3E%3C%2FSPAN%3E%2C%20then%20click%20%3CSTRONG%3EAdd%20dynamic%20content%3C%2FSTRONG%3E%20if%20it%20doesn%E2%80%99t%20pop%20out%20automatically.%26nbsp%3B%20Then%20click%20on%20%3CSPAN%3E%3CSTRONG%3EProperties%20Display%20Name%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22CreateNewLogicApp5.png%22%20style%3D%22width%3A%20873px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F187063i54DB02D245FC0BC7%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22CreateNewLogicApp5.png%22%20alt%3D%22CreateNewLogicApp5.png%22%20%2F%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3EClick%20into%20the%20%3CSPAN%20style%3D%22font-weight%3A%20normal%20!msorm%3B%22%3E%3CSTRONG%3EBody%3C%2FSTRONG%3E%3C%2FSPAN%3E%20text%20box%20and%20type%20the%20following%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-weight%3A%20normal%20!msorm%3B%22%3E%3CSTRONG%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3BResource%20Name%3A%20%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-weight%3A%20normal%20!msorm%3B%22%3E%3CSTRONG%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3BResource%20Group%3A%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3EClick%20just%20after%26nbsp%3B%3CSTRONG%3EResource%20Name%3A%3C%2FSTRONG%3E%20%26nbsp%3Bto%20get%20your%20cursor%20in%20the%20right%20place.%26nbsp%3B%20In%20the%26nbsp%3B%3CSPAN%3E%3CEM%3Edynamic%20content%20box%3C%2FEM%3E%3C%2FSPAN%3E%2C%20click%20on%26nbsp%3B%3CSTRONG%3EExpression%26nbsp%3B%3C%2FSTRONG%3Eand%20cut%20and%20paste%20the%20following%20line%2C%20then%20click%26nbsp%3B%3CSTRONG%3EOk%3A%3C%2FSTRONG%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20first(skip(split(triggerBody()%3F%5B'properties'%5D%3F%5B'resourceDetails'%5D%3F%5B'id'%5D%2C'%2F')%2C8))%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3EClick%20on%20the%20second%20line%20%3CSPAN%3E%3CSTRONG%3EResource%20Group%3C%2FSTRONG%3E%3C%2FSPAN%3E%3A%20%26nbsp%3Bto%20get%20your%20cursor%20in%20the%20right%20place.%26nbsp%3B%20In%20the%20%3CSPAN%3E%3CEM%3Edynamic%20content%20box%3C%2FEM%3E%3C%2FSPAN%3E%2C%20click%20on%20%3CSPAN%3E%3CSTRONG%3EExpression%3C%2FSTRONG%3E%3C%2FSPAN%3E%20and%20cut%20and%20paste%20the%20following%20line%2C%20then%20click%20%3CSPAN%3E%3CSTRONG%3EOk%3C%2FSTRONG%3E%3C%2FSPAN%3E%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3Bfirst(skip(split(triggerBody()%3F%5B'properties'%5D%3F%5B'resourceDetails'%5D%3F%5B'id'%5D%2C'%2F')%2C4))%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELet%E2%80%99s%20pause%20and%20discuss%20steps%2014%20and%2015%2C%20since%20these%20are%20key%20steps.%26nbsp%3B%26nbsp%3BSometimes%20in%20a%20Logic%20App%2C%20you%20need%20to%20access%20data%20that%20might%20not%20yet%20exist%20when%20a%20workflow%20starts%20to%20run.%26nbsp%3B%20In%20our%20case%2C%20we%20have%20the%20long%20string%20called%20a%20ResourceId.%26nbsp%3B%20Remember%20this%3A%3C%2FP%3E%0A%3CP%3E%3CEM%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%2Fsubscriptions%2F%3CREMOVE-SUBSCRIPTION-ID%3E%2FresourceGroups%2F%3CFONT%20color%3D%22%23FF0000%22%3Erg-usc-vms-%3C%2FFONT%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%3C%2FREMOVE-SUBSCRIPTION-ID%3E%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%3CEM%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3CFONT%20color%3D%22%23FF0000%22%3E01%3C%2FFONT%3E%2Fproviders%2FMicrosoft.Compute%2FvirtualMachines%2F%3CFONT%20color%3D%22%23FF0000%22%3Evirtualmachine01%3C%2FFONT%3E%26nbsp%3B%26nbsp%3B%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%3CEM%3E%3CBR%20%2F%3E%3C%2FEM%3EWe%20must%20extract%20the%20fields%20we%20need%20at%20runtime%20when%20the%20workflow%20is%20running%20since%20they%20are%20not%20exposed%20in%20the%20Connector%20Return%20types.%26nbsp%3B%20In%20our%20case%2C%20we%20need%20to%20extract%20the%20%E2%80%9CResource%20Name%E2%80%9D%20and%20%E2%80%9CResource%20Group%20Name%E2%80%9D.%3C%2FP%3E%0A%3CP%3E%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%3CFONT%20style%3D%22font-family%3A%20inherit%3B%22%20color%3D%22%23FF0000%22%3E%3CSTRONG%3Efirst%3C%2FSTRONG%3E%3C%2FFONT%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3E(%3C%2FSPAN%3E%3CFONT%20style%3D%22font-family%3A%20inherit%3B%22%20color%3D%22%230000FF%22%3E%3CSTRONG%3Eskip%3C%2FSTRONG%3E%3C%2FFONT%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3E(%3C%2FSPAN%3E%3CFONT%20style%3D%22font-family%3A%20inherit%3B%22%20color%3D%22%23008000%22%3E%3CSTRONG%3Esplit%3C%2FSTRONG%3E%3C%2FFONT%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3E(triggerBody()%3F%5B'properties'%5D%3F%5B'resourceDetails'%5D%3F%5B'id'%5D%2C'%2F')%2C8))%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20do%20this%2C%20we%20use%20an%20Expression.%26nbsp%3B%20Let%E2%80%99s%20work%20through%20the%20Expression%20piece-by-piece.%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CFONT%20color%3D%22%23FF0000%22%3E%3CSTRONG%3Efirst%3C%2FSTRONG%3E%3C%2FFONT%3E()%20will%20return%20the%20first%20item%20in%20a%20collection.%26nbsp%3B%20Our%20%3CSPAN%20style%3D%22font-style%3A%20normal%20!msorm%3B%22%3E%3CEM%3EResourceId%3C%2FEM%3E%3C%2FSPAN%3E%20as%20a%20whole%20string%20since%20we%20only%20have%20a%20single%20item%20in%20the%20collection.%26nbsp%3B%3C%2FLI%3E%0A%3CLI%3E%3CFONT%20color%3D%22%230000FF%22%3E%3CSTRONG%3Eskip%3C%2FSTRONG%3E%3C%2FFONT%3E()%20will%20remove%20items%20starting%20from%20the%20beginning%20and%20take%20two%20parameters%20(%3CSPAN%20style%3D%22font-style%3A%20normal%20!msorm%3B%22%3E%3CEM%3EResourceId%3C%2FEM%3E%3C%2FSPAN%3E%2C%20N%20number%20to%20skip).%26nbsp%3B%20For%20the%20Resource%20Name%2C%20we%20need%20to%20skip%208%20strings.%26nbsp%3B%3C%2FLI%3E%0A%3CLI%3E%3CFONT%20color%3D%22%23008000%22%3E%3CSTRONG%3Esplit%3C%2FSTRONG%3E%3C%2FFONT%3E()%20function%20which%20will%20split%20the%20%3CSPAN%3ER%3C%2FSPAN%3EesourceId%20string%20at%20the%20%E2%80%98%2F%E2%80%99%20delimiter.%26nbsp%3B%20For%20our%20string%2C%20we%20want%20to%20skip%204%20to%20get%20the%20Resource%20Group%20Name%20and%20skip%208%20to%20get%20the%20Name%20of%20the%20resource.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20the%20middle%20is%20the%20actual%20parameter%20from%20the%20Dynamic%20content%20%E2%80%98%3CSPAN%20style%3D%22font-style%3A%20normal%20!msorm%3B%22%3E%3CEM%3EProperties%20Resource%20Details%20Id%E2%80%99%3C%2FEM%3E%3C%2FSPAN%3E%20but%20broken%20out%20in%20the%20workflow%20like%20this%3A%20%3CSPAN%20style%3D%22font-style%3A%20normal%20!msorm%3B%22%3E%3CEM%3EtriggerBody%3C%2FEM%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-style%3A%20normal%20!msorm%3B%22%3E%3CEM%3E()%3F%5B'properties'%5D%3F%5B'resourceDetails'%5D%3F%5B'id'%5D.%3C%2FEM%3E%3C%2FSPAN%3E%26nbsp%3B%20Any%20time%20you%20need%20to%20access%20a%20parameter%2C%20type%20triggerBody%20and%20it%20helps%20by%20auto-completing%20in%20the%20Logic%20App%20Designer%20Expression.%26nbsp%3B%20Of%20course%20there%E2%80%99s%20a%20lot%20more%20to%20Expressions%20and%20the%20Return%20types%20we%20could%20look%20at%2C%20but%20this%20is%20what%20we%20need%20for%20now.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%222%22%3E%3CSTRONG%3ENote%3C%2FSTRONG%3E%3A%20For%20details%20about%20each%20of%20the%20Functions%2C%20see%20this%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Flogic-apps%2Fworkflow-definition-language-functions-reference%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Epage%3C%2FA%3E.%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3ELet%E2%80%99s%20get%20back%20to%20building%20the%20Logic%20App%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3E%3CSPAN%20style%3D%22font-style%3A%20normal%20!msorm%3B%22%3EHopefully%2C%20your%20screen%20looks%20like%20the%20below%20screenshot.%26nbsp%3B%20If%20so%2C%20click%20on%20%3CSPAN%20style%3D%22font-weight%3A%20normal%20!msorm%3B%22%3E%3CSTRONG%3ESave%3C%2FSTRONG%3E%3C%2FSPAN%3E%20in%20the%20Logic%20App%20Designer%20and%20we%20are%20ready%20to%20fire%20off%20the%20Logic%20App.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22CreateNewLogicApp6.png%22%20style%3D%22width%3A%20739px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F187064i5F6DC9A60EB5D3BB%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22CreateNewLogicApp6.png%22%20alt%3D%22CreateNewLogicApp6.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--675393869%22%20id%3D%22toc-hId--675393869%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22toc-hId-1812118964%22%20id%3D%22toc-hId-1812118964%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22toc-hId-4664501%22%20id%3D%22toc-hId-4664501%22%3E%3CFONT%20color%3D%22%23666699%22%3E%3CBR%20%2F%3EFiring%20the%20Logic%20App%3C%2FFONT%3E%3C%2FH2%3E%0A%3CP%3E%3CSPAN%3EThere%20are%20two%20ways%20to%20trigger%20a%20Logic%20App%2C%20manually%20and%20automated.%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%3EFor%20our%20testing%2C%20w%3C%2FSPAN%3E%3CSPAN%3Ee%20will%20trigger%20th%3C%2FSPAN%3E%3CSPAN%3Ee%20Logic%20App%20manually.%26nbsp%3B%20For%20details%20on%20running%20automated%20Logic%20App%20see%20the%20public%20document%20%3C%2FSPAN%3E%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fsecurity-center%2Fworkflow-automation%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E%3C%2FSPAN%3E%3CSPAN%3E.%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3EGo%20back%20to%20Azure%20Security%20Center%3C%2FLI%3E%0A%3CLI%3EClick%20on%20%3CSPAN%20style%3D%22font-weight%3A%20normal%20!msorm%3B%22%3E%3CSTRONG%3ERecommendations%3C%2FSTRONG%3E%3C%2FSPAN%3E%20under%20RESOURCE%20SECURITY%20HYGIENE%3C%2FLI%3E%0A%3CLI%3ELook%20for%20any%20Recommendation%20that%20has%20a%20Quick%20Fix!%20Tag%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22CreateNewLogicApp7.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F187065i0547DF8EA3230AFC%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22CreateNewLogicApp7.png%22%20alt%3D%22CreateNewLogicApp7.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3E%3CSPAN%3ET%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-weight%3A%20normal%20!msorm%3B%22%3Eick%3C%2FSPAN%3E%3C%2FSTRONG%3E%20the%20resource%20for%20the%20%3CSPAN%20style%3D%22font-weight%3A%20normal%20!msorm%3B%22%3E%3CSTRONG%3ETrigger%20Logic%20App%3C%2FSTRONG%3E%3C%2FSPAN%3E%20to%20light%20up.%26nbsp%3B%20Click%20on%20the%20%3CSPAN%20style%3D%22font-weight%3A%20normal%20!msorm%3B%22%3E%3CSTRONG%3ETrigger%20Logic%20App%3C%2FSTRONG%3E%3C%2FSPAN%3E%20button%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22CreateNewLogicApp8.png%22%20style%3D%22width%3A%20523px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F187066i2C7AB92DEC9F682F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22CreateNewLogicApp8.png%22%20alt%3D%22CreateNewLogicApp8.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3EIn%20the%20Logic%20App%20Trigger%20blade%2C%20%3CSTRONG%3Etick%3C%2FSTRONG%3E%20the%20Logic%20App%20you%20created.%26nbsp%3B%20If%20you%20followed%3CSPAN%3E%20all%3C%2FSPAN%3E%20the%20steps%2C%20it%20will%20be%20named%20Email-Resource-Info%3CSPAN%20style%3D%22font-weight%3A%20normal%20!msorm%3B%22%3E%3CSTRONG%3E.%26nbsp%3B%20Tick%3C%2FSTRONG%3E%3C%2FSPAN%3E%20it%20and%20click%20the%20%3CSPAN%20style%3D%22font-weight%3A%20normal%20!msorm%3B%22%3E%3CSTRONG%3ETrigger%3C%2FSTRONG%3E%3C%2FSPAN%3E%20button.%26nbsp%3B%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22CreateNewLogicApp9.png%22%20style%3D%22width%3A%20478px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F187067i489731E5DA1FEAC3%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22CreateNewLogicApp9.png%22%20alt%3D%22CreateNewLogicApp9.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CBR%20%2F%3EYou%3C%2FSPAN%3E%20should%20receive%20an%20email%20that%20populated%20the%20%3CSPAN%20style%3D%22font-style%3A%20normal%20!msorm%3B%22%3E%3CEM%3EResource%20Group%20Name%3C%2FEM%3E%3C%2FSPAN%3E%20and%20%3CSPAN%20style%3D%22font-style%3A%20normal%20!msorm%3B%22%3E%3CEM%3EResource%20Name%3C%2FEM%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22CreateNewLogicApp10.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F187068i84C9EB6C22C6D826%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22CreateNewLogicApp10.png%22%20alt%3D%22CreateNewLogicApp10.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1802789962%22%20id%3D%22toc-hId--1802789962%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22toc-hId-684722871%22%20id%3D%22toc-hId-684722871%22%3E%3CFONT%20color%3D%22%23666699%22%3EConclusion%3C%2FFONT%3E%3C%2FH2%3E%0A%3CP%3ETo%20review%2C%20we%20have%20walked%20through%20the%20process%20of%20working%20with%20Azure%20Security%20Center%20Recommendation%20parameters%20in%20a%20Logic%20App.%26nbsp%3B%20We%20have%20deployed%20the%20Logic%20App%2C%20triggered%20a%20Workflow%20Automation%2C%20and%20received%20an%20email%20with%20the%20selected%20parameters.%26nbsp%3B%20We%20also%20saw%20that%2C%20when%20the%20Workflow%20Automation%20triggers%20a%20Logic%20App%2C%20the%20%3CEM%3E%3CSPAN%3Eproperties.resourceDetails.id%3C%2FSPAN%3E%20%3C%2FEM%3Eis%20used%20to%20query%20the%20parameters%20using%20three%20Expressions%3CEM%3E%20(First()%2C%20Skip()%2C%20and%20Split())%20%3C%2FEM%3Eto%20parse%20the%20variables%20from%20the%3CEM%3E%20%3CSPAN%3Eproperties.resourceDetails.id%3C%2FSPAN%3E%3C%2FEM%3E.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20a%20future%20blog%2C%20we%20will%20combine%20these%20steps%20with%20a%20real%20Remediation%20to%20see%20how%20the%20parameters%20are%20used%20to%20perform%20an%20Azure%20API%20REST%20call.%3C%2FP%3E%0A%3CP%3E%3CEM%3E%26nbsp%3B%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3ESpecial%20thanks%20to%3A%3C%2FP%3E%0A%3CP%3EYuri%20Diogenes%20and%20Ofir%20Monza%20for%20collaborating%20on%20and%20reviewing%20this%20post%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Microsoft

In this blog post we will explore how to work with Logic App parameters when working with Azure Security Center Workflow Automation.  During workflow execution, some scenarios require parsing variables to match a correct URI syntax.  Specifically, to do this, we will work with the properties.resourceDetails.id Return type and extract several variables to accomplish our task.

 

Objectives:

  • Create a Logic App for an Azure Security Center Recommendation
  • Create Workflow Automation and wire it to the Logic App
  • Understand the logic to parse variables from the properties.resourceDetails.id
  • Send an email with the parsed variables

When we create a Logic App to perform a Remediation task, the most important Return type is the properties.resourceDetails.idThis Return type can be used to parse out variables that are required to form a URI to make an Azure REST API call.  There are many other Return types to work with as well.  For details, take a look at the Connector reference here.

 

The properties.resourceDetails.id is the full Resource Id of the Azure Resource we need to remediate.  A sample Resource Id looks like this:

/subscriptions/<remove-subscription-id>/resourceGroups/rg-usc-vms-01/providers/Microsoft.Compute/virtualMachines/ virtualmachine01

 

In order for us to remediate an item, we can use the Resource Id to create the correct syntax to send out a HTTP PUT request that looks similar to this:

https://management.azure.com/subscriptions/@{variables('SubscriptionId')}/resourceGroups/@{variables('ResourceGroupName')}/providers/Microsoft.Security/locations/@{variables('vmLocation')}/jitNetworkAccessPolicies/@{first(skip(split(triggerBody()?['properties']?['resourceDetails']?['id'],'/'),8))}JITPolicy?api-version=2020-01-01 

 

In the URI, Subscription Id, Resource Group Name, Resource Name, and Location need to be parsed and set in the correct location to create the URI that will carry out the PUT request on a resource.  Although we will not walk through the entire remediation process, we will discuss how to parse variables from the properties.resourceDetails.id Return type so that we can form the correct URI syntax.  To setup a Logic App for Workflow Automation and more details, see the public documentation here.

 

Building the Logic App

In this section, we will create a Logic App in your Azure Subscription.  Then we will add the logic to parse the variables we need.  Last, we will trigger the Logic App to send an email with our parsed variables.

  1. In the Azure Portal, click on All services, in the search box type: logic app, and click on the Logic App in the results
  2. Click on Add to create a new Logic AppCreateNewLogicApp.png
  3. Choose a Resource Group to store the Logic App, type a name, and click Review + create
    CreateNewLogicApp2.png
  4. After the review completes, click on Create
  5. Give it a few minutes and then click Go to Resource
  6. In the Logic App Designer, click Blank Logic App
    CreateNewLogicApp3.png
  7. On the Designer canvas, type: Security Center. Then, down in the Triggers, click on When an Azure Security Center Recommendation is created or triggered
    CreateNewLogicApp4.png
  8. In the Logic App Designer, click New step and in the search box type: send an email. Choose the type of email to use.  For this demo, I will use outlook.com
  9. Once we choose an email type, scroll down the list and click  Send an email (V2) to add it to the Designer.

    Note: you will need to signin to your email provider and grant permissions for the Logic App to send email using your account

  10. In the Send an email (V2), add your email address to the To line

  11. Click in the Subject box, then click Add dynamic content if it doesn’t pop out automatically.  Then click on Properties Display Name
    CreateNewLogicApp5.png

  12. Click into the Body text box and type the following:

                   Resource Name:

                   Resource Group:

     

  13. Click just after Resource Name:  to get your cursor in the right place.  In the dynamic content box, click on Expression and cut and paste the following line, then click Ok:

                    first(skip(split(triggerBody()?['properties']?['resourceDetails']?['id'],'/'),8))

     

  14. Click on the second line Resource Group:  to get your cursor in the right place.  In the dynamic content box, click on Expression and cut and paste the following line, then click Ok:

                   first(skip(split(triggerBody()?['properties']?['resourceDetails']?['id'],'/'),4))

     

    Let’s pause and discuss steps 14 and 15, since these are key steps.  Sometimes in a Logic App, you need to access data that might not yet exist when a workflow starts to run.  In our case, we have the long string called a ResourceId.  Remember this:

                    /subscriptions/<remove-subscription-id>/resourceGroups/rg-usc-vms-         

                    01/providers/Microsoft.Compute/virtualMachines/virtualmachine01  


    We must extract the fields we need at runtime when the workflow is running since they are not exposed in the Connector Return types.  In our case, we need to extract the “Resource Name” and “Resource Group Name”.

                       first(skip(split(triggerBody()?['properties']?['resourceDetails']?['id'],'/'),8))

     

    To do this, we use an Expression.  Let’s work through the Expression piece-by-piece. 

    • first() will return the first item in a collection.  Our ResourceId as a whole string since we only have a single item in the collection. 
    • skip() will remove items starting from the beginning and take two parameters (ResourceId, N number to skip).  For the Resource Name, we need to skip 8 strings. 
    • split() function which will split the ResourceId string at the ‘/’ delimiter.  For our string, we want to skip 4 to get the Resource Group Name and skip 8 to get the Name of the resource.

     

    In the middle is the actual parameter from the Dynamic content ‘Properties Resource Details Id’ but broken out in the workflow like this: triggerBody()?['properties']?['resourceDetails']?['id'].  Any time you need to access a parameter, type triggerBody and it helps by auto-completing in the Logic App Designer Expression.  Of course there’s a lot more to Expressions and the Return types we could look at, but this is what we need for now.

     

    Note: For details about each of the Functions, see this page.


    Let’s get back to building the Logic App

  15. Hopefully, your screen looks like the below screenshot.  If so, click on Save in the Logic App Designer and we are ready to fire off the Logic App.

    CreateNewLogicApp6.png

     

     


    Firing the Logic App

    There are two ways to trigger a Logic App, manually and automated.  For our testing, we will trigger the Logic App manually.  For details on running automated Logic App see the public document here.

  16. Go back to Azure Security Center
  17. Click on Recommendations under RESOURCE SECURITY HYGIENE
  18. Look for any Recommendation that has a Quick Fix! Tag
    CreateNewLogicApp7.png
  19. Tick the resource for the Trigger Logic App to light up.  Click on the Trigger Logic App button
    CreateNewLogicApp8.png
  20. In the Logic App Trigger blade, tick the Logic App you created.  If you followed all the steps, it will be named Email-Resource-Info.  Tick it and click the Trigger button. 

CreateNewLogicApp9.png


You
should receive an email that populated the Resource Group Name and Resource Name

CreateNewLogicApp10.png

 

Conclusion

To review, we have walked through the process of working with Azure Security Center Recommendation parameters in a Logic App.  We have deployed the Logic App, triggered a Workflow Automation, and received an email with the selected parameters.  We also saw that, when the Workflow Automation triggers a Logic App, the properties.resourceDetails.id is used to query the parameters using three Expressions (First(), Skip(), and Split()) to parse the variables from the properties.resourceDetails.id

 

In a future blog, we will combine these steps with a real Remediation to see how the parameters are used to perform an Azure API REST call.

 

Special thanks to:

Yuri Diogenes and Ofir Monza for collaborating on and reviewing this post