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.

Sunday, June 11, 2017

Getting Started Chatbot using Azure Bot Service


Introduction:
The Azure Bot Service is powered by the Microsoft Bot Framework and bot service allows developers to build conversational applications that plug into many popular chat applications including Facebook Messenger, Skype and Office 365, etc. In this article, we can be creating and testing a bot by using the Azure Bot Service.

Create new Bot Service:
Logon to the Azure portal with your registered Azure Microsoft account. If you don’t have azure subscription, you can Create a free trial Azure subscription from Azure portal.
In Azure Portal > click on + Add > Select on Data Analytics
Step 1: Select on new Bot service from data analytics menu
Step 2: You can provide following information for create new bot service
  1. unique App name to your bot’s name. The name is used as the subdomain in azure website (eg DevEnvExeBot.azurewebsites.net).
  2. Select the Azure subscription.
  3. Select the resource group or create new user group.
  4. Select the location. And click on Create button
Step 3: After clicking on Create button, wait a few minutes for the Bot Service to be deployed successfully before proceeding. You will get confirmation notification for after success.
Register Bot Application:
You can click on confirmation notification. then, you will get the following screen where you need to create App ID. This is a prerequisite to authenticating your bot with the bot framework.
Step 1: Click on Create Microsoft App ID and Password
Step 2: App ID and password will generate following screen and click on button for go back to Bot framework
Step 3: Select the Programming language and template for developing bot application
Step 4: Now bot application successfully created and running in the cloud, you can edit code from Azure Develop code editor and also you can manage channels, analytics and setting.

Test Bot Application:
You can click on Test button and provide sample input text.

Summary
In this article, your learned about create and test a bot by using the Azure Bot Service. If you have any questions/ feedback/ issues, please write in the comment box.


Saturday, June 10, 2017

Getting Started Deploy a bot to Azure using Visual studio 2017

Introduction:


The Bot Framework enables you to build bots that support different types of interactions with users. You can design conversations in your bot to be freeform. Your bot can also have more guided interactions where it provides the user choices or actions. The conversation can use simple text strings or more complex rich cards that contain text, images, and action buttons. And you can add natural language interactions, which let your users interact with your bots in a natural and expressive way.
In this article, we can deploy a bot to azure using visual studio 2017, register app with bot portal and testing it with the Bot Framework Emulator.
Setup and Create New Bot Application.
You can read my previous article for Getting Started with Bots Using Visual Studio 2017 from following URL http://www.c-sharpcorner.com/article/getting-started-with-bots-using-visual-studio-2017/
You need azure account for deploy bot application to azure so If you do not have an Azure account, you can click following url for a free trial azure subscription. https://azure.microsoft.com/en-us/free/
Register Bot Application:
Step 1: Navigate to Bot Framework Portal from https://dev.botframework.com/
Step 2: Click on Sign in button and login with credential
Step 3:  Click on Create a Bot or Skill
Step 4: Click on Create a Bot and click on Register
Step 5: Upload relevant app png icon and max size should be 30k
Step 6: Provide your bot's Display Name.
Step 6: Provide a Description of your bot.
Step 7: Provide your bots Https endpoint in configuration section.
  • We are not yet deployed our bot to the cloud so leave the endpoint blank for now. we will return to the Bot Framework Portal later and specify the endpoint after we have deployed our bot.
Step 8: On the next page, click Generate an app password to continue.
Step 9: Copy and securely store the password that is shown, and then click Ok.
Step 10: Click Finish and go back to Bot Framework.
Step 11: Back in the Bot Framework Portal, the App ID field is now populated.
Click 12: Click on Register to complete the registration process.
Update Web Configuration file:
Open your project in Visual Studio and update the Microsoft App Id and Microsoft App Password values in your web configuration settings to specify the app ID and password values that were generated for your bot during the above registration process.
<appSettings>
   <!-- update these with your BotId, Microsoft App Id and your Microsoft App Password-->
   <add key="BotId" value="DevEnvExeBot" />
   <add key="MicrosoftAppId" value="2f3edda3-d36d-4d88-8acf-e448d870348e" />
   <add key="MicrosoftAppPassword" value="L6KOPcc3jqZB6hKPe06yxsH" />
 </appSettings>
Azure publishing wizard:
Step 1: Right click on Project > Select on Publish and start publish bot application into azure
Step 2: Select on Microsoft Azure App Service > select on Create New and click on Publish button
Step 3: Login with Microsoft azure account and click on create app service

Step 4: Copy the Destination URL value to the clipboard (you'll need this value later to test the connection to the bot)
Update Site Url from Bot Portal:
 Step 1: Sign in to the Bot framework Portal - https://dev.botframework.com/
  Step 2: Click My Bots.
 Step 3: Select the bot that you want to configure and click Settings.
 Step 4: Provide your bot's HTTPS endpoint. This is the endpoint where your bot will receive HTTP POST messages from Bot Connector. If you built your bot by using the Bot Builder SDK, the endpoint should end with /api/messages.
Step 5: Click on Save Changes.
Test Bot Application on Portal:
After publish Bot application into azure, you can test bot application from portal and emulator .
Step 1: Sign in to the Bot framework Portal - https://dev.botframework.com/
Step 2: Click on Test and provide input text


Test Bot Application on Emulator:
  1. Open Bot Emulator and Provide your bot's HTTPS endpoint with  api/messages .
  2. Provide Microsoft App ID and Password and click on Connect  
If you are getting following error, Click on Edit Tunneling (ngrok) setting.
download Tunneling (ngrok.exe) from https://ngrok.com/download and click on browse and associate ngrok.exe path
Click on refresh from Bot emulator and provide your input for test application
Download
You can download the complete source code from MSDN sample. 
Summary
In this article, your learned how to Deploy a bot to Azure using Visual studio 2017. If you have any questions/ feedback/ issues, please write in the comment box.