{"id":3971,"date":"2015-12-16T19:03:00","date_gmt":"2015-12-16T19:03:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/cesardelatorre\/2015\/12\/16\/publishing-an-existing-azure-mobile-app-service-as-powerapps-it-managed-api-using-the-healthclinic-biz-sample-apps\/"},"modified":"2015-12-16T19:03:00","modified_gmt":"2015-12-16T19:03:00","slug":"publishing-an-existing-azure-mobile-app-service-as-powerapps-it-managed-api-using-the-healthclinic-biz-sample-apps","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/publishing-an-existing-azure-mobile-app-service-as-powerapps-it-managed-api-using-the-healthclinic-biz-sample-apps\/","title":{"rendered":"Publishing an existing Azure Mobile App service as PowerApps \u2018IT Managed API\u2019 (Using the HealthClinic.biz sample apps)"},"content":{"rendered":"<p>&nbsp;<\/p>\n<h2>Intro to \u201cPowerApps Enterprise\u201d<\/h2>\n<p>You may have heard of <a target=\"_blank\" href=\"http:\/\/powerapps.microsoft.com\">Microsoft PowerApps<\/a> and \u2018<a target=\"_blank\" href=\"https:\/\/azure.microsoft.com\/en-us\/documentation\/articles\/powerapps-get-started-azure-portal\/\">PowerApps Enterprise<\/a>\u2019. Its code-name was \u201c<strong>Project Kratos<\/strong>\u201d and part of it is deriving from the original \u201c<strong><a target=\"_blank\" href=\"https:\/\/www.microsoft.com\/en-us\/projectsiena\/\">Project Siena<\/a><\/strong>\u201d. But in PowerApps, the client PowerApps are cross-platform (iOS, Android and Windows) as they are internally based on Apache Cordova.<\/p>\n<p>However, \u201cPowerApps Enterprise\u201d is a lot more than the client apps you can create. There&#8217;s a lot of stuff in Azure as well, and the Azure area from PowerApps is precisely the right space to work on for developers. The following is a high level diagram that I made trying to show the PowerApps landscape, including assets from Microsoft Azure and Azure App Service which are the foundation pillars for PowerApps Enterprise.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/7450.image_53A6B777.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/7558.image_thumb_711B9934.png\" width=\"820\" height=\"506\" \/><\/a><\/p>\n<p>Personally, I like the following definition available at azure.com:<\/p>\n<p><a target=\"_blank\" href=\"https:\/\/azure.microsoft.com\/en-us\/documentation\/suites\/powerapps\/\">PowerApps Enterprise definition<\/a>: \u201c<em>PowerApps includes all of the existing capabilities available in Azure App Service, and introduces new enhanced capabilities optimized for building business apps. Additionally, PowerApps includes new and innovative visual tools that enable anyone in the organization to create their own apps using APIs and services built by developers<\/em>.\u201d<\/p>\n<p>That tells you that \u2018<a target=\"_blank\" href=\"https:\/\/azure.microsoft.com\/en-us\/documentation\/articles\/powerapps-get-started-azure-portal\/\">PowerApps Enterprise<\/a>\u2019 is not just the \u201c<em>create mobile apps in 10 minutes with no code required<\/em>\u201d feature you get with the <a target=\"_blank\" href=\"https:\/\/powerapps.microsoft.com\/en-us\/tutorials\/get-started-test-drive\/\">PowerApps Authoring Tool<\/a>, but it is a lot more extending <em>Azure App Service<\/em> environment in the cloud, especially in regards \u201centerprise security for your services with Azure AD\u201d.<\/p>\n<p>Usually, if you are creating new cloud API\/services to be consumed by PowerApps client apps, you\u2019d create those services as <a target=\"_blank\" href=\"https:\/\/azure.microsoft.com\/en-us\/documentation\/articles\/app-service-api-apps-why-best-platform\/\">Azure API App<\/a> that already provides like a wrapper of metadata (based on <a target=\"_blank\" href=\"http:\/\/swagger.io\/\">Swagger<\/a>, a very popular RESTful API description metadata) around your service that can be used from the PowerApp client app to discover and consume the service.<\/p>\n<p>You have the following articles in azure.microsoft.com that tells you precisely about that green-field scenario with <strong>PowerApps<\/strong> services and <strong>Azure API Apps<\/strong>.<\/p>\n<ul>\n<li><a target=\"_blank\" href=\"https:\/\/azure.microsoft.com\/en-us\/documentation\/articles\/powerapps-develop-api\/\">Develop an API for PowerApps<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/azure.microsoft.com\/en-us\/documentation\/articles\/app-service-api-dotnet-get-started\/\">Get started with API Apps and ASP.NET in Azure App Service<\/a><\/li>\n<\/ul>\n<h4><\/h4>\n<h2>Why adding an Azure Mobile App service to PowerApps Enterprise environment \u2013<\/h2>\n<h2>The Developer Story<\/h2>\n<p>Ok, but what if rather than focusing on a green-field scenario with \u201cMicrosoft PowerApps services in Azure and the simple power-user data-driven apps\u201d I had a developer scenario with current mobile apps (Cordova, Xamarin, UWP\/C#, etc.) and current services\/API in Azure (maybe <strong>Azure Mobile App<\/strong> services) and I\u2019d like to extend my existing investments so it supports PowerApps as well?<\/p>\n<p>That scenario is comparable to what <strong>Scott Hanselman<\/strong> talks about in this <a target=\"_blank\" href=\"https:\/\/channel9.msdn.com\/Events\/Connect\/\">Channel 9 video<\/a>, but in this blog post I\u2019m drilling down further and explaining how to actually do it, step by step, as it requires quite a few steps and things to take into account.<\/p>\n<h2>Prerequisites for this walkthrough<\/h2>\n<h4><\/h4>\n<h4>Azure Mobile App service and ASP.NET Web API<\/h4>\n<p>The walkthrough assumes that you are familiar with ASP.NET Web API and Azure Mobile App services; if you need more info about Web API and Azure API Apps, check the following articles &#8211;<\/p>\n<ul>\n<li><a href=\"http:\/\/www.asp.net\/web-api\/overview\/getting-started-with-aspnet-web-api\/tutorial-your-first-web-api\">Getting Started with ASP.NET Web API 2<\/a><\/li>\n<li><a target=\"_blank\" href=\"https:\/\/azure.microsoft.com\/en-us\/documentation\/articles\/app-service-mobile-dotnet-backend-how-to-use-server-sdk\/\">Work with the .NET backend server SDK for Azure Mobile Apps<\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h4>Visual Studio 2015 with Update 1 (at least the \u2018Community\u2019 or \u2018Professional\u2019 edition)<\/h4>\n<p>The instructions and screen shots assume you&#8217;re using Visual Studio 2015 with Update 1.<\/p>\n<h4><\/h4>\n<h4>Azure SDK for .NET (VS 2015) 2.8.1<\/h4>\n<p>The instructions and screen shots assume you have installed the Azure SDK for .NET (VS 2015) 2.8.1 or newer version.<\/p>\n<h4>Azure account\/subscription<\/h4>\n<p>You need an Azure account to complete the tutorial. You can:<\/p>\n<ul>\n<li><a href=\"https:\/\/azure.microsoft.com\/pricing\/free-trial\/?WT.mc_id=A261C142F\">Open an Azure account for free<\/a>. You get credits that can be used to try out paid Azure services. Even after the credits are used up, you can keep the account and use free Azure services and features, such as the Web Apps feature in Azure App Service.<\/li>\n<li><a href=\"https:\/\/azure.microsoft.com\/pricing\/member-offers\/msdn-benefits-details\/?WT.mc_id=A261C142F\">Activate Visual Studio subscriber benefits<\/a>. Your MSDN subscription gives you credits every month that you can use for paid Azure services.<\/li>\n<\/ul>\n<h4><\/h4>\n<h4>Prerequisites to get started with PowerApps Enterprise (IMPORTANT)<\/h4>\n<p>As of December of 2015 you need to:<\/p>\n<ul>\n<li>Sign up for <a href=\"https:\/\/azure.microsoft.com\/en-us\/documentation\/articles\/powerapps-get-started-azure-portal\/\">PowerApps Enterprise<\/a><\/li>\n<li>Create an <a href=\"https:\/\/azure.microsoft.com\/en-us\/documentation\/articles\/powerapps-get-started-azure-portal\/\">app service environment<\/a><\/li>\n<\/ul>\n<p>In order to work with PowerApps, you need to have <strong>PowerApps Enterprise<\/strong> support in your Azure subscription. As of today (December 2015) you need to join the PowerApps Preview program for that. You can get more info about it in the links above.<\/p>\n<h2>Disclaimer<\/h2>\n<p>Take into account that the following steps that I describe in the blog post are what you need to do today, December 2015, when PowerApps is still in PREVIEW state. It might change and get simpler in the future.<\/p>\n<h2>Initial scenario to evolve \u2013 The HealthClinic.biz services and apps<\/h2>\n<p>A useful case would be to start with the sample apps and services from the new <strong><a target=\"_blank\" href=\"http:\/\/blogs.msdn.com\/b\/visualstudio\/archive\/2015\/12\/08\/connect-demos-2015-healthclinic-biz.aspx\">HealthCLinic.biz<\/a><\/strong> scenario that we created for <a target=\"_blank\" href=\"https:\/\/channel9.msdn.com\/Events\/Visual-Studio\/Connect-event-2015\/\">Connect() 2015<\/a>.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/1727.image_10D809D2.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/8306.image_thumb_296A37D3.png\" width=\"733\" height=\"350\" \/><\/a><\/p>\n<p>In my initial scenario, I have the <a target=\"_blank\" href=\"http:\/\/blogs.msdn.com\/b\/visualstudio\/archive\/2015\/12\/08\/connect-demos-2015-healthclinic-biz.aspx\">HealthClinic<\/a> services and apps that we published in <a target=\"_blank\" href=\"https:\/\/github.com\/Microsoft\/HealthClinic.biz\/\">GitHub-HealthClinic-Repo<\/a>, shown in the simplified architecture with the diagram below.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/0677.image_16B53E1C.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/1715.image_thumb_54B15F8B.png\" width=\"737\" height=\"410\" \/><\/a><\/p>\n<p>Specifically, I want to focus on the <strong>Azure Mobile App<\/strong> services that are consumed by the <strong>Cordova app<\/strong> (the two yellow highlighted assets in the diagram), but I\u2019d like to publish\/register the same services as \u2018PowerApps services\u2019 so I could re-use them from <strong>PowerApps<\/strong> client apps. That way, anyone in the enterprise could create simple data-driven apps related to the Doctors data, in this case.<\/p>\n<p>You can see below another simplified diagram focusing just on the new scenario I\u2019m chasing.<\/p>\n<p>Note that I\u2019m highlighting the Cordova app because I\u2019m migrating the Azure Mobile App service and the Cordova app is the one using it. In HealthClinic.biz, the Xamarin apps (native apps) are consuming the other ASP.NET 5 WebAPI services deployed as Azure Web App, just because we wanted to have that additional scenario. So, for this case, it doesn\u2019t matter if you want to use Cordova or Xamarin as client apps as I\u2019m focusing just on the cloud side, publishing an Azure Mobile App service as PowerApps Managed API in Azure.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/2818.image_3B495C51.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/1033.image_thumb_63E7C858.png\" width=\"804\" height=\"454\" \/><\/a><\/p>\n<p>Basically I need to do two main things in order to publish my Azure Mobile App to a PowerApps \u201cIT Managed API\u201d:<\/p>\n<p><strong>1. Publish\/register my original Azure Mobile App service as a new PowerApps \u2018IT Managed API\u2019 with the required connections.<\/strong><\/p>\n<p><strong>2. Test my new published PowerApps \u2018IT Managed API\u2019 from the PowerApps \u2018Authoring Tool\u2019 and create any simple PowerApp.<\/strong><\/p>\n<p>But in order to be able to register an original Azure Mobile App service as a PowerApps Managed API you need to actually do a few things in your service\u2019s code:<\/p>\n<p><strong>1.1. Swaggerize the service.<\/strong> We need to have Swagger metadata wrapping our service so PowerApps can \u201ctalk to it\u201d, \u201cunderstands\u201d what it is about and can be discoverable from PowerApps. That will require some easy code changes in our Web API Azure Mobile App project.<\/p>\n<p><strong>1.2. Deploy the service into the PowerApp Environment in Azure<\/strong>. This step is easy and will be done through the Azure portal, as I\u2019ll show you.<\/p>\n<p><strong>1.3. Create an \u2018IT Managed API\u2019 in the PowerApps Environment in Azure that wraps-out my backend service. <\/strong>Simply by registering my Azure Mobile Service as IT Managed API in the PowerApps environment. Then granting access to the specific Active Directory users.<\/p>\n<p>So, let\u2019s see in detail the steps I needed to perform.<\/p>\n<h2>1. Publish\/register my original Azure Mobile App service as a new PowerApps \u2018IT Managed API\u2019 with the required connections.<\/h2>\n<p>As mentioned, this action will require a few steps. It is very easy when you know it, but it can take some time if you don\u2019t know about <strong>Swagger<\/strong> and <strong>PowerApps<\/strong>.<\/p>\n<h2>1.1. Swaggerize the Azure Mobile App service from HealthClinic.biz<\/h2>\n<p>First things first. <strong>What is Swagger?<\/strong> As mentioned, <a target=\"_blank\" href=\"http:\/\/swagger.io\/\">Swagger<\/a> is a very popular RESTful API description metadata so services can be discoverable from the outside and it is basically what <strong>Azure API Apps<\/strong>, <strong>Azure Logic Apps<\/strong> and now <strong>PowerApps<\/strong> use to understand how to use services\/APIs and connect to it.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/6013.image_5AA7EE08.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/3386.image_thumb_28441A89.png\" width=\"311\" height=\"169\" \/><\/a><\/p>\n<p>You could manually create a Swagger file that would map all your service\u2019s operations and then just upload that Swagger file to the PowerApps definitions in Azure, like described in this article <a target=\"_blank\" href=\"https:\/\/azure.microsoft.com\/en-us\/documentation\/articles\/powerapps-register-existing-api-from-api-definition\/\">Register an API from Swagger 2.0 API Definition<\/a>. The thing is that registering an API with an existing Swagger file is very easy, but what is not so easy\/simple is to generate a Swagger file manually. That would be a lot of JSON code written manually and testing to make sure it is mapped right\u2026<\/p>\n<p>So, how can that be done much easier? With <strong>Swashbuckle<\/strong>!<\/p>\n<p><a target=\"_blank\" href=\"https:\/\/github.com\/domaindrivendev\/Swashbuckle\">Swashbuckle<\/a> is seamlessly and automatically adds Swagger metadata to ASP.NET WebApi projects. It could be a plain WebAPI project or Azure API App or even an Azure Mobile App project which is my case! It combines ApiExplorer and Swagger\/swagger-ui to provide a rich discovery and documentation to your API consumers.<\/p>\n<p>In addition to its Swagger generator (internally it works by using .NET Reflection to generate the Swagger schema describing your API types), Swashbuckle also contains an embedded version of swagger-ui which it will automatically serve up once Swashbuckle is installed.<\/p>\n<p>You can see further info in GitHub at the <a target=\"_blank\" href=\"https:\/\/github.com\/domaindrivendev\/Swashbuckle\">Swashbuckle<\/a> page.<\/p>\n<p><strong>Swashbuckle <\/strong>is just basically made by two Nuget packages &#8211; the Core library (<strong>Swashbuckle.Core<\/strong>) and a convenience package (<strong>Swashbuckle<\/strong>) &#8211; that provides automatic bootstrapping. The latter is only applicable to regular IIS hosted Web APIs. For all other hosting environments (which is my case as an Azure Mobile App service does not use IIS), you should only install the Core library.<\/p>\n<p>So, you can open the <strong>Azure Mobile App<\/strong> service from <strong>HealthClinic.biz<\/strong> with the solution called <strong>06_Demos_MobileApp.sln<\/strong> which opens the project called <strong>MyHealth.MobileApp<\/strong>:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/2845.image_0C863460.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;margin: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/1651.image_thumb_7A3D6D9D.png\" width=\"244\" height=\"241\" \/><\/a><\/p>\n<p>This project is a typical <strong>Azure Mobile App<\/strong> service that you can deploy to <strong>Azure App Service<\/strong> in the cloud. You can also test it locally by just hitting F5 and you\u2019ll see the following page in the browser:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/7484.image_60D56A63.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/0511.image_thumb_755AB9E1.png\" width=\"456\" height=\"358\" \/><\/a><\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p><strong>OPTIONAL: Test the local Mobile App service with the Cordova mobile app from HealthClinic <\/strong><\/p>\n<p><strong>NOTE<\/strong>: In order to have the HealthClinic services up and running you also need to have the SQL Database populated with test-data and running. For that you first need to run, at least once, the ASP.NET 5 project (web app with solution called <strong>01_Demos_ASPNET5.sln<\/strong> and project that you need to run called <strong>MyHealth.Web<\/strong>) which generates de SQL DB either locally (SQL localdb) or in Azure as an Azure SQL Database. Once you have the SQL Connstring to your final database in Azure you have to update that in the conn-string within the Web.config of the Azure Mobile App that we\u2019re using in this walkthrough.<\/p>\n<p>Of course, that page above from the Mobile App service doesn\u2019t tell you anything, but you can test this specific Azure Mobile App from the Apache Cordova app that we built as part of the HealthClinic suite. So, if I open the solution called \u201c\u201d and I double click the file <strong>configService.ts<\/strong> I can change the URL that the Cordova app is going to consume, in this case, the following code updating the URL to the same URL where my Mobile App service is running locally that you see in the browser above:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/5047.image_69C4FCA2.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/5140.image_thumb_577C35E0.png\" width=\"287\" height=\"201\" \/><\/a>\u00a0 <a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/5852.image_6C01855E.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/1565.image_thumb_59B8BE9C.png\" width=\"533\" height=\"198\" \/><\/a><\/p>\n<p>If you have all the different parts (SQL db, conn-strings and API_URL) running and properly configured, you Cordova app could run like the following app in the Android browser, with sample data:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/3286.image_0E591AD8.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/6232.image_thumb_7BA42120.png\" width=\"204\" height=\"403\" \/><\/a><\/p>\n<p>Cool, so I tested that my service is working properly before advancing and doing anything with Swashbuckle.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>The point is that I\u2019d like to check that the Mobile App service is running properly without having to check it from the client Cordova app. That is another reason why Swashbuckle is pretty convenient!<\/p>\n<p><strong>Swashbuckle\u2019s setup in your Azure Mobile App service project<\/strong><\/p>\n<p>Since Azure Mobile App service projects use OWIN (therefore the <strong>MyHealth.MobileApp <\/strong>project), we just need to install the Swashbuckle\u2019s Core library through \u2018<strong>Manage NuGet packages<\/strong>\u2018 in <strong>References<\/strong> or by typing the following within the \u2018Package Manager Console\u2019 in VS :<\/p>\n<p><strong>Install-Package Swashbuckle.Core<\/strong><\/p>\n<p>Then we need to add some code to enable the Swagger under OWIN\u2019s infrastructure.<\/p>\n<p>This is the code I added to the <strong>Startup.css<\/strong> file:<\/p>\n<p>Add \u201cusings\u201d for Swashbuckle and Json serialization:<\/p>\n<table cellspacing=\"0\" cellpadding=\"2\" width=\"796\" border=\"0\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"794\"><span style=\"font-family: 'Lucida Console';font-size: xx-small\">using Swashbuckle.Application;\nusing Swashbuckle.Swagger;\nusing Newtonsoft.Json.Serialization;<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Add additional \u201cusings\u201d you\u2019ll need for the filter-classes:<\/p>\n<table cellspacing=\"0\" cellpadding=\"2\" width=\"796\" border=\"0\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"794\"><span style=\"font-family: 'Lucida Console';font-size: xx-small\">using System.Web.Http.Description;\nusing System.Globalization;\nusing System.Linq;<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Then add support for docs and swagger-ui by invoking the extension methods (in namespace Swashbuckle.Application) on an instance of HttpConfiguration in Startup.cs. Check the code in bold below:<\/p>\n<table cellspacing=\"0\" cellpadding=\"2\" width=\"862\" border=\"0\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"860\"><span style=\"font-family: 'Lucida Console';font-size: xx-small\">public class Startup\n{\npublic void Configuration(IAppBuilder app)\n{\nHttpConfiguration config = new HttpConfiguration();<\/span><\/p>\n<p><span style=\"font-family: 'Lucida Console';font-size: xx-small\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ Set the Json serializer to CamelCase explicetely so Swashbuckle takes into account and swagger schema is consistent with Json.<\/span><\/p>\n<p><span style=\"font-family: 'Lucida Console';font-size: xx-small\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();<\/span><\/p>\n<p><span style=\"font-family: 'Lucida Console';font-size: xx-small\">\u00a0\u00a0 <\/span><span style=\"font-family: 'Lucida Console';font-size: xx-small\">\n<\/span><strong><span style=\"font-family: 'Lucida Console';font-size: xx-small\">config\n.EnableSwagger(c =&gt;\n{\nc.SingleApiVersion(&#8220;v1&#8221;, &#8220;MyHealth.MobileApp&#8221;);\n\/\/ Set filter to eliminate duplicate operation ids from being generated\n\/\/ when there are multiple operations with the same verb in the API.\nc.OperationFilter&lt;IncludeParameterNamesInOperationIdFilter&gt;();<\/span><\/strong><\/p>\n<p><strong><span style=\"font-family: 'Lucida Console';font-size: xx-small\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ Set another filter to eliminate duplication operation ids from being generated\n\/\/ when there are multiple Web API routes, like \/tables and \/api\nc.OperationFilter&lt;IncludeRouteNameInOperationIdFilter&gt;();\n}\n)<\/span><\/strong><strong><span style=\"font-family: 'Lucida Console';font-size: xx-small\">\n.EnableSwaggerUi();<\/span><\/strong><\/p>\n<p><strong><span style=\"font-family: 'Lucida Console';font-size: xx-small\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/Other code related to Owin and Web API<\/span><\/strong><\/p>\n<p><strong><span style=\"font-family: 'Lucida Console';font-size: xx-small\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/\u2026\u2026<\/span><\/strong><\/p>\n<p><span style=\"font-family: 'Lucida Console';font-size: xx-small\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 new MobileAppConfiguration()\n.UseDefaultConfiguration()\n.ApplyTo(config);<\/span><\/p>\n<p><span style=\"font-family: 'Lucida Console';font-size: xx-small\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 app.UseWebApi(config);<\/p>\n<p>}\n}<\/span><strong><\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>As you can see in that code, I had to apply two custom filters when generating the Swagger metadata.<\/p>\n<p>&#8211; <strong>One filter<\/strong> to <strong>eliminate duplicate operation ids from being generated when there are multiple operations with the same verb in the API<\/strong>. This filter is the same filter that is also applied in regular Azure API apps created with the Visual Studio and Azure SDK templates. This filter is defined in the following class placed after the Startup class code:<\/p>\n<table cellspacing=\"0\" cellpadding=\"2\" width=\"862\" border=\"0\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"860\"><span style=\"font-family: 'Lucida Console'\">internal class <strong>IncludeParameterNamesInOperationIdFilter<\/strong> : IOperationFilter\n{\npublic void Apply(Operation operation, SchemaRegistry schemaRegistry, ApiDescription apiDescription)\n{\nif (operation.parameters != null)\n{\n\/\/ Select the capitalized parameter names\nvar parameters = operation.parameters.Select(\np =&gt; CultureInfo.InvariantCulture.TextInfo.ToTitleCase(p.name));<\/span><\/p>\n<p><span style=\"font-family: 'Lucida Console'\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ Set the operation id to match the format &#8220;OperationByParam1AndParam2&#8221;\noperation.operationId = string.Format(\n&#8220;{0}By{1}&#8221;,\noperation.operationId,\nstring.Join(&#8220;And&#8221;, parameters));\n}\n}\n}<strong><\/strong><\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&#8211; <strong>A second filter<\/strong> that I created <strong>to eliminate duplication operation ids from being generated when there are multiple Web API routes<\/strong>, like <strong>\/tables<\/strong> and <strong>\/api. <\/strong>This issue only happens in Azure Mobile App services and Azure Mobile Services as they have the additional route called \u201c<strong>\/tables<\/strong>\u201d. A plain WebAPI project would usually have just the \/api route.<\/p>\n<p>This happens because at this time, <strong>Swashbuckle<\/strong> is generating duplicated operationIds when it finds several WebAPI routes in your code when using reflection.<\/p>\n<p>In fact, it will be generating 2 operationIds per method in the controller, one per base Web API route, because Azure MobileApps has internally two routes, <b>\/tables<\/b> and <b>\/api <\/b>like:<\/p>\n<p>a. \/tables\/Doctor\/{id}<\/p>\n<p>b. \/api\/Doctor\/{id}<\/p>\n<p>Therefore, <b>Swashbuckle<\/b> will be generating the same operation id name for <b>both base Web API routes<\/b>.<\/p>\n<p>So, my workaround is to change the name of each operation in Swagger by extending it with its current Web API route.<\/p>\n<table cellspacing=\"0\" cellpadding=\"2\" width=\"862\" border=\"0\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"860\"><span style=\"font-family: 'Lucida Console'\">internal class <strong>IncludeRouteNameInOperationIdFilter<\/strong> : IOperationFilter\n{\npublic void Apply(Operation operation, SchemaRegistry schemaRegistry, ApiDescription apiDescription)\n{<\/p>\n<p>\/\/Find current Route name\nstring routeTemplate = apiDescription.Route.RouteTemplate;\nstring BaseRouteName = routeTemplate.Substring(0, routeTemplate.IndexOf(&#8216;\/&#8217;));\nstring postfix = &#8220;_&#8221; + BaseRouteName + &#8220;_Route&#8221;;<\/span><\/p>\n<p><span style=\"font-family: 'Lucida Console'\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ Set the operation id to match the format &#8220;OperationThroughRouteName&#8221;\noperation.operationId = string.Format(\n&#8220;{0}_Through{1}&#8221;,\noperation.operationId,\npostfix);<\/span><\/p>\n<p><span style=\"font-family: 'Lucida Console'\">\u00a0\u00a0\u00a0 }\n}\n<\/span><\/p>\n<p><strong><\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>If you don\u2019t add that second filter, further in the process (almost at the end of this blog post) you\u2019d get errors when trying to publish\/register your service in Azure as an IT Managed API. You would get the following error:<\/p>\n<p><b>\u201cCreating API HealthClinicMobileAppManagedAPI failed: One or more fields contain incorrect values:\u201d Like the error below.<\/b><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/3250.clip_image002_292540E4.jpg\"><img decoding=\"async\" title=\"clip_image002\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"clip_image002\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/3678.clip_image002_thumb_0FBD3DAA.jpg\" width=\"837\" height=\"368\" \/><\/a><\/p>\n<p>If you have that issue, you can confirm it when trying to <strong>validate your Swagger schema<\/strong> with <a href=\"http:\/\/editor.swagger.io\/\">http:\/\/editor.swagger.io\/<\/a> and providing the URL to your generated Swagger, like <a href=\"http:\/\/myserver:port\/swagger\/docs\/v1\" title=\"http:\/\/localhost:35715\/swagger\/docs\/v1\">http:\/\/myserver:port\/swagger\/docs\/v1<\/a> (see below more info about the Swagger URL), as it will show errors related to duplicated operationIds.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/5658.clip_image001_3FE7191E.jpg\"><img decoding=\"async\" title=\"clip_image001\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"clip_image001\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/6786.clip_image001_thumb_2D321F67.jpg\" width=\"844\" height=\"207\" \/><\/a><\/p>\n<p>You can see that in that case, <b>Swashbuckle<\/b> was generating 2 operations per each controller, one based on <b>\/tables<\/b> and the second based on <b>\/api<\/b>, but they are essentially the same methods in each controller<\/p>\n<p>So, to avoid that, set that filter second that I created or you could create another workaround to avoid duplicated operation names in the generated Swagger.<\/p>\n<p>&#8211; <strong>IMPORTANT:<\/strong> <strong>Explicitly set the json data contract serializer to CamelCase in your code<\/strong> in order to have consistent Swagger schema and Json data coming from your service. If you don\u2019t set this right, the <strong>PowerApps Authoring tool<\/strong> won\u2019t work properly when consuming your service.<\/p>\n<p>The issue is that the <b><u>default<\/u> JSON data contract serialization<\/b> used by an Azure Mobile App or Web API project with Newtonsoft.Json\u00a0 is CamelCase, so it will be lowering the first letter of each field\/property in your Json when returning data through the network. That is a right approach because usually when using JSON (especially when consuming it from <b>JavaScript<\/b>) it\u2019s common to use CamelCase. Something like \u201c<strong>firstName<\/strong>\u201d as a property\/field.<\/p>\n<p>On the other hand, if you don\u2019t specify it explicitly, the default schema generation made by <b>SwashBuckle<\/b> is not consistent with the default serialization made by Web API because <strong>SwashBuckle<\/strong> will generate the field\/property names in the Swagger metadata as you have it in the .NET C# model, which is usually <strong>PascalCase<\/strong>. Something like \u201c<strong>FirstName<\/strong>\u201d as property\/field.<\/p>\n<p>In order to make both serializations consistent (Swagger schema and actual data in JSON coming from your service), you need to explicitly add a line of code to your Web API or Azure MobileApp project and set explicitly the JSON serializer ContratResolver to CamelCase, even when it coincides with the default in Web API which is also CamelCase. But if you set that line explicitly, <b>SwashBuckle<\/b> will take it into account when generating the Swagger schema, too. \ud83d\ude42<\/p>\n<p>So, in your <strong>startup.cs<\/strong> class from my Azure MobileApp project, make sure you add the following line of code right after grabbing the HttpConfiguration object:<\/p>\n<p><span style=\"font-family: 'Lucida Console';font-size: xx-small\">config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new <strong>CamelCasePropertyNamesContractResolver()<\/strong>;<\/span><\/p>\n<p>Now we\u2019ll have something like \u201c<strong>FirstName<\/strong>\u201d or \u201c<strong>address<\/strong>\u201d as fields\/properties in both places (Swagger schema and data in Json).<\/p>\n<p>With that, I have successfully enabled Swashbuckle in my Azure Mobile App and now I\u2019ll have Swagger metadata and Swagger UI created automatically around my service.<\/p>\n<p>We can <strong>check it out by running the service again from VS by hitting F5<\/strong>. We\u2019ll get the same \u201cwelcome page\u201d that we get in every Mobile App service, but if I now add \u201c\/swagger\u201d to the same URL, like:<\/p>\n<p><a href=\"http:\/\/localhost:35715\/swagger\/\" title=\"http:\/\/localhost:35715\/swagger\/\">http:\/\/localhost:35715\/swagger\/<\/a><\/p>\n<p>You can see how nicely I can see now what\u2019s my service about! \ud83d\ude42<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/3034.image_33E528EA.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/5102.image_thumb_6F388EA8.png\" width=\"802\" height=\"376\" \/><\/a><\/p>\n<p>I can open the HomeAppointment operation and check its schema automatically generated by Swashbuckle:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/7356.image_51C63D9C.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/3157.image_thumb_0A70E7AA.png\" width=\"813\" height=\"486\" \/><\/a><\/p>\n<p>Or you can even check the data coming when I run it from this UI tester by pressing the \u201cTry it out\u201d button!<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/2870.image_1EF63728.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/8360.image_thumb_2C5C4A2E.png\" width=\"828\" height=\"526\" \/><\/a><\/p>\n<p>Another thing you need to check is the real Swagger metadata that is being generated. That JSON code is, like I mentioned, being generated automatically by Swashbuckle, and you can grab it by running the URL you see on the top, like:<\/p>\n<p><a href=\"http:\/\/myserver:port\/swagger\/docs\/v1\" title=\"http:\/\/localhost:35715\/swagger\/docs\/v1\">http:\/\/myserver:port\/swagger\/docs\/v1<\/a><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/3581.image_40E199AC.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/6082.image_thumb_4794A32F.png\" width=\"846\" height=\"102\" \/><\/a><\/p>\n<p>In my case, I\u2019m getting this Swagger code:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/7120.image_4E47ACB2.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/2816.image_thumb_77BE7EA3.png\" width=\"836\" height=\"365\" \/><\/a><\/p>\n<p>That is precisely the Swagger metadata that PowerApps needs in order to register your service as a PowerApps IT Managed API!<\/p>\n<p>We are all set!, I have already \u201c<strong>Swaggerized\u201d my Azure Mobile App service.<\/strong><\/p>\n<p>For additional info about <strong>Swagger<\/strong> and <strong>Swashbuckle<\/strong>, check the following articles and sites:<\/p>\n<ul>\n<li><a target=\"_blank\" href=\"https:\/\/azure.microsoft.com\/en-us\/documentation\/articles\/app-service-api-dotnet-swashbuckle-customize\/\">Customize Swashbuckle-generated API definitions<\/a><\/li>\n<li><a target=\"_blank\" href=\"http:\/\/swagger.io\/tools\/\">Swagger Tools<\/a><\/li>\n<\/ul>\n<p>Awesome! Now let\u2019s see how I can deploy my service to Azure\u2019s PowerApp Environment and how to create a new IT Managed PowerApp service\u2026<\/p>\n<h2>1.2. Deploy the Azure Mobile App service into the \u2018PowerApps Environment\u2019 in Azure<\/h2>\n<p>Before getting into the deployment to PowerApps environment in Azure, let me clarify that you could also re-deploy your already swaggerized Mobile App service into your current environment in Azure App Service. Or it could even be deployed in a different cloud or on-premises. This scenario is described in this article <a target=\"_blank\" href=\"https:\/\/azure.microsoft.com\/en-us\/documentation\/articles\/powerapps-register-existing-api-from-api-definition\/\">\u201cRegister an API from Swagger 2.0 API Definition<\/a>\u201d. But if you are able to deploy your backend API\/Service into the same PowerApps Environment it\u2019ll be more cohesive and will have many advantages like having very low latency between your original backend service (i.e. my Azure Mobile App service) and the additional tier of secured Managed APIs provided by PowerApps enterprise. Therefore, my recommended scenario for most cases is to deploy your backend within the same PowerApps environment, although, as mentioned, alternatively it could also be placed in a remote place\/cloud\/datacenter. In other cases it could make sense, too. It depends.. \ud83d\ude09<\/p>\n<p>Ok, so coming back to my scenario, once the backend service is tested locally and you also have your database up and running as an Azure SQL Database, you can deploy the backend service into the \u2018PowerApp Environment\u2019 in Azure.<\/p>\n<p>For that, just go to Azure\u2019s portal. You\u2019d need to have created a PowerApps Environment. You can see how to do that in the \u201dStep 4: Create an app service environment\u201d within the article <a target=\"_blank\" href=\"https:\/\/azure.microsoft.com\/en-us\/documentation\/articles\/powerapps-get-started-azure-portal\/\">What is Microsoft PowerApps enterprise?<\/a>.<\/p>\n<p>In my case, I\u2019m using a subscription where the PowerApps environment is already created for my tenant, so I just go ahead and brows for PowerApps in the Azure portal.<\/p>\n<p><strong>1.<\/strong> Select <strong>Browse<\/strong> in the task bar, then type <em>powerapps<\/em> and click on it:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/6574.image_12F6D7A5.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/7585.image_thumb_32A5B16D.png\" width=\"427\" height=\"581\" \/><\/a><\/p>\n<p><strong>2.<\/strong> I see quite a few services and PowerApps that we have deployed in our current PoewrApps Environment (based on an Azure App Service environment):<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/5025.image_2E2F30A6.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/7288.image_thumb_66D9DAB3.png\" width=\"713\" height=\"734\" \/><\/a><\/p>\n<p>Ok, so as the first step, I want to deploy my Azure Mobile Service into this environment, within the \u201cMobile apps\u201d section you see above.<\/p>\n<p>Then, once I confirm that the Azure Mobile App service is up and running, I\u2019ll \u201cwrap it around\u201d with a PowerApps \u201cIT manages service\u201d as I show in the diagram.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/8015.image_294C7CEA.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/6445.image_thumb_021233B5.png\" width=\"545\" height=\"358\" \/><\/a><\/p>\n<p>For now, let\u2019s do the step highlighted with the #1 circle in the diagram, which means \u201cJust publish the Azure Mobile App in Azure\u201d.<\/p>\n<p><strong>NOTE<\/strong>: Of course, make sure first that you deployed the HealthClinic DB as an Azure SQL Database and that your ConnectionString within the Web.config in the service is pointing to it. Other than that the service won\u2019t work properly and won\u2019t return any data. Like:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/4863.image_16978333.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/8154.image_thumb_044EBC71.png\" width=\"764\" height=\"58\" \/><\/a><\/p>\n<p><strong>3.<\/strong> First, I need to create the \u201cslot\u201d where I\u2019ll deploy my service. With that I mean that I need to create an empty Azure Mobile App service in Azure but created from the PowerApps environment. For doing that, select the \u201c<strong>+ New<\/strong>\u201d from the root dashboard in the Azure portal, then click on \u201c<strong>Web+Mobile<\/strong>\u201d, then on \u201c<strong>Mobile App<\/strong>\u201d, and finally set the name of your Mobile App to a meaningful name like \u201c<strong>HealthClinicMobileAppServiceBackend<\/strong>\u201d.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/1667.image_7205F5AE.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/8547.image_thumb_3882E5B7.png\" width=\"826\" height=\"562\" \/><\/a><\/p>\n<p><strong>4.<\/strong> After creating your Mobile App, kind of \u201cempty slot\u201d as we still didn\u2019t deploy anything, you should be able to see it from the PowerApps environment:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/8535.image_08C7CDE9.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/2577.image_thumb_6F5FCAAE.png\" width=\"840\" height=\"422\" \/><\/a><\/p>\n<p>Now that we have the Mobile App, let\u2019s deploy our code\/project!<\/p>\n<p><strong>5.<\/strong> The easiest way to deploy an Azure Mobile App service to Azure is from Visual Studio, so having the project \u201c<strong>MyHealth.MobileApp<\/strong>\u201d opened in VS, just right-click on the project and select the \u201cPublish\u201d menu option.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/3683.image_35DCBAB7.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/4721.image_thumb_75A6A13C.png\" width=\"578\" height=\"291\" \/><\/a><\/p>\n<p><strong>6.<\/strong> You\u2019ll get the new assistant for Azure App Service that comes in the latest Azure SDK (I\u2019m using <strong>Azure SDK for .NET (VS 2015) 2.8.1<\/strong> released on late November 2015) where the deployment for Azure Web apps, Mobile Apps or API Apps are finally unified under \u201cMicrosoft Azure App Service\u201d.<\/p>\n<p>Click on \u201c<strong>Microsoft Azure App Service<\/strong>\u201d under \u201c<strong>Select a publish target<\/strong>\u201d:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/6835.image_71302075.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/8585.image_thumb_5EE759B3.png\" width=\"506\" height=\"399\" \/><\/a><\/p>\n<p><strong>7.<\/strong> You\u2019ll see a new dialog from the SDK where you can select the right Azure Subscription and filter by asset\u2019s type. So I filter by type (Mobile App) and then I select the just created Mobile App, like you see below:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/4263.image_7E96337B.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/7823.image_thumb_00D2BC38.png\" width=\"644\" height=\"484\" \/><\/a><\/p>\n<p><strong>8.<\/strong> After that, just press the \u201cOK\u201d button and it should go to the next step where you already will have a new Profile created for you and with all the credentials needed for that obtained from Azure because you should have been authenticated against Azure from Visual Studio previously so you are all set, underneath.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/1104.image_20819600.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/2086.image_thumb_62F43836.png\" width=\"711\" height=\"564\" \/><\/a><\/p>\n<p><strong>9. <\/strong>At this point you can click on \u201cpublish\u201d or click several times on \u201cNext\u201d if you want to see further info. I\u2019ll show all the steps.<\/p>\n<p>I\u2019m selecting the \u201c<strong>Debug<\/strong>\u201d configuration just in case I need to debug remotely:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/8865.image_5E7DB76F.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/5238.image_thumb_09561B82.png\" width=\"625\" height=\"496\" \/><\/a><\/p>\n<p><strong>10.<\/strong> At the end of the wizard you can either start a Preview or just go ahead and Publish. Hit the \u201cPublish\u201d button:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/2117.image_04DF9ABB.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/2438.image_thumb_208426B1.png\" width=\"621\" height=\"492\" \/><\/a><\/p>\n<p><strong>11.<\/strong> Then open the \u201c<strong>Azure App Service Activity<\/strong>\u201d and check how it is advancing with the deployment:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/6254.image_592ED0BE.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/2538.image_thumb_54B84FF7.png\" width=\"818\" height=\"174\" \/><\/a><\/p>\n<p><strong>12.<\/strong> When it is done, it\u2019ll open a browser with the default page for the Mobile App service :<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/7380.image_22547C78.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/4113.image_thumb_5AFF2685.png\" width=\"740\" height=\"387\" \/><\/a><\/p>\n<p><strong>13.<\/strong> But because we already \u201cswaggerized\u201d our service, we can test it out in the cloud right away! \u2013 Just write \u201c\/swagger\u201d at the end of the URL, like the following and you\u2019ll see our schema and could do the same testing steps we did before, but this time everything is running in Azure\u2019s cloud!<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/1805.image_6F847603.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/6278.image_thumb_0409C582.png\" width=\"840\" height=\"499\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><strong>14. IMPORTANT step \u2013 Set the Swagger URL into the Mobile App \u201cAPI Definition\u201d property<\/strong>: <u>If you miss this step, the PowerApps IT Managed Environment won\u2019t list your service when trying to register it, later on in the process.<\/u><\/p>\n<p>Before registering the service as PowerApps \u2018IT Managed API\u2019, we need to precisely inform\/update in Azure where it can get our Swagger schema from. So, copy the URL pointing to your Swagger schema from the Swagger edit box:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/0207.image_51A5F202.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/7183.image_thumb_3433A0F6.png\" width=\"836\" height=\"105\" \/><\/a><\/p>\n<p>And paste it into the \u201c<strong>API Definition\u201d<\/strong> property within the Azure Mobile App \u201c<strong>Settings<\/strong>&#8220;, nd hit the \u201c<strong>Save<\/strong>\u201d button.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/5141.image_53E27ABE.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/5657.image_thumb_2F50ED3A.png\" width=\"851\" height=\"459\" \/><\/a><\/p>\n<p><strong>15.<\/strong> (OPTIONAL) I can also test the Mobile App service from the client Cordova app by just changing the service URL in the TypeScript file named file <strong>configService.ts <\/strong>that I showed previously. It should work the same way it did locally.<\/p>\n<h2>1.3. Create an \u2018IT Managed API\u2019 in the PowerApps Environment in Azure that wraps-out my Mobile App backend service<\/h2>\n<p>OK, but so far I just published an Azure Mobile App in Azure. There was nothing related to PowerApps Enterprise just yet.<\/p>\n<p>Now, I want to create a PowerApps \u201cIT Managed API\u201d by registering my Mobile App Service within that \u201cwrapper\u201d (in reality, this wrapper is an additional tier of services that will have a new HTTP URL), so out-of-the-box I\u2019ll get the benefits of PowerApps services which is especially centered on security and Azure AD authentication and authorization.<\/p>\n<p><strong>Securing the services<\/strong>: My current HealthClinic service (Azure Mobile App service) doesn\u2019t have any authentication and authorization implemented. But if I had it, I could connect to it from the PowerApps IT Managed API tier by propagating the security context through security tokens. However, what I\u2019m going to have, though, is a secured PowerApps \u201cIT Managed API\u201d tier as Azure AD authentication comes out-of-the-box when using PowerApps enterprise. As you\u2019ll see later on, the PowerApps connections are used by Active Directory users.<\/p>\n<p>So, let\u2019s <strong>create the PowerApps \u201cIT Managed API\u201d by registering my backend service in Azure as I try to illustrate in the image below with the step\/circle #2. <\/strong><\/p>\n<p>It will be pretty simple, it doesn\u2019t require new code or any new implementation.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/3404.image_15E8EA00.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;margin: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/0285.image_thumb_6EAEA0CA.png\" width=\"617\" height=\"405\" \/><\/a><\/p>\n<p>There&#8217;s also an article explaining the process from a generic point of view: <a target=\"_blank\" href=\"https:\/\/azure.microsoft.com\/en-us\/documentation\/articles\/powerapps-register-api-hosted-in-app-service\/\">Register an API hosted in your app service environment<\/a><\/p>\n<p><strong>1.<\/strong> In the Azure portal, select \u201c<strong>Browse<\/strong> \u2013&gt; <strong>PowerApps<\/strong>\u201d, and then click on the \u201c<strong>Manage APIs<\/strong>\u201d section and finally hit on the \u201c<strong>+ Add<\/strong>\u201d menu option:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/2816.image_31214301.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/4848.image_thumb_05707905.png\" width=\"849\" height=\"458\" \/><\/a><\/p>\n<p><strong>2. <\/strong>In \u201c<strong>Create API<\/strong>\u201d, enter the API properties:<\/p>\n<p>In Name, enter a name for your managed API, something like \u201c<strong>HealthClinicMobileAppITManagedAPI<\/strong>\u201d. Notice that the name you enter is included in the runtime URL of the API. Make the name meaningful and unique within your organization.\nIn <strong>Source<\/strong>, select \u201c<strong>From APIs hosted in App Service Environment\u201d<\/strong>:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/8130.image_27C80E7E.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/3872.image_thumb_2E7B1801.png\" width=\"374\" height=\"375\" \/><\/a><\/p>\n<p><strong>3.<\/strong> When selecting that option, the portal will query and show you the available services\/APIs in the same environment that provide Swagger.<\/p>\n<p>If you don\u2019t se your service listed here it is probably because you missed the step above called \u201c<strong>IMPORTANT step \u2013 Set the Swagger URL into the Mobile App \u2018API Definition\u2019 property<\/strong>\u201d\u2026\u00a0 \ud83d\ude09<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/8228.image_151314C7.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/0172.image_thumb_30B7A0BD.png\" width=\"372\" height=\"559\" \/><\/a><\/p>\n<p>Hit OK, and that will trigger the IT Managed API creation by registering my service (HealthClinicMobileAppServiceBackend) as the backend API.<\/p>\n<p>When you register an API, you&#8217;re registering the API to your app service environment. Once in the app service environment, it can be used by other apps within the same app service environment.<\/p>\n<p><strong>4.<\/strong> You should be able to check it out listed in the list of IT Managed APIs, like in the following list:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/0677.image_69624ACA.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/5430.image_thumb_7DE79A48.png\" width=\"874\" height=\"294\" \/><\/a><\/p>\n<p><strong>5.<\/strong> You can go further and configure the \u201cManaged API\u201d with additional things like an icon\/logo with a public and full HTTP URL to the image file, etc.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/8032.image_647F970E.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/4212.image_thumb_46A1130D.png\" width=\"832\" height=\"494\" \/><\/a><\/p>\n<p>So now I see my Managed API with a proper icon:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/4705.image_143D3F8E.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/6765.image_thumb_48DD9BC9.png\" width=\"617\" height=\"415\" \/><\/a><\/p>\n<p>There are other important properties per Managed API that you can research, like POLICIES, TAGS, etc. like explained in the article \u201c<a target=\"_blank\" href=\"https:\/\/azure.microsoft.com\/en-us\/documentation\/articles\/powerapps-configure-apis\/\">Update an existing API and its properties<\/a>\u201d but for now we just need to grant access to my user from Azure Active Directory or Active Directory, so I can consume the service from the PowerApps Author Tool.<\/p>\n<p><strong>6.<\/strong> <strong>Give users access to the Managed API<\/strong>. Now that the API is created and added to your app service environment, it&#8217;s time to give users within your company the permissions to use it. In PowerApps, select your Managed API. For example, I\u2019m selecting the \u201c<strong>healthclinicmobileappitmanagedapi<\/strong>\u201d managed API.<\/p>\n<p>Then, select \u201c<strong>API user access\u201d<\/strong> menu option and finally hit the \u201c<strong>+<\/strong>\u201d link.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/1526.image_688C7591.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/3162.image_thumb_7D11C50F.png\" width=\"876\" height=\"320\" \/><\/a><\/p>\n<p><strong>7.<\/strong> In this case, in the blade \u201cAdd Users\u201d\u00a0 I\u2019m adding my own Active Directory user so I can consume this service from the PowerApps Author tool.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/7002.image_3F846746.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/0535.image_thumb_2D3BA084.png\" width=\"318\" height=\"475\" \/><\/a><\/p>\n<p>Just hit the \u201c<strong>Select<\/strong>\u201d button and we\u2019re all set!\u00a0 We\u2019re finally ready to consume this \u201cIT Managed API\u201d from the PowerApp Author Tool! \ud83d\ude42<\/p>\n<h2>2. Test my new registered PowerApps \u2018IT Managed API\u2019 from the PowerApps \u2018Authoring Tool\u2019 and create any simple PowerApp mobile app<\/h2>\n<p>You can read a lot of info and articles about how to create PowerApps, like the tutorials found from here \u201c<a target=\"_blank\" href=\"https:\/\/powerapps.microsoft.com\/en-us\/tutorials\/\">Start creating your apps in PowerApps<\/a>\u201d. Although this type of work will be usually done by Power users rather than developers. But still, we need to test that our services will work for them, right?<\/p>\n<p>For this blog post and because I just want to focus on the developer work you an do when focusing on the Managed API, I\u2019m just going to test the services from the PowerApps Tool, but nothing very fancy.. Actually, this blog post is actually very long.. \ud83d\ude09<\/p>\n<p><strong>Prerequisites<\/strong><\/p>\n<ul>\n<li>Install <a href=\"https:\/\/aka.ms\/powerappsinstall\">PowerApps<\/a> from the Store.<\/li>\n<li>Learn how to <a href=\"https:\/\/powerapps.microsoft.com\/en-us\/tutorials\/get-started-test-drive\/#configure-a-control\">configure a control<\/a> in PowerApps<\/li>\n<\/ul>\n<p><strong>1.<\/strong> Open the PowerApps app and select \u201c<strong>New<\/strong>\u201d \u2013&gt; \u201c<strong>Start from Scratch<\/strong>\u201d.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/7838.image_33EEAA07.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/4336.image_thumb_13676A55.png\" width=\"832\" height=\"598\" \/><\/a><\/p>\n<p><strong>2.<\/strong> Select <strong>File \u2013&gt; Connections \u2013&gt; Available Connections<\/strong> and finally your IT Managed API from the list, in my case \u201c<strong>healthclinicmobileappitmanagedapi<\/strong>\u201d.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/2860.image_6A5F5C09.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/8865.image_thumb_37FB888A.png\" width=\"821\" height=\"430\" \/><\/a><\/p>\n<p><strong>3.<\/strong> Hit the \u201cConnect\u201d button you\u2019ll see on the right panel:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/1070.image_57AA6252.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/1537.image_thumb_177448D8.png\" width=\"249\" height=\"485\" \/><\/a><\/p>\n<p><strong>4.<\/strong> This step has created a PowerApps connection listed now under \u201cMy connections\u201d in PowerApps app:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/4628.image_3318D4CE.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/7220.image_thumb_20D00E0C.png\" width=\"851\" height=\"198\" \/><\/a><\/p>\n<p>But under the covers, it created a PowerApps Connection in Azure. So if you go to the \u201cConnections\u201d in your \u201cIT Managed API\u201d in Azure, you\u2019ll see that connection there with the user and granted rights.<\/p>\n<p>In reality, in PowerApps, it will create a connection per Managed API and user (yes, if you have 50 users for your app, it\u2019ll configure 50 connections), so it can configure user connections in the server\/cloud side, cache tokens, etc. The goal is to make really simple the security configuration in the client side. Anyways, here\u2019s the connection that was just created, in the Azure portal:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/1423.image_1291951C.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/8836.image_thumb_2716E49A.png\" width=\"853\" height=\"273\" \/><\/a><\/p>\n<p><strong>5. Create a Data Source in PowerApps Author Tool. <\/strong>Before being able to access the services, you also need to create a \u201cData Source\u201d.<\/p>\n<p>Select the \u201cData Sources\u201d within the \u201cContent\u201d menu bar:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/1033.image_0C53F236.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/0068.image_thumb_7A0B2B73.png\" width=\"488\" height=\"101\" \/><\/a><\/p>\n<p>Then click on the option \u201cInsert your data\u201d<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/1538.image_52D0E23E.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/0574.image_thumb_278C4B37.png\" width=\"272\" height=\"331\" \/><\/a><\/p>\n<p>After that, you\u2019ll see your Connections, like the following:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/6431.image_675631BC.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/6153.image_thumb_3C119AB5.png\" width=\"334\" height=\"280\" \/><\/a><\/p>\n<p>Hit on your Connection and then on the button named \u201cAdd Data Source\u201d<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/2727.image_5BC0747D.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/3757.image_thumb_028E8ABE.png\" width=\"278\" height=\"67\" \/><\/a><\/p>\n<p>After that, you should be able to access to the data coming all the way down from the PowerApps Managed API to the client controls, like the Gallery control that I\u2019m using below.<\/p>\n<p><strong>6.<\/strong> <strong>Insert a \u201cGallery\u201d with data coming from our \u201cPowerApps IT managed API<\/strong>\u201d. Now, go to PowerApps and click on \u201cInsert \u2013&gt; Gallery\u201d:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/1586.image_508DB68B.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/2330.image_thumb_424F3D9B.png\" width=\"865\" height=\"104\" \/><\/a><\/p>\n<p>Then select the \u201cPortrait\u201d gallery that would be suitable for a mobile device:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/4544.image_76EF99D6.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/0702.image_thumb_64A6D314.png\" width=\"369\" height=\"429\" \/><\/a><\/p>\n<p>You will have something like the following design with some test data:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/2577.image_19472F50.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/2376.image_thumb_7FDF2C15.png\" width=\"727\" height=\"576\" \/><\/a><\/p>\n<p><strong>6. Set the connection link from the control. <\/strong>Now we just need to set the connection so we access our Managed API.<\/p>\n<p>Click on the \u201cfunction edit box\u201d where it has now written \u201cTextualGallerySample\u201d and change that text to the name of your connection, something like<\/p>\n<p>healthclinicmobileappmanagedapi!<\/p>\n<p>You\u2019ll see that when writing the ! symbol, you\u2019ll get all the operations available for that connection\/service. That is precisely coming from the Swagger schema.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/3482.image_667728DB.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/5025.image_thumb_542E6219.png\" width=\"850\" height=\"78\" \/><\/a><\/p>\n<p>I can select for instance the operation named \u201cDoctorGetAllDoctorsThroughTablesRoute\u201d and then if you write \u201c()\u201d at the end and yet another \u201c!\u201d you\u2019ll see all the possible fields\/properties from the data that will be coming back:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/5164.image_5AE16B9C.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/3060.image_thumb_1AAB5222.png\" width=\"811\" height=\"189\" \/><\/a><\/p>\n<p>For now, just select\/type the call to the whole operation: \u201c<strong>healthclinicmobileappmanagedapi!DoctorGetAllDoctorsThroughtablesRoute()<\/strong>\u201d.<\/p>\n<p><strong>7. Configure the fields so you show the data you want in a proper way.<\/strong><\/p>\n<p>If you change the list item to show the field \u201cname\u201d then you see we\u2019re getting the names of the Doctors.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/8422.image_0BEA4FF2.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/6470.image_thumb_1DC6E3BF.png\" width=\"744\" height=\"241\" \/><\/a><\/p>\n<p>It is cool that even in design mode we can see the data coming all the way down and being showed in the controls after playing just a few seconds with it and adding a few more fields to the gallery:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/1541.image_7935563A.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/4152.image_thumb_66EC8F78.png\" width=\"606\" height=\"573\" \/><\/a><\/p>\n<p><strong>8. Run the PowerApp!<\/strong><\/p>\n<p>Finally, you can run the app by hitting the \u201cplay\u201d button or hitting the F5 key:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/7801.image_069B6941.png\"><img decoding=\"async\" title=\"image\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/8484.image_thumb_490E0B77.png\" width=\"377\" height=\"596\" \/><\/a><\/p>\n<p>Here you have a fancier PowerApp so you get a glimpse of what can be done if you are a better visual designer than me!\u00a0 \ud83d\ude09<\/p>\n<p>Notice that the PowerApps client apps are cross-platform, so it could run on any device (<strong>iOS<\/strong>, <strong>Android<\/strong> or <strong>Windows<\/strong>).<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/tctechcrunch2011.files.wordpress.com\/2015\/11\/powerapps-on-any-device.png?w=738\" \/><\/p>\n<p>What else? well , go to the\u00a0 PowerApps site (<a href=\"https:\/\/powerapps.microsoft.com\/en-us\/tutorials\/get-started-test-drive\/\" title=\"https:\/\/powerapps.microsoft.com\/en-us\/tutorials\/get-started-test-drive\/\">https:\/\/powerapps.microsoft.com\/en-us\/tutorials\/get-started-test-drive\/<\/a>) and learn how to create more compelling apps than this super simple app that I just created! <img decoding=\"async\" class=\"wlEmoticon wlEmoticon-winkingsmile\" style=\"border-style: none\" alt=\"Winking smile\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/84\/75\/metablogapi\/5516.wlEmoticon-winkingsmile_037FD7A4.png\" \/><\/p>\n<p>If you send me feedback through my blog, I\u2019ll forward it to the PowerApps team, as my focus is not really PowerApps \u201cper se\u201d but the developer work from Visual Studio and Microsoft Azure.<\/p>\n<p>Have fun! <img decoding=\"async\" class=\"wlEmoticon wlEmoticon-smile\" style=\"border-style: none\" alt=\"Smile\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/32\/2019\/03\/7446.wlEmoticon-smile_5A77C958.png\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Intro to \u201cPowerApps Enterprise\u201d You may have heard of Microsoft PowerApps and \u2018PowerApps Enterprise\u2019. Its code-name was \u201cProject Kratos\u201d and part of it is deriving from the original \u201cProject Siena\u201d. But in PowerApps, the client PowerApps are cross-platform (iOS, Android and Windows) as they are internally based on Apache Cordova. However, \u201cPowerApps Enterprise\u201d is [&hellip;]<\/p>\n","protected":false},"author":362,"featured_media":12806,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25,29,78,95],"class_list":["post-3971","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cesardelatorre","tag-azure-app-service","tag-azure-mobile-app","tag-powerapps","tag-swagger"],"acf":[],"blog_post_summary":"<p>&nbsp; Intro to \u201cPowerApps Enterprise\u201d You may have heard of Microsoft PowerApps and \u2018PowerApps Enterprise\u2019. Its code-name was \u201cProject Kratos\u201d and part of it is deriving from the original \u201cProject Siena\u201d. But in PowerApps, the client PowerApps are cross-platform (iOS, Android and Windows) as they are internally based on Apache Cordova. However, \u201cPowerApps Enterprise\u201d is [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/posts\/3971","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/users\/362"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/comments?post=3971"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/posts\/3971\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/media\/12806"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/media?parent=3971"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/categories?post=3971"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cesardelatorre\/wp-json\/wp\/v2\/tags?post=3971"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}