/AzurePractice7-Functions

This repository contains instructions on how to create an Azure Function using the Azure Portal.

Primary LanguagePython

Creating an Azure Function that calculates factorial of n

FunctionsLogo


Requirements

  • Microsoft Azure Account ( with funds or credits )
  • Microsoft Azure Suscription
  • A web browser

Instructions

1. Login to the Azure Portal.

2. Once your on the portal's home page, you will see something like this:

PortalImage

3. Inside the search bar (located at the top), look for Function App and click on it.

Searchbar

4. Click on Create.

CreateFunction

5. You will now have to configure the project details: select your suscription and resource group, in my case, I'll be creating a new resource group.

ProjectDetails

6. Now, you need to conigure the function details. First, give it a name. We'll be using Python code, so make sure to select code. You must also choose the region where your code will be executed.

InstanceDetails

7. Also, you need to choose the operating system and plan for your Function App. I'll be using Linux and Consumption (Serverless).

FunctionDetails

8. You can configure more details about your function if you want at the top side of the page or by clicking next. When you're ready, click Review + create.

ReviewAndCreate

9. If validation passed, click Create.

Create

10. Deployment will begin, please wait a couple of seconds.

DeploymentInProgress

11. Once deployment is complete, click on Go to resource.

GoToResource

12. On the left side of the dashboard, click on Functions.

FunctionsDashboard

13. Click on Create.

CreateFunction

14. You can now choose the development environment where you'll create your function (portal, inside another code editor or VS code), I'll be making my function inside the portal. Then, you'll need to select the trigger for your function, I'll be choosing HTTP trigger because it's what I'll be using.

CreatingFunctionDetails

15. Click Create.

16. Click on Code + Test.

Code+Test

17. You will now be inside a code editor where there will be default Python code; as it is, it's already functional, however, we will be replacing this code with the one inside this repository.

DefaultCode

18. Copy what's inside code.py (located inside this repository) and replace what's in the Azure Portal's editor.

FunctionCode

19. In order to test your code, click on the Test/code button.

Test/code

20. In the body section, put "num": (number you want to calculate).

Body

21. Click Run to test your function.

Run

22. The result of your function will appear on screen.

HTTPResponse


Congratulations ! You've just made your first Azure Function! =)