How to create a Chat Bot in Azure

Click Create new resource link found on the upper left-hand corner of the Azure portal, then select AI + Machine Learning > Web App bot.

create bot

Once you select “Web App bot” , you have to configure it with below fields –

Once you click on Create , your bot will be created .In the Bot Management section, click Test in Web Chat. Azure Bot Service will load the Web Chat control and connect to your bot.

You can download the bot source code as shown below and configure the bot as per your requirements .

How to Deploy a Spring Boot application to Azure

Below are the tools required for this tutorial –

  • Maven
  • Git Client
  • Azure CLI
  • JDK
  • Azure Subscription

Create a Spring boot application

  1. Open a git bash terminal window.
  2. Clone the below sample project into the directory you created by typing git clone https://github.com/AnupBhagwat7/azure-demo-service.git
  3. Change to the directory of the completed project by typing cd azure-demo-service
  4. Build the JAR file using Maven by typing mvn clean package
  5. When the web app has been created, start it by typing mvn spring-boot:run
  6. Test it locally by visiting http://localhost:8080/api/hello
    You should see the following message displayed: Hello spring boot on azure!
REST API Response in Browser

Create an Azure service principal

In this section, you will create an Azure service principal that the Maven plugin uses when deploying your web app to Azure.

  1. Open a terminal window.
  2. Sign into your Azure account with the Azure CLI by typing az login
  3. Create an Azure service principal by typing az ad sp create-for-rbac –name “uuuuuuuu” –password “pppppppp” (uuuuuuuu is the user name and pppppppp is the password for the service principal).

Azure should print out a JSON response resembling this:

{
"appId": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
"displayName": "servicename",
"name": "http://servicename",
"password": "pass",
"tenant": "tttttttt-tttt-tttt-tttt-tttttttttttt"
}

Configure Maven to use your Azure service principal

In this section, you will configure Maven to authenticate using your Azure service principal for web app deployment.

Open your Maven settings.xml file in a text editor (usually found at either /etc/maven/settings.xml or $HOME/.m2/settings.xml).

Add your Azure service principal settings from the previous section of this tutorial to the collection in the settings.xml file as shown below:

<servers>
   <server>
     <id>azure-auth</id>
      <configuration>
         <client>aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa</client>
         <tenant>tttttttt-tttt-tttt-tttt-tttttttttttt</tenant>
         <key>pass</key>
         <environment>AZURE</environment>
      </configuration>
   </server>
</servers>


Save and close the settings.xml file.

You need to configure Maven Plugin for Azure Web Apps deployment. Below entry needs to be added in pom.xml –

<plugin>
	<groupId>com.microsoft.azure</groupId>
	<artifactId>azure-webapp-maven-plugin</artifactId>
	<version>1.1.0</version>
	<configuration>
	<!-- Azure configuration -->
	</configuration>
</plugin>

Build and deploy your app to Azure

Once you have configured all of the settings in the previous sections, you are ready to deploy your web app to Azure.

From the git bash terminal window, deploy your web app to Azure with Maven by typing mvn azure-webapp:deploy

Maven will deploy your web app to Azure using a plugin already in the build file of the sample project you cloned earlier. If the web app doesn’t already exist, it will be created.

When your web app has been deployed, visit the Azure portal to manage it. It will be listed in App Services as show below:

Web app will be listed in Azure portal App Services. Click on the application. From there, the publicly-facing URL for your web app will be listed in the Overview section.

Determining the URL for your web app
You can click on this link to visit the Spring Boot application and interact with it.

How to create database instance in Azure

Step 1: Azure Subscription

You would need to subscribe for azure portal in order to use azure services. Below is the link for azure portal –

https://portal.azure.com/

If you do not have an Azure account, provide your email or telephone number and it will verify that you are not in the system and will invite you to create an account. There is an option for a free trial account with $200 USD in credits for 30 days, so you can play with Azure resources without spending money during those 30 days.

Step 2: Create SQL Database

Once you are subscribed on azure , you can go to “SQL Databases” link and click “Create SQL Database”. Once you click on “Create SQL Database” , you will see the form as below –

Step 3: Create Server

In order to create database instance ,you need to create server as highlighted below –

Step 4: Create Database Instance

After all the configuration is done , you can create database instance by clicking Review + Create button as shown below –

Now the database instance is up and running as shown below screen –

Step 5: Access Database

You can see database details once you open the resource as below –

You connect to database using visual studio to perform various operations –

You need to install below plugin in Visual Code Studio to connect to database.

Once the plugin is installed , you can connect to database by giving database details . When you try to connect to database, you need to enable firewall on the database instance to make it secure and accessible to outside world. You can add firewall rule as shown below –

Also you can connect and access database from azure platform –

How to host angular application using Azure Cloud

In this post , i will introduce you to azure cloud . Also we will see how to deploy our angular application to azure using azure’s Web App Service.

Step 1: Azure Subscription

You would need to subscribe for azure portal in order to use azure services. Below is the link for azure portal –

https://portal.azure.com/

If you do not have an Azure account, provide your email or telephone number and it will verify that you are not in the system and will invite you to create an account. There is an option for a free trial account with $200 USD in credits for 30 days, so you can play with Azure resources without spending money during those 30 days.

Step 2: Create a resource

Once you are subscribed on azure , you can go to “Create a resource” link and search for Web App. Click on Create web app and you will see the form as below –

Creating Web App resource

These details are required while creating web app service. You need to select a windows operating system for creating resource. Once all the configuration is done you can just review & create the resource.

After resource is created , you can go to all resources tab and can see these two resources created –

All resources

First resource is an App Service where our angular application will be deployed .

Second is application insights where you can monitor performance of your application.

Step 3: Resource Configuration

Here you can do the configuration for the resource created in step above.

Create resource configuration page

Step 4: Deploy application

Now build your angular application using below command –

ng build --prod

This will create an deployable artifacts under /dist folder . You have to copy this content for hosting it on cloud . To copy the content go to “Advanced Tools” menu and click “Go” –

Kudu services page will open as below –

This gives us and FTP services to copy our deployment artifacts generated after build process. Now go to Debug Console -> CMD . We have to drag and drop the contents created in build step under sites/wwwroot folder on kudu services .

Step 5: Configure Path under configuration

Now edit the path to direct to your application folder uploaded in kudu service and click save-

Path addition

Now your application is up and running . You can see the link for your application on resource overview page as below –

Bitnami