A Comprehensive Guide to Creating a Function App Calculator, Publishing to Azure Portal, and Pushing to GitHub
Published: 2024-03-23 06:52:20


**Prerequisite**
Download and install Visual Studio Community 2022
Have an existing GitHub Account and of course, an active subscription on your Azure Account.

The first step is to create a function app on your Azure portal. In the search bar, type in FUNCTION APP and click on it
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jo9a7a91f68p3of607wt.PNG)
When it opens, select CREATE and on the basic section, input the right details to proceed

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/14t1aaogw324xakehgrs.PNG)
Choose a resource group, you can instantly create one if you dont already have one.
Give your function app a name as i have done.
Other settings should take replica of my own settings in the image above.
Leave every other settings on the other section as default and proceed to review and create
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k4kq5i2tsuyznw16j44t.PNG)
The resource should begin to deploy. see it through till deployment is complete
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hfwvymwyg7c5c0zqz8dr.PNG)
Your function app is deployed and ready to carry your calculator app
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/20x8f5fs1gh87zrwrwjd.PNG)

**Now lets go to visual studio**
Open your virtual studio application, select new project

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4tuonowj25byaoithjrt.PNG)
Search for App function, select it and click next
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0b7remoyxg7s7rvrh395.PNG)
Give your project a name and click next
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o3ru0jsmuqxfcqccyo4i.PNG)
Leave the next page at default settings.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eqmi5z6wlem0kjmlcgj1.PNG)

Now we are going to edit this set of codes to create our calculator app

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/237rbnex92qz5u9r6pav.PNG)
Edit the function name on line 15 and the public static class line 13 to "Sum". This programming language allows you to calculate the total of a set of numbers.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/34glh3b7wlrqfbz2ecd9.PNG)
Now delete code line 21 till the end.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gl43ll7jp3ac5yd94umj.PNG)
Type the following code from line 22 to replace the deleted codes;
int x = int .Parse(req.Query["x"]);
int y = int.Parse(req.Query["y"]);
int result = x+y;
return new OkObjectResult(result);

Once you are done click on build at the top of the page

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d57x2v5lkw2e6du8oqfd.png)
You should get this result verifying no issues with our build


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5oikekylyuhpfn40a57j.PNG)

Now we will publish our calculator to azure by selecting thr build drop down and select publish.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8ru901szmp3u6lurpduv.png)
Next, click on Azure and click "Next" 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6n3wgu1lfpn482quo3wd.PNG)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aip00me7xfkzz7wjhdwr.PNG)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s87fppumfgu1t7zkgtbz.png)