In this demonstration, we are going to create an Azure App Service web app. We are going to deploy a web API from GitHub to Azure using the CLI. Then, we are going to use Azure Cloud Shell for deployment.
Go through the following steps:
- Navigate to the Azure portal by opening https://portal.azure.com/.
- Select the Cloud Shell button from the top-right menu bar in the Azure portal.
- Add the following code to deploy the web API from the GitHub repository. First, set the GitHub repository URL and the web app name:
gitrepo="https://github.com/PacktPublishing/Microsoft-Azure-Architect-Technologies-Exam-Guide-AZ-300/Chapter14/PacktPubToDoAPI"
webappname="PacktPubToDoAPI"
- Create a resource group:
az group create --location eastus --name PacktWebAppResourceGroup
- Create an App Service plan in the free tier:
az appservice plan create --name $webappname --resource-group PacktWebAppResourceGroup --sku FREE
- Create a web app:
az webapp create --name $webappname --resource-group PacktWebAppResourceGroup --plan $webappname
- Deploy the code from the GitHub repository:
az webapp deployment source config --name $webappname --resource-group PacktWebAppResourceGroup
--repo-url $gitrepo --branch master --manual-integration
- Open a browser and add the following URL:
https://packtpubtodoapi.azurewebsites.net/api/ToDo
You will see the following output in the browser:
Output API
Now, we have deployed the web API inside an Azure Web App. In the next section, we are going to create documentation for the API.