Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Monday, August 14, 2017

How to create and test Azure Functions using Azure Portal


Introduction:
Azure Functions is a solution for easily running small pieces of code in the cloud. We can create, execute, and test our custom logic function without creating a VM or web applications and also without needing to install any software or infrastructure to run the function. In this article, you will learn about create and test azure functions using azure Portal
Steps to Create Azure Functions:
Step 1
Navigate to https://functions.azure.com and click on “Login in to your account".
Step 2:
We should be following two ways to create Azure Functions
  • Navigate to https://functions.azure.com and Provide Azure Functions details and create the Azure Functions.
  • Navigate to https://portal.azure.com , Click on New from Azure portal > Web + Mobile >Click on see All or Search > Function App
Step 3: Create Azure Functions App:
Provide the functions App Name and following details for create new functions
  1. App Name – Provide your Unique functions name
  2. Subscriptions – Select your subscription Free or any type
  3. Resource Group -create or select existing resource group name.
  4. Hosting Plan – You can Select default hosting plan as consumption plan, you have to pay only for the time functions code runs.
  5. Location – Select Your nearest location (eg. South Central US).
  6. Storage Account – You can Select or existing storage account.


Step 4:
Click on create and wait for a few minutes to deploy the new Azure Function app.  Expand your new function app and click the + button next to Functions.
Step 5:
After clicking on + button, you will get the following screen, select WebHook + API, choose a language for your function, and click on Create this function.







Step 6: Azure Functions Editor
The .csx file format allows you to write a C# function. Include any assembly references and namespaces at the beginning of the file as usual in C# and write your logic in Run method, just like below.
Step 7:
Run and Test Azure Functions:
You can provide JSON string like the following in the request body and Click on the Run button for test the Azure Functions


Testing in Web Browser:
The web browser is a simple way to trigger functions via HTTP. You can use a browser for GET requests that do not require a body payload, and that use only query string parameters.
To test the function we defined earlier, copy the Function Url from the Azure function portal like below
Append the name parameter to the query string. Use an actual name for the <Enter a name here> placeholder.
https://<Your Function App>.azurewebsites.net/api/<Your Function Name>?code=<your access code>&name=<Enter a name here>, Paste the URL into your browser, and you should get a response similar to the following.
Related Article:
Summary:
In this article, you learned about Azure Functions, how to create and test Azure Functions in Azure Portal.
If you have any questions/ feedback/ issues, please write in the comment box.

Getting Started Azure Functions using Azure Free Trial Account

Introduction:
Azure Function is a solution for easily running small pieces of code in the cloud. Create, Execute and test your custom logic function without creating a VM, Web Applications, and no need install any software and infrastructure to run the function. You can use development language of as per your choice below
  • C#
  • F#
  • Node.js
  • Python
  • PHP  
Pay only for the time your code runs and trust Azure to scale as needed. Azure Functions let you develop server less applications on Microsoft Azure. In this Article, you will learn how to create azure Functions without create Azure account.
How to create an Azure Functions:
Step 1: Navigate to  https://functions.azure.com  and  click on try it For Free
Step 2: Create Azure Premade function.
  • Choose the functions scenario (WebAPI/timer/Processing),
  • Free trail will allow only two language (c# and JavaScript), Select your Language and click on Create the Function.
Step 3: Login with any of following provider without creating azure account.
Step 3: Azure Function Editor
Azure functions Edit was following feature
  1. Microsoft Azure free trial Functions edit will give access only 60 Minutes .
  2. You can edit c# azure function in Run.csx  file as per your requirement
  3. Save the changes
  4. Run the Functions
  5. Get Function URL button will provide the public functions url
  6. View File button for list of file will display
  7. Test button for Test the function
View File Window.
You can Add and upload file using File explore window and system will generate two files functions.json for configuration  and run.csx file for create c# custom method  .
Run.csx File
The .csx file format allows you to writing a C# function. Include any assembly references and namespaces at the beginning of the file as usual in c# and write your logic in Run method as like below
Function.Json File
The function.json file defines the function bindings and other configuration settings. how to pass data into and return data from function execution. The name that is used for the bound data in the function. For C#, this is an argument name; for JavaScript, it's the key in a key/value list.
You can refer the following is an example function.json file.
Test the Function
You can test Azure functions on multiple way, Here I will explain on two ways to Run /test from an Azure Function editor and test with the Browser
You can use to do testing with click on a test button and provide the request body a JSON string similar to the following in the request body field and click on the Run button
.

Test with a Browser  
The web browser is a simple way to trigger functions via HTTP. You can use a browser for GET requests that do not require a body payload, and that use only query string parameters.
To test the function, we defined earlier, copy the Function Url from the Azure function portal like below
Append the name parameter to the query string. Use an actual name for the <Enter a name here> placeholder.
https://<Your Function App>.azurewebsites.net/api/<Your Function Name>?code=<your access code>&name=<Enter a name here>
Paste the URL into your browser, and you should get a response similar to the following.
The Chrome browser will have returned string in XML. Other browsers display just the string value.
Summary
In this article, you learned about Azure functions, how to create Azure functions with create Azure account and test Azure functions  

If you have any questions/ feedback/ issues, please write in the comment box.