BookmarkSubscribeRSS Feed

How to Create a Decision App with SAS Container Runtime and Microsoft Power Apps

Started ‎12-13-2021 by
Modified ‎12-13-2021 by
Views 4,464

Watch the video where a user, with no coding skills, can call (score) a SAS decision, from an app on his mobile phone. Read the article to understand the integration between Microsoft Power Apps and a SAS decision published to Azure with SAS Container Runtime. The decision is deployed to an Azure Web App and called through a REST API.


A SAS Decision Scored from Microsoft Power Apps



  • Develop and test the decision in SAS Intelligent Decisioning.
  • Publish the decision to Azure as a SAS Container Runtime (SCR) image.
  • Deploy the SCR image to an Azure Web Application.
  • Develop a flow in Microsoft Power Apps.
  • Create the application in Microsoft Power Apps.
  • Publish the application.



The first two steps were explained in detail in How to Publish a Decision to Azure with SAS Container Runtime.


Deploy the SCR image to an Azure Web Application

In your Azure portal, create a Web App. Select Publish > Docker Container:



Select any image to see a larger version.
Mobile users: To view the images, select the "Full" version at the bottom of the page.


Only if you have an App Service plan, select it. Azure App Service plans might be discussed in a future article.


In the Docker tab:





Further, go to Review and Create.


After deployment, the web application URL will be while the SCR REST API will listen on .






Specific to SCR container images, you need to tell Azure on which port the SCR REST API will be listening.


From Settings > Configuration, create a new application setting called WEBSITES_PORT with the value 8080.




From now on, all traffic sent to will be sent through port 8080.  


Develop a flow in Microsoft Power Apps

Note: To complete the following steps, you will require a Premium Power Apps license.


The SCR REST API returns a JSON string. However, Power Apps cannot convert directly the JSON string into data.


One of the possible solutions is to use a flow. The flow collects inputs, passes them to the Azure Web App (SCR runs inside), then it parses the JSON for Microsoft Power Apps:




Go to Power Apps > Flows and create a new flow.


Here, the app runs the flow, which calls an Azure Web App, with a SCR decision inside.


Inputs from the application are expected as strings. You require one Initialize variable step per input.




The HTTP step is calling the SCR REST API, listening inside the Azure Web App at .






The request body is parametrized with the input variables collected.


String inputs from Power Apps must be converted to numeric if the decision expects numeric inputs. Therefore, it is your job to know what data types the decision inputs and outputs are. You have to match or convert them to the expected application input data types.


On a side note, the flow HTTP step and the curl command below will produce the same results:




You can read more about scoring commands in How to Score a SAS Decision Published to Azure with SCR.



The last three steps will convert the response, from a JSON string, into an array, that can be parsed inside Power Apps.


Create the application in Microsoft Power Apps

The application created is deliberately minimalistic. There is one screen for the inputs, the action button and the decision output.



Inputs are collected through text labels, just like in a web form.




Connect the app with the data source

The Power Automate flow becomes the data source.



The action button calling the SCR decision




The button’s OnSelect property is perhaps the most important in this app:

  • Runs the flow with the expected parameters:
  • Creates a collection bidInfo in Power Apps. Then, it populates the table with the data from the flow. The collection is like a table inside the application.
    AutoAuctionFlow.Run(state.Text,Make.Text,Model.Text,CurrentBid.Text,BlueBookPrice.Text,Miles.Text)            );


The decision output

From the collection bidInfo, the bidCommand value is selected and displayed. The label represents the SAS decision output.



Publish the application

When you tested the application sufficiently, you can publish or share the application with other users in your organization.


Download PowerApps from Apple Store and you can use the application you created instantly.



888_8 Power Apps Decision Application communities.jpeg





You can score SAS decisions, or models, from a Microsoft Power Apps application. This approach increases dramatically the audience and the consumption of SAS decisions and models. Microsoft Power Apps provides a low-code development environment. The Microsoft Power Apps application calls the SAS decision published to and running in Azure, through the SAS Container Runtime REST API.

SAS documentation

SAS Communities and YouTube

Thank you for your time reading this article. If you liked the article, give it a thumbs up. Please comment and tell us what you think about the new SCR and Azure publishing destination.


Find more articles from SAS Global Enablement and Learning here.

Version history
Last update:
‎12-13-2021 12:15 AM
Updated by:



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started