Creating a Chat Bot with Microsoft’s QnA Maker and Azure Bot Service

Image

Microsoft has a service in preview, called QnA Maker. It is a free (presently) service, which provides a REST and web-based service that trains AI to respond to questions asked of it. You’ve seen these on other sites, as these have become quite common, and ease the burden on support for SharePoint, or any other service out there. Chat bots can field common questions, freeing up time and energy spent on answering common asks.

They make it very easy to use – you can point it to a URL, type in your questions and answers, or upload a document (.docx, .doc, .pdf, .xlsx, and .tsv). The tricky part, is getting this from loading your knowledge base, to actually having a chat bot on your site. This is what this blog post is for, is to show you how to do it. They do have directions, but not a full walk-through on what to do.

This post assumes that you have at the very least, an Azure Account. If not, you can start one for free.

QnA Maker Setup

First, go to http://qnamaker.ai, this is where you will get started. Click on Create New Service

image

Then sign in with a Microsoft ID, or organizational account like you would into Azure, Office365, Outlook.com, etc.

image

It will then ask you to provide permissions to QnAMaker, click Accept

image

Then you must agree to the terms and privacy statement, check the box and hit Continue

image

Enter in a name for your bot. I am choosing Testbot 9001

image

You now have 3 options for loading data into your Chat Bot…

  1. From a URL that links to a resource which has a clear Q&A format, like a FAQ
  2. From a file, in Question/Answer format (supported file types are .TSV*, .PDF, .DOC, .DOCX, and .XLSX format)
    *TSV stands for Tab Separated Values. Like a CSV, but, you know, with Tabs. You can do this in Excel.
  3. Enter them in manually

For our Testbot 9001, we will be uploading from Excel. So, let’s create a new Excel file. In the first column, type in the question, or phrase, which the chatbot AI will hit on and use to provide the answer. Use the second column to provide that answer. Here is my example file:

image

Now, save the file. And go back to the QnA Maker setup, and choose Select file… next to the FILES section

image

and select the XLSX file from your local computer you just saved

image

Then scroll to the bottom and select Create

image

You will then see a dialog window appear while the service scans your file, and imports your Questions and Answers
image

Once complete, it will take you to the Testbot 9001 Knowledgebase.

image

Select Test from the side bar, and you can test the functionality with your questions
image

Cool, huh? The testing also allows you to train the bot as well. Such as choosing the best answer based upon what you had typed
image

Or providing multiple alternative phrasings, or synonyms

image

When done, click Save and Retrain to save your changes

image

You can see back in the main Knowledgebase, that it has been updated by what we asked and what we updated the suggestions and phrasings with

image

You can also add new Q & A pairs by clicking on Add new QnA pair

image

image

When done, Save & Retrain again to save your settings.

Once you are ready… click Publish

image

It will then show you what will be published… and then when ready, click Publish

image

The deployment confirmation screen will show you the example HTTP request for using your bot through the REST API. These are also available in the Settings link on the sidebar of the Knowledgebase.

image

We will need some f this information in a few minutes, so take down the Knowledgebase ID

image

And the Subscription Key

image

and put those aside for a few minutes…

Azure Bot Service Setup

Next we’re going to use the Azure Bot Service to setup our bot. To do so, we’ll be following these instructions: https://docs.microsoft.com/en-us/bot-framework/bot-service-quickstart

Log into the Azure Portal

Click on New > AI + Cognitive Services > Web App Bot

image

Now, let’s configure the botimage

  • Name: Testbot9001
    So you can identify the soldiers in your bot army!
  • Subscription: GeoffOps
    Choose your own subscription. This one is mine. You can’t have it.
  • Resource Group: Testbot9001
    Use an existing or create a new one
  • Location: East US
    Select the data center region you would like to use
  • Pricing Tier:  FO (10K Premium Messages)
    This defaults to S1 Standard, change this to F0 Free. Or else you will pay for the service
  • App Name: Testbot9001
  • Bot template:  Question and Answer
  • App service plan/Location: Testbot9001
    You will need to create a new one, or use an existing. For this example, I created a new one also in East US
  • Azure Storage: testbot9001a325
    I am letting Azure create a new one for me. This is a data storage account, like a fileshare. You can use an existing one if you have one as well.
  • Application Insights: Off
    This is not free. So I turned it off.

Then click Create to bring life to your Azure Bot. I twill validate your choices, and then when complete, will begin deployment.

image

When deployment has completed, you can find the bot and associates Azure resources under the All Resources blade of the left, or, if you have other stuff in Azure, go to the Resource Groups blade, and click on your Resource Group we created in the Bot setup above. In my case, the Resource Group is Testbot9001

image

Ok. So, we’ve created our bot with QnA Maker, and created a Bot Service in Azure… now what? We need to connect the two.

Select your bot, it’ll be the one which has a TYPE of Web App Bot

image

On the left hand side, click on APP SERVICE SETTINGS > Application Settings

image

And then scroll down to App settings. You will see two blank settings called QnAKnowledgebaseId and QnASubscriptionKey

Now, remember those things we copied off earlier? Pate these in there.

image

And then click Save up top

ScreenClip

Now, click on Test in Web Chat on the left side, and test out your new bot!

image

Pretty neat! But… now what?

Click on Channels on the left side. You will see Web Chat setup and running by default. You can also see, you can extend this out to Teams, Skype, and more pretty easily.

image

Click on Edit, and copy the Embed Code

image

And show one of the keys at the top

image

and replace the YOUR_SECRET_HERE in the embed code

image

And you can now drop that into a site, web part, whatever you’d like. It’s just an iFrame, so the possibilities are endless.

A simple example – using Embed Code on a SharePoint page:

image

image

image

Would I implement it like this for a client? Likely not… I’d be more apt to have a sliding pop-up window, similar to Facebook chats that can be minimized and maximized as needed. This was just an example to show how to build one of these.

 

References

Advertisement

Creating New Service Application Proxy Groups and Associating Services and Sites

Sometimes the need arises to create separate Service Application Proxy groups in SharePoint. Starting with SharePoint 2010, you’ve been able to do this. In SharePoint 2007, you would have created different Shared Service Providers. Your needs might be, that you are exposing web applications to a different group of users, and need separate applications such as Search and the User Profile Service. This also allows you to run those service applications under different accounts, if you needed to for security reasons.

First, let’s create the proxy group we want to use. And lets give it a name.. in the example, I’ll be using "Redacted"… because all my screenshots have had the real service application group identity redacted 🙂 But you can name this anything you’d like. Load up the SharePoint Version Management Console… and call the New-SPServiceApplicationProxyGroup PowerShell cmdlet.

New-SPServiceApplicationProxyGroup "Redacted"

Once you have your new Service Application Proxy Group created, you can then change the web application subscriptions to the proxy groups. To do so, go into Central Administration > Application Management > Web Applications > Manage web applications and select one of your sites. In the ribbon, then select Service Connections under the Management group.

Image(5)

You can always verify this by then going into Central Administration > Application Management > Service Applications > Configure service application associations

Image(6)

Select the Web Applications view, and then you should see your sites, and their associated applications with their Application Proxy Groups.

Image(7)

When you create a new service application, by default, it is going to get tossed into the default group. There is no way in the UI presently to allow you to change associations in the UI once you have created your new proxy group, so, what you need to do is to handle this in PowerShell. The best way to get the IDs for your service applications is to use Get-SPServiceApplication, and then only display the two columns you need, DisplayName (so you know what ones you are looking for), and the Id.

Get-SPServiceApplication | select-object DisplayName,Id

Image(8)

Once you have the ID’s that you need for your Service Applications, you now need to add them as members to the new proxy group you created earlier. You can do this by using the Add-SPServiceApplicationProxyGroupMember PowerShell cmdlet, like so:

Add-SPServiceApplicationProxyGroupMember "Redacted" -Member "f166672c-24b5-4f1a-bd2d-e8436d966abb"

This will add the "Secure Store Service – Redacted" Service Application to my new proxy group Redacted.

If for some reason, one of the service applications do not want to move out of the default group after adding them into the new group, you can remove them with the Remove-SPServiceApplicationProxyGroupMember PowerShell cmdlet. Just an FYI – the default group is referenced as "", so, if you needed to now remove the above service from the default group, you will need to address it as:

Remove-SPServiceApplicationProxyGroupMember "" -Member "f166672c-24b5-4f1a-bd2d-e8436d966abb"

Upgrading to an Enterprise License in SharePoint 20XX

In SharePoint 2010, 2013, and 2016 – you at some point may need to upgrade from a Standard License to an Enterprise license. There are too many reasons to list here…

At first, it seems pretty straight forward… go into Central Administration > Upgrade and Migration > Convert farm license type

Image

You can see your current license… however, both the input box, as well as the OK button are disabled.

Image

Seems like this would be the place to do it, right? Yeah, I don’t get it either. In any event, the proper way to do this, is to click on Enable Enterprise Features under Upgrade and Migration

Image

Click on Enterprise

Image

and enter in your Product Key and click OK.

NOTE: You cannot undo this, so make sure that you want to use an Enterprise key and absorb the associated cost of CALs!

SharePoint 2016 Web Template List

The following is the current list of Web Templates available in SharePoint 2016 as of today’s date, February 10, 2017. The farm version is up to the November 2016 Cumulative Update. The CL column stands for Compatibility Level, but was shorted for space concerns when displayed here. This is basically a reference for me to use, as I need to refer to this often when using deployment scripts like AutoSPInstaller to deploy SharePoint farms.

You can easily generate this list in the Microsoft SharePoint 2016 Management Shell by running the following command:

Get-SPWebTemplate | Select-Object * | Export-Csv .\WebTemplates.csv

ID Name Title CL
0 GLOBAL#0 Global template 15
1 STS#0 Team Site 15
1 STS#1 Blank Site 15
1 STS#2 Document Workspace 15
2 MPS#0 Basic Meeting Workspace 15
2 MPS#1 Blank Meeting Workspace 15
2 MPS#2 Decision Meeting Workspace 15
2 MPS#3 Social Meeting Workspace 15
2 MPS#4 Multipage Meeting Workspace 15
3 CENTRALADMIN#0 Central Admin Site 15
4 WIKI#0 Wiki Site 15
9 BLOG#0 Blog 15
15 SGS#0 Group Work Site 15
16 TENANTADMIN#0 Tenant Admin Site 15
17 APP#0 App Template 15
18 APPCATALOG#0 App Catalog Site 15
2764 ACCSRV#0 Access Services Site 15
2757 ACCSVC#0 Access Services Site Internal 15
2757 ACCSVC#1 Access Services Site 15
7 BDR#0 Document Center 15
3400 TBH#0 In-Place Hold Policy Center 15
95 DEV#0 Developer Site 15
3300 EDISC#0 eDiscovery Center 15
3300 EDISC#1 eDiscovery Case 15
14483 OFFILE#0 (obsolete) Records Center 15
14483 OFFILE#1 Records Center 15
40 OSRV#0 Shared Services Administration Site 15
3100 PPSMASite#0 PerformancePoint 15
3200 BICenterSite#0 Business Intelligence Center 15
6221 PWA#0 Project Web App Site 15
6215 PWS#0 Microsoft Project Site 15
3500 POLICYCTR#0 Compliance Policy Center 15
20 SPS#0 SharePoint Portal Server Site 15
21 SPSPERS#0 SharePoint Portal Server Personal Space 15
21 SPSPERS#2 Storage And Social SharePoint Portal Server Personal Space 15
21 SPSPERS#3 Storage Only SharePoint Portal Server Personal Space 15
21 SPSPERS#4 Social Only SharePoint Portal Server Personal Space 15
21 SPSPERS#5 Empty SharePoint Portal Server Personal Space 15
21 SPSPERS#6 Storage And Social SharePoint Portal Server Personal Space 15
21 SPSPERS#7 Storage And Social SharePoint Portal Server Personal Space 15
21 SPSPERS#8 Storage And Social SharePoint Portal Server Personal Space 15
21 SPSPERS#9 Storage And Social SharePoint Portal Server Personal Space 15
21 SPSPERS#10 Storage And Social SharePoint Portal Server Personal Space 15
22 SPSMSITE#0 Personalization Site 15
30 SPSTOC#0 Contents area Template 15
31 SPSTOPIC#0 Topic area template 15
32 SPSNEWS#0 News Site 15
39 CMSPUBLISHING#0 Publishing Site 15
53 BLANKINTERNET#0 Publishing Site 15
53 BLANKINTERNET#1 Press Releases Site 15
53 BLANKINTERNET#2 Publishing Site with Workflow 15
33 SPSNHOME#0 News Site 15
34 SPSSITES#0 Site Directory 15
36 SPSCOMMU#0 Community area template 15
38 SPSREPORTCENTER#0 Report Center 15
47 SPSPORTAL#0 Collaboration Portal 15
50 SRCHCEN#0 Enterprise Search Center 15
51 PROFILES#0 Profiles 15
52 BLANKINTERNETCONTAINER#0 Publishing Portal 15
54 SPSMSITEHOST#0 My Site Host 15
56 ENTERWIKI#0 Enterprise Wiki 15
6115 PROJECTSITE#0 Project Site 15
59 PRODUCTCATALOG#0 Product Catalog 15
62 COMMUNITY#0 Community Site 15
63 COMMUNITYPORTAL#0 Community Portal 15
64 GROUP#0 Group 15
65 POINTPUBLISHINGHUB#0 PointPublishing Hub 15
66 POINTPUBLISHINGPERSONAL#0 PointPublishing Personal 15
67 POINTPUBLISHINGTOPIC#0 PointPublishing Topic 15
90 SRCHCENTERLITE#0 Basic Search Center 15
90 SRCHCENTERLITE#1 Basic Search Center 15
61 visprus#0 Visio Process Repository 15
0 GLOBAL#0 Global template 14
1 STS#0 Team Site 14
1 STS#1 Blank Site 14
1 STS#2 Document Workspace 14
2 MPS#0 Basic Meeting Workspace 14
2 MPS#1 Blank Meeting Workspace 14
2 MPS#2 Decision Meeting Workspace 14
2 MPS#3 Social Meeting Workspace 14
2 MPS#4 Multipage Meeting Workspace 14
3 CENTRALADMIN#0 Central Admin Site 14
4 WIKI#0 Wiki Site 14
9 BLOG#0 Blog 14
15 SGS#0 Group Work Site 14
16 TENANTADMIN#0 Tenant Admin Site 14
2764 ACCSRV#0 Access Services Site 14
2764 ACCSRV#1 Assets Web Database 14
2764 ACCSRV#3 Charitable Contributions Web Database 14
2764 ACCSRV#4 Contacts Web Database 14
2764 ACCSRV#6 Issues Web Database 14
2764 ACCSRV#5 Projects Web Database 14
7 BDR#0 Document Center 14
14483 OFFILE#0 (obsolete) Records Center 14
14483 OFFILE#1 Records Center 14
40 OSRV#0 Shared Services Administration Site 14
3100 PPSMASite#0 PerformancePoint 14
3200 BICenterSite#0 Business Intelligence Center 14
6221 PWA#0 Project Web App Site 14
6215 PWS#0 Microsoft Project Site 14
20 SPS#0 SharePoint Portal Server Site 14
21 SPSPERS#0 SharePoint Portal Server Personal Space 14
22 SPSMSITE#0 Personalization Site 14
30 SPSTOC#0 Contents area Template 14
31 SPSTOPIC#0 Topic area template 14
32 SPSNEWS#0 News Site 14
39 CMSPUBLISHING#0 Publishing Site 14
53 BLANKINTERNET#0 Publishing Site 14
53 BLANKINTERNET#1 Press Releases Site 14
53 BLANKINTERNET#2 Publishing Site with Workflow 14
33 SPSNHOME#0 News Site 14
34 SPSSITES#0 Site Directory 14
36 SPSCOMMU#0 Community area template 14
38 SPSREPORTCENTER#0 Report Center 14
47 SPSPORTAL#0 Collaboration Portal 14
50 SRCHCEN#0 Enterprise Search Center 14
51 PROFILES#0 Profiles 14
52 BLANKINTERNETCONTAINER#0 Publishing Portal 14
54 SPSMSITEHOST#0 My Site Host 14
56 ENTERWIKI#0 Enterprise Wiki 14
90 SRCHCENTERLITE#0 Basic Search Center 14
90 SRCHCENTERLITE#1 Basic Search Center 14
2000 SRCHCENTERFAST#0 FAST Search Center 14
61 visprus#0 Visio Process Repository 14

"Microsoft SharePoint Foundation administration tool has stopped working" Error During Install of SharePoint 2016 SP1

An issue I have recently run into when installing SharePoint 2016 with SP1 slipstreamed is the following error:

Image(1)

At first, I thought that at the time, it was related to the binaries being on a network share for the install… however, I have also encountered the same issue when installing locally from the server (Windows Server 2012 R2 Datacenter running on VMWare).

Happens towards the end of the installation:

Image(2)

Errors that show up in the Event Log are:

Image(3)

Application: stsadm.exe

Framework Version: v4.0.30319

Description: The process was terminated due to an unhandled exception.

Exception Info: System.IO.FileNotFoundException

at Microsoft.SharePoint.StsAdmin.SPStsAdmin..cctor()

Exception Info: System.TypeInitializationException

at Microsoft.SharePoint.StsAdmin.SPStsAdmin.Main(System.String[])

 

Image(4)

Faulting application name: stsadm.exe, version: 16.0.4300.1000, time stamp: 0x561d26d9

Faulting module name: KERNELBASE.dll, version: 6.3.9600.18340, time stamp: 0x57366075

Exception code: 0xe0434352

Fault offset: 0x0000000000008a5c

Faulting process id: 0xf88

Faulting application start time: 0x01d283ab05244c8e

Faulting application path: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\BIN\stsadm.exe

Faulting module path: C:\Windows\system32\KERNELBASE.dll

Report Id: 44d175a0-ef9e-11e6-80c4-0050568466c7

Faulting package full name:

Faulting package-relative application ID:

 

This seems to happen about 4-6 times during the install process. This has happened across all servers in the farm. I have done some research into this – appeared to be a known problem with prior versions, but do not have an answer at this time.

My solution to the problem is straight forward enough, just click Close Program. I have not run into any lasting effects after doing so. Lets hope that doesn’t change 🙂

Image

%d bloggers like this: