Creative way of exposing on-premises APIs through Azure API Management

Hi,

In this blog post, I’ going to explain what I consider a creative way of exposing on-premises APIs. Let’s envision the following scenario:

You have an on-premises API that is secured using Windows Authentication and for which you need to know the identity of the caller. This API is already consumed by various on-premises consumers and you want to make it also available to online consumers but you want to benefit from throttling and caching capabilities of Azure API Management.

A traditional way of doing this could be by hosting your on-premises API into a DMZ and plugging the APIMGMT to that DMZ endpoint. Another way is using VNETs and VPN techniques to control and establish connectivity. That said, you’d control the connectivity but you should still be able to control identity as per our scenario, this is a pre-requisite for your backend API to know the identity of the user consuming it (via an App).

Continue reading

Posted in Azure Active Directory Proxy, Azure | Tagged , , | Leave a comment

Still hesitating which sessions to attend at #techorama? You might want to go to API Management in Azure

Hi,

This year, at Techorama, I’m going to speak about API Management in Azure. Although this topic is not new, I realized it’s pretty unknown by peers I talk to. Here are the agendas of my sessions, as I cover this topic in two different sessions:

Part I

  • What is APIMGMT?
  • Let’s have a look at the management portals
  • How to publish an API
  • How to deal with policies
  • Monetizing APIs & Integrate with other systems

Part II

  • Using network-related techniques to prevent unexpected access to backend APIs
  • Controlling who’s accessing backend APIs (gateway, other?)
  • Enabling different consumption routes
  • Exposing on-premises APIs from Azure AD Proxy published on-premises applications

Happy Coding!

Posted in Azure | Tagged | Leave a comment

Think twice before enabling Bing Spell Check at LUIS level

Hi,

Enabling Bing Spell Check, one of the Azure Cognitive Services at LUIS level is a piece of cake, indeed, this involves the following steps:

  • Getting a key
  • Registering the key in LUIS
  • Associating that key to your LUIS application

Once done, you also need to change a few things in code:

[LuisModel("appid", "appkey",LuisApiVersion.V2,null,true,true)]

Continue reading

Posted in Azure Cognitive Services, NLP | Tagged , , | Leave a comment

Microsoft bot framework tip: mind the mentions

Hi,

As you know, the Microsoft bot framework is mutli-channel, therefore, when users start talking to a bot from Teams, they may mention it in order to interact with your bot.

So far so good but you should mind the mention as it it sent to your bot on the form:

<at>bot name</at>

meaning that if you leave it “as is” and if you’re using LUIS behind the scenes, your bot will suddenly misunderstand a lot of things. Therefore, make sure to remove the mentions as your first coding action:

activity.Text = Regex.Replace(activity.Text, "<at>.*</at>", "", RegexOptions.IgnoreCase).Trim();

Happy coding!

Posted in Azure | Tagged | Leave a comment

Dialogue tip with the Microsoft botframework

Hi,

Admittedly, dealing with dialogues within the bot framework isn’t an easy task. We often have to struggle to make that damn thing do what we want it to do. I recently had to include a potentially rich answer during one of my dialogues.  In short, the answer to a given question could contain a video but could as well be a basic text.

Moreover, this is only one step of the whole dialogue.  As I had to fight a little bit to get it work, I thought it might be worthwhile to make a short blog post about it.  So here is the code:

[Serializable]
public class VideoAnswer : IDialog<IMessageActivity>
{
    string _link = string.Empty;
    string _text = string.Empty;
    public VideoAnswer(string text,string link)
    {
        _link = link;
        _text = text;
    }
    public async Task StartAsync(IDialogContext context)
    {

        var reply = context.MakeMessage();
        reply.Text = _text;
        if (!string.IsNullOrEmpty(_link))
        {
            VideoCard card = new VideoCard();
            card.Text = "We found a video that should help you";
            List<MediaUrl> medias = new List<MediaUrl>();
            medias.Add(new MediaUrl
            {
                Url = _link
            });
            card.Media = medias;
            reply.Attachments.Add(card.ToAttachment());
        }
        await context.PostAsync(reply);
        context.Done(reply);
    }
}

[Serializable]
public class KbDialog : IDialog<object>
{
    string _path = null;
    Guid _source = Guid.Empty;
    public KbDialog(string path,Guid source)
    { 
        _path = path;
        _source = source;
    }
    public async Task StartAsync(IDialogContext context)
    {
        context.Call(Chain.From(() =>
            Chain.Return(SPUtils.GetSharePointAnswerToQuestion(_path, _source)))
            .ContinueWith<SharePointKB, IMessageActivity>(async (ctx, answ) =>
            {
                var a = await answ;
                return new VideoAnswer(
                    a.Answer,
                    a.VideoLink);
            })
            .ContinueWith<IMessageActivity, bool>(async (ctx, act) =>
            {
                return new PromptDialog.PromptConfirm(
                    Config.Cfg.DidItHelpPrompt, Config.Cfg.DidItHelpPromptInvalidAnswer, 100);
            }
            ), OnQAComplete);
    }

    private async Task OnQAComplete(IDialogContext context, IAwaitable<bool> result)
    {
        //do your stuff
        context.Done(this);
    }
}

The idea of the above code is to get some answer from SharePoint when a user asks a question. My KB may contain a video or not. So here in the KbDialog, which is itself part of a root dialog, I start getting the answer from SharePoint and I pass it to the next step on the form of a SharePointKb object. The next step’s output is an IMessageActivity which is implemented inside of the VideoAnswer class, itself implementing the IDialog interface. Within that separate dialogue, I reply either with text-only, either with text & video but always on the form of a IMessageActivity.

Happy Bot Coding!

Posted in Azure | Tagged | Leave a comment

How to properly train Microsoft LUIS?

Hi,

I’m now working with LUIS since late December 2016 and I have detected some patterns that I think can be very useful when training your models. My observations are based on models that served different purposes. I’m not going to show you screenshots of the UI since it recently changed dramatically so I’ll focus more on the features and I guess you’ll find your way in the UI yourself.

Entities and phrase list features

IMHO, entities are the corner stone of a LUIS model. They can help LUIS pairing intents & entities together while allowing the resulting action to benefit from the captured value(s). To take a concrete example, if a user asks this question:

Where to find documentation on SharePoint

Continue reading

Posted in Azure Cognitive Services, NLP | Tagged , , | Leave a comment

SharePoint-hosted QnA versus QnA Maker, how do they compare to eachother

Hi,

I’ve a little bit tackled this topic in my previous post but I’m now going to elaborate more and come with concrete results. Before making the comparison between a SharePoint-Hosted QnA and QnA Maker, let me describe shortly what QnA Maker is all about.

QnA Maker in a nutshell

Microsoft QnA maker is free (for the time being) and allows an easy integration of existing online FAQs and/or custom set of questions/answers. The QnA is supposed to resolve similar questions to the one stored in its KB and return a relevant answer with a confidence score. QnA Maker offers an API that is very straightforward to consume. The below SWOT recaps my perception of this component for the time being: Continue reading

Posted in Azure, Azure Cognitive Services, NLP, SharePoint Online | Tagged , , , | Leave a comment