<br />
<b>Deprecated</b>:  YoastSEO_Vendor\Symfony\Component\DependencyInjection\Container::__construct(): Implicitly marking parameter $parameterBag as nullable is deprecated, the explicit nullable type must be used instead in <b>/home/nubelus/sharedove/adisjugo/wp-content/plugins/wordpress-seo/vendor_prefixed/symfony/dependency-injection/Container.php</b> on line <b>60</b><br />
<br />
<b>Deprecated</b>:  YoastSEO_Vendor\League\OAuth2\Client\Provider\AbstractProvider::authorize(): Implicitly marking parameter $redirectHandler as nullable is deprecated, the explicit nullable type must be used instead in <b>/home/nubelus/sharedove/adisjugo/wp-content/plugins/wordpress-seo/vendor_prefixed/league/oauth2-client/src/Provider/AbstractProvider.php</b> on line <b>416</b><br />
<br />
<b>Deprecated</b>:  YoastSEO_Vendor\GuzzleHttp\Client::getConfig(): Implicitly marking parameter $option as nullable is deprecated, the explicit nullable type must be used instead in <b>/home/nubelus/sharedove/adisjugo/wp-content/plugins/wordpress-seo/vendor_prefixed/guzzlehttp/guzzle/src/Client.php</b> on line <b>181</b><br />
<br />
<b>Deprecated</b>:  YoastSEO_Vendor\GuzzleHttp\ClientInterface::getConfig(): Implicitly marking parameter $option as nullable is deprecated, the explicit nullable type must be used instead in <b>/home/nubelus/sharedove/adisjugo/wp-content/plugins/wordpress-seo/vendor_prefixed/guzzlehttp/guzzle/src/ClientInterface.php</b> on line <b>77</b><br />
{"id":3646,"date":"2018-11-29T22:12:08","date_gmt":"2018-11-29T22:12:08","guid":{"rendered":"https:\/\/blog.sharedove.com\/adisjugo\/?p=3646"},"modified":"2019-03-02T11:05:51","modified_gmt":"2019-03-02T11:05:51","slug":"extending-powerapps-and-flow-part-1-adding-custom-data-sources-through-azure-api-apps","status":"publish","type":"post","link":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2018\/11\/29\/extending-powerapps-and-flow-part-1-adding-custom-data-sources-through-azure-api-apps\/","title":{"rendered":"Extending PowerApps and Flow, part 1: Adding custom data sources through Azure API Apps"},"content":{"rendered":"<p>After multiple sessions about extending PowerApps with custom code I had during the past six months, a lot of people have asked me if I could write it all down. Since PowerApps are declared by Microsoft as a successor of InfoPath (without 1:1 parity, though), this blog post series will be targeted mainly to SharePoint developers, but also to everyone else, who wants to simulate things like custom functions, custom data sources, and code behind \u2013 things which were well known in InfoPath, but are nonexistent in PowerApps.<\/p>\n<p>So, there it is, a short series of 4-5 tutorial like blog posts on extending PowerApps and Flow. I\u2019ll cover adding custom data sources via Azure API Apps, adding custom functionality via Azure Functions, exchanging data between PowerApps, Flow and other systems via Azure Service Bus, and extending Flow with custom actions. Part 1 is about using Azure API Apps for adding wrappers around custom data sources, and using it in PowerApps.<\/p>\n<h3>The case<\/h3>\n<p>It is very often a case, that you need to integrate data from legacy applications and\/or data sources, with modern application platforms, such as Azure and Office 365. It might not even be a legacy data, a lonely database on some forgotten server, is sometimes sufficient to give you a headache. PowerApps offer a really cool possibility to access such data sources through Web APIs, deployed as Azure API Apps. In our demo use case here, we have a SQL Server database with a datatable of beers, which we would like to manage through PowerApps.<\/p>\n<p>The same API App can also be used for extending PowerApps expression language, but we will cover that in the next blog post.<\/p>\n<p>So how do we proceed? First, we are going to build a restful Web API, as a wrapper around that database table. Then, we are going to deploy it to Azure, as an API App, with swagger interface enabled. After that, we are going to import that swagger definition into PowerApps, and to build an app around it.<\/p>\n<h3>So, let\u2019s start<\/h3>\n<p>The first thing we are going to do, is to start the Visual Studio, and to create a new Api APP. In order to do that, create a new Web Project, and select Azure API App.<\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/001.png\"><img loading=\"lazy\" decoding=\"async\" title=\"001\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"001\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/001_thumb.png\" width=\"941\" height=\"653\"><\/a><\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/002.png\"><img loading=\"lazy\" decoding=\"async\" title=\"002\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"002\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/002_thumb.png\" width=\"786\" height=\"513\"><\/a><\/p>\n<p>Since the main purpose of our API App will be to make a restful service wrapper around a database, let\u2019s add some data to it. I will choose here ADO.NET Entity Data model and Code First from Database, but it can really be anything. I am going to call it BeerDataModel.<\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/003.png\"><img loading=\"lazy\" decoding=\"async\" title=\"003\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"003\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/003_thumb.png\" width=\"1144\" height=\"699\"><\/a><\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/004.png\"><img loading=\"lazy\" decoding=\"async\" title=\"004\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"004\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/004_thumb.png\" width=\"617\" height=\"559\"><\/a><\/p>\n<p>So let\u2019s use my beers database. <img decoding=\"async\" class=\"wlEmoticon wlEmoticon-smile\" style=\"border-top-style: none; border-left-style: none; border-bottom-style: none; border-right-style: none\" alt=\"Smile\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/wlEmoticon-smile.png\"> I am hosting it in Azure, but it can be really anywhere.<\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/005.png\"><img loading=\"lazy\" decoding=\"async\" title=\"005\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"005\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/005_thumb.png\" width=\"839\" height=\"329\"><\/a><\/p>\n<p>I will need to create a connection string in Visual Studio\u2026<\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/006.png\"><img loading=\"lazy\" decoding=\"async\" title=\"006\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"006\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/006_thumb.png\" width=\"554\" height=\"653\"><\/a><\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/007.png\"><img loading=\"lazy\" decoding=\"async\" title=\"007\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"007\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/007_thumb.png\" width=\"617\" height=\"559\"><\/a><\/p>\n<p>\u2026and to choose table(s) which I want to publish through this restful API. In this case, we will keep it simple, and take only one table \u2013 \u201callbeers\u201d.&nbsp;<\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/008.png\"><img loading=\"lazy\" decoding=\"async\" title=\"008\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"008\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/008_thumb.png\" width=\"617\" height=\"559\"><\/a><\/p>\n<p>Once we have added the data model to our service, we need to add some controllers to wrap that data.&nbsp; In my case, Scaffolded Item will do fine:<\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/009.png\"><img loading=\"lazy\" decoding=\"async\" title=\"009\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"009\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/009_thumb.png\" width=\"787\" height=\"583\"><\/a><\/p>\n<p>I will say that it is&nbsp; Web API 2 Controller with actions around Entity Framework data:<\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/010.png\"><img loading=\"lazy\" decoding=\"async\" title=\"010\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"010\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/010_thumb.png\" width=\"857\" height=\"458\"><\/a><\/p>\n<p>Visual Studio will be nice enough, to immediately offer me model and data context classes.<\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/011.png\"><img loading=\"lazy\" decoding=\"async\" title=\"011\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"011\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/011_thumb.png\" width=\"586\" height=\"231\"><\/a><\/p>\n<p>Once when it is all done, my project looks like this: Model Class, Data Context class, my new controller, and default controller (\u201cValuesController\u201d) which was created initially with the project. We can delete that one, since we will not need it.<\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/012.png\"><img loading=\"lazy\" decoding=\"async\" title=\"012\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"012\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/012_thumb.png\" width=\"312\" height=\"399\"><\/a><\/p>\n<p>Now, we need to enable swagger UI. Swagger is service definition format, used for restful services, much as WSDL was used with SOAP. Visual Studio offers us instant enabling of swagger UI in the SwaggerConfig.cs file in App_Start. In short, you can just uncomment the .EnableSwaggerUi part. But, it is worthwhile to take&nbsp; look at that file, much of the how swagger works with your service can be understood from there.<\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/013.png\"><img loading=\"lazy\" decoding=\"async\" title=\"013\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"013\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/013_thumb.png\" width=\"968\" height=\"509\"><\/a><\/p>\n<p>Once it has been done, you can actually just press F5 and look the magic&nbsp; happen. Since we didn\u2019t define any startup document, IIS Express will just return 403 error. No problem, since we have the swagger interface enabled, let\u2019s just append \u201c\/swagger\u201d to your service url, and voila\u2026 There is your service! With service description, and options to test all the methods.<\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/014.png\"><img loading=\"lazy\" decoding=\"async\" title=\"014\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"014\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/014_thumb.png\" width=\"1186\" height=\"921\"><\/a><\/p>\n<p>For example, click on GET allbeers operation, and then click on \u201cTry it out!\u201d \u2013 you\u2019ll get all your beers as bunch of JSON.<\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/015.png\"><img loading=\"lazy\" decoding=\"async\" title=\"015\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"015\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/015_thumb.png\" width=\"696\" height=\"507\"><\/a><\/p>\n<p>The next we need to do, is to deploy this Web API it as an API App. This is a fairly simple process form Visual Studio, you will need to select or create new Azure web application, and to publish it as an App Service.<\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/021.png\"><img loading=\"lazy\" decoding=\"async\" title=\"021\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"021\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/021_thumb.png\" width=\"1147\" height=\"843\"><\/a><\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/022.png\"><img loading=\"lazy\" decoding=\"async\" title=\"022\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"022\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/022_thumb.png\" width=\"706\" height=\"558\"><\/a><\/p>\n<p>Now let\u2019s go to our Azure management portal, and check if the API App has been properly created:<\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/023.png\"><img loading=\"lazy\" decoding=\"async\" title=\"023\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"023\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/023_thumb.png\" width=\"838\" height=\"335\"><\/a><\/p>\n<p>Also, test it through the swagger UI of the deployed API:<\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/024.png\"><img loading=\"lazy\" decoding=\"async\" title=\"024\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"024\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/024_thumb.png\" width=\"1135\" height=\"913\"><\/a><\/p>\n<p>Once you are sure it all works, open the swagger API definition from swagger UI, and save it is a JSON file:<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/025.png\"><img loading=\"lazy\" decoding=\"async\" title=\"025\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"025\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/025_thumb.png\" width=\"1139\" height=\"918\"><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Once you have done that, go to the PowerApps portal, in the connections section, and click on add new connection, New Custom API.<\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/026.png\"><img loading=\"lazy\" decoding=\"async\" title=\"026\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"026\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/026_thumb.png\" width=\"1129\" height=\"542\"><\/a><\/p>\n<p>In the dialog that you will get after it, you will have to name your custom API, to upload the swagger API definition and icon.<\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/027.png\"><img loading=\"lazy\" decoding=\"async\" title=\"027\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"027\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/027_thumb.png\" width=\"954\" height=\"617\"><\/a><\/p>\n<p>We will talk about authentication a bit later, but for the moment, in the authentication dialog, choose the only possible option \u2013 No authentication.<\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/028.png\"><img loading=\"lazy\" decoding=\"async\" title=\"028\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"028\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/028_thumb.png\" width=\"505\" height=\"240\"><\/a><\/p>\n<p>And there is your new custom API! Now, let\u2019s create a PowerApp from it.<\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/029.png\"><img loading=\"lazy\" decoding=\"async\" title=\"029\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"029\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/029_thumb.png\" width=\"1131\" height=\"493\"><\/a><\/p>\n<p>In the early version of PowerApps, when the Enterprise plan was still available, it was possible to use a wizard generate an app from the custom API. That feature hit the dust at some point of time, and it seems that it is not coming back. So, you will have to wire the controls to your custom data source manually. Which is not difficult, but not something you would let your power users (intended audience here) do. A practical workaround is to create a PowerApp from any data source, and then to change wirings manually. In my case, I created a dummy PowerApp from an existing SharePoint list, and through the Data sources dialog in PowerApps app for Windows 10, added my custom API as a new connection:<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/030.png\"><img loading=\"lazy\" decoding=\"async\" title=\"030\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"030\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/030_thumb.png\" width=\"328\" height=\"439\"><\/a><\/p>\n<p>In the screens that PowerApps wizard created for me, I just changed the existing item sources with my RESTful API methods (get all, get one, put, post, delete), and I was good to go:<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/031.png\"><img loading=\"lazy\" decoding=\"async\" title=\"031\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"031\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/031_thumb.png\" width=\"500\" height=\"829\"><\/a><\/p>\n<p>That\u2019s it \u2013 this is your PowerApp, which is using custom API as a data source! Pretty cool, huh? Well\u2026<\/p>\n<h3>Security<\/h3>\n<p>\u2026well, only partly.&nbsp; As you have probably noticed, there is zero security around this API, and in this App. When we already speak about the features which have bit the dust, passing authentication tokens to API Apps was one of them. That \u201cAuthentication\u201d dialog was not always empty \u2013 \u201cAzure Active Directory\u201d was there earlier. When that option was selected, and when Azure API App\u2019s authentication was set to AAD (screenshot below), PowerApp (actually, an AAD App created in background) was passing tokens to API App, and user was properly impersonated.<\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/101.png\"><img loading=\"lazy\" decoding=\"async\" title=\"101\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"101\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/101_thumb.png\" width=\"826\" height=\"851\"><\/a><\/p>\n<p>Now, if you try to turn the App Service Authentication On, and to configure AAD authentication, PowerApps will fail with bad response message (Service returns 401 \u2013 unauthorized). This would be my plea to PowerApps team to bring back the AAD authentication (this is a must), and to implement a key authentication (this would also be really cool), otherwise all of this is only partly usable \u2013 there are no that many data sources that can remain unprotected.<\/p>\n<p><a href=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/105.png\"><img loading=\"lazy\" decoding=\"async\" title=\"105\" style=\"border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px\" border=\"0\" alt=\"105\" src=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/105_thumb.png\" width=\"863\" height=\"555\"><\/a><\/p>\n<p>So much for now, in the next part, we will see how to reuse newly created API App to extend PowerApps\u2019 expression language, by adding some custom controllers.<\/p>\n<div class=\"fb-background-color\">\n\t\t\t  <div \n\t\t\t  \tclass = \"fb-comments\" \n\t\t\t  \tdata-href = \"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2018\/11\/29\/extending-powerapps-and-flow-part-1-adding-custom-data-sources-through-azure-api-apps\/\"\n\t\t\t  \tdata-numposts = \"59\"\n\t\t\t  \tdata-lazy = \"true\"\n\t\t\t\tdata-colorscheme = \"light\"\n\t\t\t\tdata-order-by = \"time\"\n\t\t\t\tdata-mobile=true>\n\t\t\t  <\/div><\/div>\n\t\t  <style>\n\t\t    .fb-background-color {\n\t\t\t\tbackground:  !important;\n\t\t\t}\n\t\t\t.fb_iframe_widget_fluid_desktop iframe {\n\t\t\t    width: 100% !important;\n\t\t\t}\n\t\t  <\/style>\n\t\t  ","protected":false},"excerpt":{"rendered":"<p>After multiple sessions about extending PowerApps with custom code I had during the past six months, a lot of people have asked me if I could write it all down. Since PowerApps are declared by Microsoft as a successor of InfoPath (without 1:1 parity, though), this blog post series will be targeted mainly to SharePoint [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3649,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[11],"tags":[21,126,55],"class_list":["post-3646","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-development","tag-azure","tag-powerapps","tag-sharepoint"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Extending PowerApps and Flow, part 1: Adding custom data sources through Azure API Apps - Adis Jugo blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2018\/11\/29\/extending-powerapps-and-flow-part-1-adding-custom-data-sources-through-azure-api-apps\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Extending PowerApps and Flow, part 1: Adding custom data sources through Azure API Apps - Adis Jugo blog\" \/>\n<meta property=\"og:description\" content=\"After multiple sessions about extending PowerApps with custom code I had during the past six months, a lot of people have asked me if I could write it all down. Since PowerApps are declared by Microsoft as a successor of InfoPath (without 1:1 parity, though), this blog post series will be targeted mainly to SharePoint [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2018\/11\/29\/extending-powerapps-and-flow-part-1-adding-custom-data-sources-through-azure-api-apps\/\" \/>\n<meta property=\"og:site_name\" content=\"Adis Jugo blog\" \/>\n<meta property=\"article:published_time\" content=\"2018-11-29T22:12:08+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-03-02T11:05:51+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/corto.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2391\" \/>\n\t<meta property=\"og:image:height\" content=\"1488\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"adis.jugo\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"adis.jugo\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2018\/11\/29\/extending-powerapps-and-flow-part-1-adding-custom-data-sources-through-azure-api-apps\/\",\"url\":\"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2018\/11\/29\/extending-powerapps-and-flow-part-1-adding-custom-data-sources-through-azure-api-apps\/\",\"name\":\"Extending PowerApps and Flow, part 1: Adding custom data sources through Azure API Apps - Adis Jugo blog\",\"isPartOf\":{\"@id\":\"https:\/\/blog.sharedove.com\/adisjugo\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2018\/11\/29\/extending-powerapps-and-flow-part-1-adding-custom-data-sources-through-azure-api-apps\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2018\/11\/29\/extending-powerapps-and-flow-part-1-adding-custom-data-sources-through-azure-api-apps\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/corto.png\",\"datePublished\":\"2018-11-29T22:12:08+00:00\",\"dateModified\":\"2019-03-02T11:05:51+00:00\",\"author\":{\"@id\":\"https:\/\/blog.sharedove.com\/adisjugo\/#\/schema\/person\/a5ca63552094ce9d5a0440f3a1ac9a4c\"},\"breadcrumb\":{\"@id\":\"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2018\/11\/29\/extending-powerapps-and-flow-part-1-adding-custom-data-sources-through-azure-api-apps\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2018\/11\/29\/extending-powerapps-and-flow-part-1-adding-custom-data-sources-through-azure-api-apps\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2018\/11\/29\/extending-powerapps-and-flow-part-1-adding-custom-data-sources-through-azure-api-apps\/#primaryimage\",\"url\":\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/corto.png\",\"contentUrl\":\"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/corto.png\",\"width\":2391,\"height\":1488},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2018\/11\/29\/extending-powerapps-and-flow-part-1-adding-custom-data-sources-through-azure-api-apps\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/blog.sharedove.com\/adisjugo\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Extending PowerApps and Flow, part 1: Adding custom data sources through Azure API Apps\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/blog.sharedove.com\/adisjugo\/#website\",\"url\":\"https:\/\/blog.sharedove.com\/adisjugo\/\",\"name\":\"Adis Jugo blog\",\"description\":\"The Southern Side\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/blog.sharedove.com\/adisjugo\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/blog.sharedove.com\/adisjugo\/#\/schema\/person\/a5ca63552094ce9d5a0440f3a1ac9a4c\",\"name\":\"adis.jugo\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/blog.sharedove.com\/adisjugo\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cc5a23cf1bd0b9d8401c9dd65c6c141041ec0c6e37eedbb511779e4a40a198fd?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cc5a23cf1bd0b9d8401c9dd65c6c141041ec0c6e37eedbb511779e4a40a198fd?s=96&d=mm&r=g\",\"caption\":\"adis.jugo\"},\"url\":\"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/author\/adisjugo\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Extending PowerApps and Flow, part 1: Adding custom data sources through Azure API Apps - Adis Jugo blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2018\/11\/29\/extending-powerapps-and-flow-part-1-adding-custom-data-sources-through-azure-api-apps\/","og_locale":"en_US","og_type":"article","og_title":"Extending PowerApps and Flow, part 1: Adding custom data sources through Azure API Apps - Adis Jugo blog","og_description":"After multiple sessions about extending PowerApps with custom code I had during the past six months, a lot of people have asked me if I could write it all down. Since PowerApps are declared by Microsoft as a successor of InfoPath (without 1:1 parity, though), this blog post series will be targeted mainly to SharePoint [&hellip;]","og_url":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2018\/11\/29\/extending-powerapps-and-flow-part-1-adding-custom-data-sources-through-azure-api-apps\/","og_site_name":"Adis Jugo blog","article_published_time":"2018-11-29T22:12:08+00:00","article_modified_time":"2019-03-02T11:05:51+00:00","og_image":[{"width":2391,"height":1488,"url":"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/corto.png","type":"image\/png"}],"author":"adis.jugo","twitter_card":"summary_large_image","twitter_misc":{"Written by":"adis.jugo","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2018\/11\/29\/extending-powerapps-and-flow-part-1-adding-custom-data-sources-through-azure-api-apps\/","url":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2018\/11\/29\/extending-powerapps-and-flow-part-1-adding-custom-data-sources-through-azure-api-apps\/","name":"Extending PowerApps and Flow, part 1: Adding custom data sources through Azure API Apps - Adis Jugo blog","isPartOf":{"@id":"https:\/\/blog.sharedove.com\/adisjugo\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2018\/11\/29\/extending-powerapps-and-flow-part-1-adding-custom-data-sources-through-azure-api-apps\/#primaryimage"},"image":{"@id":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2018\/11\/29\/extending-powerapps-and-flow-part-1-adding-custom-data-sources-through-azure-api-apps\/#primaryimage"},"thumbnailUrl":"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/corto.png","datePublished":"2018-11-29T22:12:08+00:00","dateModified":"2019-03-02T11:05:51+00:00","author":{"@id":"https:\/\/blog.sharedove.com\/adisjugo\/#\/schema\/person\/a5ca63552094ce9d5a0440f3a1ac9a4c"},"breadcrumb":{"@id":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2018\/11\/29\/extending-powerapps-and-flow-part-1-adding-custom-data-sources-through-azure-api-apps\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2018\/11\/29\/extending-powerapps-and-flow-part-1-adding-custom-data-sources-through-azure-api-apps\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2018\/11\/29\/extending-powerapps-and-flow-part-1-adding-custom-data-sources-through-azure-api-apps\/#primaryimage","url":"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/corto.png","contentUrl":"https:\/\/blog.sharedove.com\/adisjugo\/wp-content\/uploads\/2016\/11\/corto.png","width":2391,"height":1488},{"@type":"BreadcrumbList","@id":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/2018\/11\/29\/extending-powerapps-and-flow-part-1-adding-custom-data-sources-through-azure-api-apps\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blog.sharedove.com\/adisjugo\/"},{"@type":"ListItem","position":2,"name":"Extending PowerApps and Flow, part 1: Adding custom data sources through Azure API Apps"}]},{"@type":"WebSite","@id":"https:\/\/blog.sharedove.com\/adisjugo\/#website","url":"https:\/\/blog.sharedove.com\/adisjugo\/","name":"Adis Jugo blog","description":"The Southern Side","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.sharedove.com\/adisjugo\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/blog.sharedove.com\/adisjugo\/#\/schema\/person\/a5ca63552094ce9d5a0440f3a1ac9a4c","name":"adis.jugo","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/blog.sharedove.com\/adisjugo\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cc5a23cf1bd0b9d8401c9dd65c6c141041ec0c6e37eedbb511779e4a40a198fd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cc5a23cf1bd0b9d8401c9dd65c6c141041ec0c6e37eedbb511779e4a40a198fd?s=96&d=mm&r=g","caption":"adis.jugo"},"url":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/author\/adisjugo\/"}]}},"_links":{"self":[{"href":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/wp-json\/wp\/v2\/posts\/3646","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/wp-json\/wp\/v2\/comments?post=3646"}],"version-history":[{"count":2,"href":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/wp-json\/wp\/v2\/posts\/3646\/revisions"}],"predecessor-version":[{"id":3935,"href":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/wp-json\/wp\/v2\/posts\/3646\/revisions\/3935"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/wp-json\/wp\/v2\/media\/3649"}],"wp:attachment":[{"href":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/wp-json\/wp\/v2\/media?parent=3646"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/wp-json\/wp\/v2\/categories?post=3646"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.sharedove.com\/adisjugo\/index.php\/wp-json\/wp\/v2\/tags?post=3646"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}