Anyone can be a developer - logic apps from Azure As we go further and further down the rabbit hole that is Azure it becomes more and more apparent how good the platform is. However logic apps takes that to a whole new level - anyone can develop useful code with this - it's amazing (and this is coming from a very cynical 20 year DBA veteran....).

To demonstrate this i am going to show a simple example of what it can do - in this sample i want to know anytime something happens in my Azure subscription and write an audit record of that - i.e. someone adds a VM or some PaaS resource i want to know when this was done (there are other ways to do the same thing but just bear with me for this example).

I pick this as a sample that happens to be an Azure based event - but it doesn't have to be - the thing can hook up to loads of other things.

So first things first - lets navigate to the logic apps section i the portal and click add: Fill in some data - give it any old name you like set the subscription, the resource group and the location. Now its added OK Now we say the initial thing we want to trigger on - in my sample i choose event grid event for Azure - but there are loads - a few other shown in the screenshot below Once i choose that it prompt me to login to Azure to select some settings Now we have multiple tenants so we get a drop down - you may likely have just one. I click sign in then log in through the normal microsoft process (note there is a service principal option to use a dedicated account that way should you wish) Once logged in i then click the continue button Now i'm prompted for some values - which i just select from a drop down I choose the relevant ones - in this case and 'subscription' level events. And I'm done - that initial trigger captures any data broadcast from the Azure event system for the subscription I'm interested in - but so far does nothing with it - so lets change that and add a new step and click add action. This time i choose SQL server and the insert row action I get prompted again for connection information (if as in my case its Azure SQL i actually get a list to just choose from) - then i just enter username and password. It then gives me a list of tables, i choose the 'auditlog' table i created - it then shows me all the columns in that table. I click into each one and I'm then presented with a list of the data objects returned from the previous step and i just click the one value i want which then becomes the column value inserted

(for reference this is the create table statement should you want it)

create TABLE auditlog (eventtype nvarchar(max),eventtime nvarchar(max),subject nvarchar(max), topic nvarchar(max),fulleventdata nvarchar(max)) This was all working great until i hit a little wrinkle with trying to insert the main data object from the previous step - it seems the fact that this is a complex json object is confusing the code (which is also defined in json format) - so i have to manually type the text into the code editor rather than using the designer - this is shown below - i think this is likely because this connector is a preview feature and still has a couple of 'features'. I simple do a concat of a null string at the beginning and end - this then seems to cast it as a string rather than a json object and all is well. Once i do that and return to the main screen i see this in the designer - so it seems there should be some way of launching a function wizard here to do the same thing i did in the code editor - it just didn't seem to fire automatically for me. Once that is done i can run it as a test by clicking the run button at the top of the screen - which gives me some nice debug and a green tick to say all is well. I can then log into my Azure SQL DB and query the data back - using the SQL operation Studio - a nice event addition (for me at least as a mac user). So there we have it - a fully functioning audit trail - with no code (well other than that little wrinkle with the SQL column) - I'm seriously impressed.

Anyone could do this - you could build an entire workflow/scheduling type tool this way - with multiple dependencies and parallel tasks etc. Fetch files from server x, process then and send the results to some web service then send a message to an MS teams channel or send an email.
[null, {"document_url": "http://dbaharrison.blogspot.com/2018/01/anyone-can-be-developer-logic-apps-from.html", "unformatted_src": "https://2.bp.blogspot.com/-38wog5lgmy4/Wlp1y7y6lVI/AAAAAAAACy4/z8GJHIrXdPsklxfZ9E_Toy8CAvq-MatRwCLcBGAs/s320/cartoon-2026918_640.png", "src": "https://2.bp.blogspot.com/-38wog5lgmy4/Wlp1y7y6lVI/AAAAAAAACy4/z8GJHIrXdPsklxfZ9E_Toy8CAvq-MatRwCLcBGAs/s320/cartoon-2026918_640.png", "formatted_filename": "cartoon", "rendered_width": 320, "rendered_height": 269}, null, {"document_url": "http://dbaharrison.blogspot.com/2018/01/anyone-can-be-developer-logic-apps-from.html", "unformatted_src": "https://1.bp.blogspot.com/-cnbVnpWkWng/WlpvpjlS63I/AAAAAAAACyQ/hIHX72ftmCgru0vOgN3SSXXs41y5Los_ACLcBGAs/s320/Logic_apps_-_Microsoft_Azure.png", "src": "https://1.bp.blogspot.com/-cnbVnpWkWng/WlpvpjlS63I/AAAAAAAACyQ/hIHX72ftmCgru0vOgN3SSXXs41y5Los_ACLcBGAs/s320/Logic_apps_-_Microsoft_Azure.png", "formatted_filename": "Logic apps Microsoft Azure", "rendered_width": 320, "rendered_height": 76}, null, {"document_url": "http://dbaharrison.blogspot.com/2018/01/anyone-can-be-developer-logic-apps-from.html", "unformatted_src": "https://2.bp.blogspot.com/-Gy2KTNd5J2M/WlpxAu5C_zI/AAAAAAAACyc/uAgZU-oBoiQgpjrPAuFU1ef7P65BfRslACLcBGAs/s320/Create_logic_app_-_Microsoft_Azure2.png", "src": "https://2.bp.blogspot.com/-Gy2KTNd5J2M/WlpxAu5C_zI/AAAAAAAACyc/uAgZU-oBoiQgpjrPAuFU1ef7P65BfRslACLcBGAs/s320/Create_logic_app_-_Microsoft_Azure2.png", "formatted_filename": "Create logic app Microsoft Azure", "rendered_width": 158, "rendered_height": 320}, null, {"document_url": "http://dbaharrison.blogspot.com/2018/01/anyone-can-be-developer-logic-apps-from.html", "unformatted_src": "https://4.bp.blogspot.com/-d83pA6otzGw/WlpvoKZoZXI/AAAAAAAACx0/qWaxgz0LCm84sNEEGTjeW1cBuBs_-xCXgCLcBGAs/s320/Logic_Apps_Designer_-_Microsoft_Azure3.png", "src": "https://4.bp.blogspot.com/-d83pA6otzGw/WlpvoKZoZXI/AAAAAAAACx0/qWaxgz0LCm84sNEEGTjeW1cBuBs_-xCXgCLcBGAs/s320/Logic_Apps_Designer_-_Microsoft_Azure3.png", "formatted_filename": "Logic Apps Designer Microsoft Azure", "rendered_width": 320, "rendered_height": 166}, null, {"document_url": "http://dbaharrison.blogspot.com/2018/01/anyone-can-be-developer-logic-apps-from.html", "unformatted_src": "https://3.bp.blogspot.com/-DqN94o-p_wo/WlpvoT-zUXI/AAAAAAAACx4/DbS0Ph9FEQ0bOBV4VhKyVNw7lEQBHw8sACLcBGAs/s320/Logic_Apps_Designer_-_Microsoft_Azure4.png", "src": "https://3.bp.blogspot.com/-DqN94o-p_wo/WlpvoT-zUXI/AAAAAAAACx4/DbS0Ph9FEQ0bOBV4VhKyVNw7lEQBHw8sACLcBGAs/s320/Logic_Apps_Designer_-_Microsoft_Azure4.png", "formatted_filename": "Logic Apps Designer Microsoft Azure", "rendered_width": 320, "rendered_height": 134}, null, {"document_url": "http://dbaharrison.blogspot.com/2018/01/anyone-can-be-developer-logic-apps-from.html", "unformatted_src": "https://3.bp.blogspot.com/-CXxBP4aXYB0/WlpvoZVixEI/AAAAAAAACyA/yebuVS36QnYlOq3UPoMQMjCrcki-nlvvwCLcBGAs/s320/Logic_Apps_Designer_-_Microsoft_Azure5.png", "src": "https://3.bp.blogspot.com/-CXxBP4aXYB0/WlpvoZVixEI/AAAAAAAACyA/yebuVS36QnYlOq3UPoMQMjCrcki-nlvvwCLcBGAs/s320/Logic_Apps_Designer_-_Microsoft_Azure5.png", "formatted_filename": "Logic Apps Designer Microsoft Azure", "rendered_width": 320, "rendered_height": 105}, null, {"document_url": "http://dbaharrison.blogspot.com/2018/01/anyone-can-be-developer-logic-apps-from.html", "unformatted_src": "https://1.bp.blogspot.com/-5magI3aKr-Q/WlpvoWBLv6I/AAAAAAAACx8/hPlBn3otxeo9W0CZNBg8m9DP9bKmYmOogCLcBGAs/s320/Logic_Apps_Designer_-_Microsoft_Azure6.png", "src": "https://1.bp.blogspot.com/-5magI3aKr-Q/WlpvoWBLv6I/AAAAAAAACx8/hPlBn3otxeo9W0CZNBg8m9DP9bKmYmOogCLcBGAs/s320/Logic_Apps_Designer_-_Microsoft_Azure6.png", "formatted_filename": "Logic Apps Designer Microsoft Azure", "rendered_width": 320, "rendered_height": 139}, null, {"document_url": "http://dbaharrison.blogspot.com/2018/01/anyone-can-be-developer-logic-apps-from.html", "unformatted_src": "https://3.bp.blogspot.com/-IqPmGXoxfY4/Wlpvo4S7HrI/AAAAAAAACyE/_T41lo-Ne7wcESwTJi2YB-0HJiglOFJZwCLcBGAs/s320/Logic_Apps_Designer_-_Microsoft_Azure7.png", "src": "https://3.bp.blogspot.com/-IqPmGXoxfY4/Wlpvo4S7HrI/AAAAAAAACyE/_T41lo-Ne7wcESwTJi2YB-0HJiglOFJZwCLcBGAs/s320/Logic_Apps_Designer_-_Microsoft_Azure7.png", "formatted_filename": "Logic Apps Designer Microsoft Azure", "rendered_width": 320, "rendered_height": 78}, null, {"document_url": "http://dbaharrison.blogspot.com/2018/01/anyone-can-be-developer-logic-apps-from.html", "unformatted_src": "https://3.bp.blogspot.com/-1Lt-O6A1vGA/WlpvpSRXfoI/AAAAAAAACyI/ryr1XL-TG38UniY_CBxYimwiflEzkYSuwCLcBGAs/s320/Logic_Apps_Designer_-_Microsoft_Azure8.png", "src": "https://3.bp.blogspot.com/-1Lt-O6A1vGA/WlpvpSRXfoI/AAAAAAAACyI/ryr1XL-TG38UniY_CBxYimwiflEzkYSuwCLcBGAs/s320/Logic_Apps_Designer_-_Microsoft_Azure8.png", "formatted_filename": "Logic Apps Designer Microsoft Azure", "rendered_width": 320, "rendered_height": 135}, null, {"document_url": "http://dbaharrison.blogspot.com/2018/01/anyone-can-be-developer-logic-apps-from.html", "unformatted_src": "https://3.bp.blogspot.com/-Z-PftdYM3X4/WlpvpRQxOPI/AAAAAAAACyM/pCuFjcJUKXQufsJvKX-xCaQBWLQVPzc0gCLcBGAs/s320/Logic_Apps_Designer_-_Microsoft_Azure9.png", "src": "https://3.bp.blogspot.com/-Z-PftdYM3X4/WlpvpRQxOPI/AAAAAAAACyM/pCuFjcJUKXQufsJvKX-xCaQBWLQVPzc0gCLcBGAs/s320/Logic_Apps_Designer_-_Microsoft_Azure9.png", "formatted_filename": "Logic Apps Designer Microsoft Azure", "rendered_width": 320, "rendered_height": 130}, null, {"document_url": "http://dbaharrison.blogspot.com/2018/01/anyone-can-be-developer-logic-apps-from.html", "unformatted_src": "https://3.bp.blogspot.com/-HANnaEUT0J4/WlpvnGh25EI/AAAAAAAACxk/AisU_bS72ZUWU-PjNBBh8dINBfouIPHOACLcBGAs/s320/Logic_Apps_Designer_-_Microsoft_Azure10.png", "src": "https://3.bp.blogspot.com/-HANnaEUT0J4/WlpvnGh25EI/AAAAAAAACxk/AisU_bS72ZUWU-PjNBBh8dINBfouIPHOACLcBGAs/s320/Logic_Apps_Designer_-_Microsoft_Azure10.png", "formatted_filename": "Logic Apps Designer Microsoft Azure", "rendered_width": 320, "rendered_height": 223}, null, {"document_url": "http://dbaharrison.blogspot.com/2018/01/anyone-can-be-developer-logic-apps-from.html", "unformatted_src": "https://4.bp.blogspot.com/-t5mwVZGY-cc/WlpvnG-WJyI/AAAAAAAACxg/WQOnSxFYmWsQqVNkjFJXOwhH_dJpVGPhgCLcBGAs/s320/Logic_Apps_Designer_-_Microsoft_Azure11.png", "src": "https://4.bp.blogspot.com/-t5mwVZGY-cc/WlpvnG-WJyI/AAAAAAAACxg/WQOnSxFYmWsQqVNkjFJXOwhH_dJpVGPhgCLcBGAs/s320/Logic_Apps_Designer_-_Microsoft_Azure11.png", "formatted_filename": "Logic Apps Designer Microsoft Azure", "rendered_width": 320, "rendered_height": 260}, null, {"document_url": "http://dbaharrison.blogspot.com/2018/01/anyone-can-be-developer-logic-apps-from.html", "unformatted_src": "https://1.bp.blogspot.com/-5dSc0EW1L7A/WlpvmzYh4lI/AAAAAAAACxc/9cGF-iUsfFIpETDd2JOqhbv7fXIZty8igCLcBGAs/s320/Logic_Apps_Designer_-_Microsoft_Azure12.png", "src": "https://1.bp.blogspot.com/-5dSc0EW1L7A/WlpvmzYh4lI/AAAAAAAACxc/9cGF-iUsfFIpETDd2JOqhbv7fXIZty8igCLcBGAs/s320/Logic_Apps_Designer_-_Microsoft_Azure12.png", "formatted_filename": "Logic Apps Designer Microsoft Azure", "rendered_width": 320, "rendered_height": 246}, null, {"document_url": "http://dbaharrison.blogspot.com/2018/01/anyone-can-be-developer-logic-apps-from.html", "unformatted_src": "https://4.bp.blogspot.com/-NSF70oX6Xog/WlpvngOtFsI/AAAAAAAACxo/zB1QsDiWiUgn65MvfDrzXv8CFhbe1A8ewCLcBGAs/s320/Logic_Apps_Designer_-_Microsoft_Azure13.png", "src": "https://4.bp.blogspot.com/-NSF70oX6Xog/WlpvngOtFsI/AAAAAAAACxo/zB1QsDiWiUgn65MvfDrzXv8CFhbe1A8ewCLcBGAs/s320/Logic_Apps_Designer_-_Microsoft_Azure13.png", "formatted_filename": "Logic Apps Designer Microsoft Azure", "rendered_width": 320, "rendered_height": 219}, null, {"document_url": "http://dbaharrison.blogspot.com/2018/01/anyone-can-be-developer-logic-apps-from.html", "unformatted_src": "https://2.bp.blogspot.com/-4hfl3hiLJdU/Wlpvn-zW9II/AAAAAAAACxw/MDzLgQvtaBs9GvAsUt4_5QLyZ7F3oknogCLcBGAs/s320/Logic_Apps_Designer_-_Microsoft_Azure14.png", "src": "https://2.bp.blogspot.com/-4hfl3hiLJdU/Wlpvn-zW9II/AAAAAAAACxw/MDzLgQvtaBs9GvAsUt4_5QLyZ7F3oknogCLcBGAs/s320/Logic_Apps_Designer_-_Microsoft_Azure14.png", "formatted_filename": "Logic Apps Designer Microsoft Azure", "rendered_width": 320, "rendered_height": 133}, null, {"document_url": "http://dbaharrison.blogspot.com/2018/01/anyone-can-be-developer-logic-apps-from.html", "unformatted_src": "https://3.bp.blogspot.com/-5_NC584Z5_Y/WlpvnxpChYI/AAAAAAAACxs/3zl9P59dwagV38x0wHu40qR7SXNjgYHjACLcBGAs/s320/Logic_Apps_Designer_-_Microsoft_Azure15.png", "src": "https://3.bp.blogspot.com/-5_NC584Z5_Y/WlpvnxpChYI/AAAAAAAACxs/3zl9P59dwagV38x0wHu40qR7SXNjgYHjACLcBGAs/s320/Logic_Apps_Designer_-_Microsoft_Azure15.png", "formatted_filename": "Logic Apps Designer Microsoft Azure", "rendered_width": 320, "rendered_height": 39}, null, {"document_url": "http://dbaharrison.blogspot.com/2018/01/anyone-can-be-developer-logic-apps-from.html", "unformatted_src": "https://4.bp.blogspot.com/-2PM0KixZUrM/Wlp0XHZktDI/AAAAAAAACys/jHcBfTok5H0u11w3lOxy7uJKYQDS5lc6ACLcBGAs/s320/Logic_Apps_Designer_-_Microsoft_Azure16.png", "src": "https://4.bp.blogspot.com/-2PM0KixZUrM/Wlp0XHZktDI/AAAAAAAACys/jHcBfTok5H0u11w3lOxy7uJKYQDS5lc6ACLcBGAs/s320/Logic_Apps_Designer_-_Microsoft_Azure16.png", "formatted_filename": "Logic Apps Designer Microsoft Azure", "rendered_width": 320, "rendered_height": 252}, null, {"document_url": "http://dbaharrison.blogspot.com/2018/01/anyone-can-be-developer-logic-apps-from.html", "unformatted_src": "https://4.bp.blogspot.com/-9W6BESIj5CY/Wlp0XGc20cI/AAAAAAAACyo/wYbsSvFAlCITztvFSGFIxDKOPtCYGXpDACLcBGAs/s320/SQLQuery2.png", "src": "https://4.bp.blogspot.com/-9W6BESIj5CY/Wlp0XGc20cI/AAAAAAAACyo/wYbsSvFAlCITztvFSGFIxDKOPtCYGXpDACLcBGAs/s320/SQLQuery2.png", "formatted_filename": "SQLQuery", "rendered_width": 320, "rendered_height": 271}, null, null, null, null, null, null, null, null, null, null, null, null, null, {"document_url": "http://dbaharrison.blogspot.com/2018/01/anyone-can-be-developer-logic-apps-from.html", "unformatted_src": "//lh6.googleusercontent.com/-Hus-qdFzFO8/AAAAAAAAAAI/AAAAAAAABH0/iieC4bjs6o4/s80-c/photo.jpg", "src": "http://lh6.googleusercontent.com/-Hus-qdFzFO8/AAAAAAAAAAI/AAAAAAAABH0/iieC4bjs6o4/s80-c/photo.jpg", "formatted_filename": "photo", "alt_text": "My photo", "rendered_width": 80, "rendered_height": 80}, null, null, null, null]