This article will give you a basic idea about how to create Azure Function App to run powershell Scripts and return output in required format.
To create a Function App you should have an Azure subscription (Free or Paid).
After logging on to the landing page, go to All Resources or More Services (I selected more services).
Select Function App.
Click on Add, Function App Details
1.
|
Select Subscription: (If you are using free trail the select Free Trial)
|
|
2.
|
Select Resource Group (If already created select Existing or create new one)
|
3.
|
Give name to Function App (In our case I am giving name as “AZPnPSP”
|
4.
|
Select Publish “Code”
|
5.
|
Select Runtime Stack “.NET Core”
|
6.
|
Select Version “3.1”
|
7.
|
Select Region (Region near to your locations)
|
Click on Review + Create. On Review page review all of the information and click on Create.
It will take about 5 minutes for deployment and creation of Function App.
Click on Go to Resource.
Click on Classic Function App Management
First of all we need to update settings of Function App, go to Platform Features then click on Function App Settings.
Set Runtime version to 1, it will take 30-60 seconds to update.
Click on Add New Function then select “create your own custom function”
On thw new Create your own custom function page enable “Experimental Language Support”.
Under HTTP trigger function to select PowerShell language to create new function.
On Create New Function screen specify Function name, Language to PowerShell, Authorization level to “Function”. Click on Create.
Once Function App is created, by default code is available which reads input from body, and print output.
Get Function URL and use it in your application.