In this blog, I will be showing you how to create a function app in Azure, use Visual Studio to create/write the function app code with https trigger, publish the app code to azure through Visual Studio. Furthermore, I will be pushing the app files to GitHub from Visual Studio and formatting the Readme.
Contents
• Create Function App in Azure
• Create Function App Code and Publish to Azure
• Publish the code to Azure
• Testing the App by doing some Calculation
• Pushing Function App Files to GitHub from Visual Studio
• Formatting Readme
Create Function App in Azure
a. Search for a function app in the search bar and select function app as seen below.
b. On the basic page adopt the below project details as specified in the following “Function App name- JoeCalculator”,
On the hosting page, Select Window OS and Consumption Plan (serverless hosting where you only pay when app runs), seen below.
c. Choose default settings for Networking, Monitoring, Deployment and Tag. Under Deployment, the GitHub is disable so I will be creating a new GitHub repo from visual studio.
d. Select "Review + create" to review the app configuration selections. After validation is passed click create deploy the function app.
e. When deployment is complete, click go to resource.
f. Click function to view your function app, this is where you will create your function app or where your function app will be after creating it. I will not create it here, I will be creating it in visual studio, then push it here.
Create Function App Code and Publish to Azure
a. Open visual studio, create a new project, select azure function, and click next.
b. Give your project a name and click next.
c. Select .NET 6, choose http trigger and click create.
d. Edit your code in visual studio environment as shown below. Replace the class “function1” and function attribute with the “Sum”, delete line 22 to 30 and replace with the code shown in yellow and build the code.
The code was successively built.
Publish the code to Azure
a. Right click JoecalculatorFunc and click publish, then select Azure, and click next.
b. Select Azure function app (windows) and click next.
c. You will need to Login to your Azure account, see the capture below after successfully login in.
d. Expand and select your function app and click finish.
e. Below capture details show the function app is ready to be published.
f. See the capture below After successful publishing.
This is output after successive publishing.
g. From the azure portal, you can see that the function app has been published/deployed.
Testing the App by doing some Calculation
a. Click on the Function App “Sum” and click the “Get Function URL” to copy the App URL.
b. Paste the URL into browser, give “x” and “y” values as shown in the capture and click enter.
c. After the*” two equals to sign”, add *(&=x=230&y=890)** and press enter.
d. The sum of 230 and 890 is 1120, this shows Function App calculation is correct.
Pushing Function App Files to GitHub from Visual Studio
a. Click on git changes by the right bottom side of the VS screen.
b. Select create git repository.
c. The create a Git repo window will appear, enter your repo name and description, uncheck private, and click create and push.
d. After you have succeeded in pushing, the visual studio right side screen will appear as below. This show a new repository has been created.
e. Go to your Github account to confirm if you have successfully created and push your files.
Formatting ReadMe
Top comments (0)