In this article, we will see how to create Azure Web API with your Visual Studio Tool.
- Concept
- Implementation – Creating API app in Azure.
- Implementation – Create a sample Web API Application in VS 2015 and publish Web API in Azure.
Concept - About
Azure API makes life easier for developers. They can develop, host, and consume APIs in the cloud whether it's on-premises or off-premises.
Implementation – Creating API app in Azure
- Sign in to Azure Management portal.
- Open Azure portal and click on “+”.
- Click on the Search box and then type API App and hit Enter.
- Click on "Create".
- Fill all the required details and use existing resource group or create new resource group accordingly.
- Click on "Create".
- You can see it’s just created.
Implementation – Creating a sample web API application in VS 2015
Here are the steps.
- Open Visual Studio and create a web project with ASP.NET Web application with the name ViralWebApi app.
- Then, choose Empty Template with Web API checkbox checked as shown below.
- Once you click on OK button, create Web API Empty Controller and name that “HomeController”.
- Click on "Add" button and name it as “Home” Controller.
- Then, write a simple method to return a string from the “Get” method by using HTTPGET Verb action.
- Right click on your project and publish the application on the Azure API App which you just created in the above steps.
- Click on “Publish”, select the existing app which you have just created in the above steps, and then click on OK button and wait until it gets published.
- Select Microsoft Azure App Service and click on "Next" button. Then, select your Azure account and view by the resource group name and select your API which you have created.
- Now, click on OK button and your API app will publish on to Azure.
- Open the browser with the URL to access the API method.
Summary
This is how you can make the Web AP and publish on Azure.