Bot Channels Registration: where is the Secret/Password for the Application ID?

This post has been republished via RSS; it originally appeared at: New blog articles in Microsoft Tech Community.

TL;DR: When provisioning a Bot Channel Registration with “Auto create App ID”, the associated secret cannot be retrieved. This is “by design” and there are 2 workarounds:

  • Simply add a new secret for the App ID, and use that in the bot app configuration, or
  • Pre-define an Azure AD App Registration before creating the bot

 

 

 

Intro

 

In a bot solution, there are 2 core applications that talk to each other, authenticating each to the other with tokens issues by Azure AD: the bot connector and the bot app/endpoint. You might want to review my article at http://linqto.me/botflow for illustrations and details.

Those authentication tokens originate from an Application Registration entry, that is present in the Azure Active Directory tenant; the tenant associated with the Subscription under which the bot is created. The App Registration is, basically, an App ID with one or more secrets, or passwords.

When creating a Bot Channel Registration, the provisioning wizard from the Azure Portal offers the option to automatically create the above mentioned, needed App Registration entry. It’s handy, but leads to a confusion later, in many cases:

 

Now where is the Secret/Password of the Application ID for my bot? Because I needed it in the configuration of my bot application...

 

This is where we hit a security feature in Azure AD for App Registration: an associated secret can only be retrieved at creation time; after that AppID password is persisted in the App Registration entry, it can no longer be consulted. Which directly leads to the question above.

Because the Bot Channel Registration wizard persists an AppID password for the bot connector side, but it never shows it, nor does it direct on how to get a (new) secret for the messaging endpoint side.

 

 

 

How it happens?

 

Let’s say you start creating a bot using the Bot Channel Registration provisioning template:

 

clipboard_image_0.png

 

Click “next”...

 

clipboard_image_1.png

 

Yes, please do create an App ID and password, meaning an App Registration entry in the current Azure AD tenant...

 

clipboard_image_2.png

 

Now I’ll need the created password or secret of the Application ID, right? Because I need it in my bot app configuration...

 

clipboard_image_3.png

 

Boom: cannot get the secret of the App Registration, due to a security enforcement.

Oh, by the way, on a side note... don’t delete the existing secret, because that is used by the bot connector side. Remember the diagram at http://linqto.me/botflow. If you delete that secret, you’re breaking the connector’s ability to authenticate to your bot app.

 

clipboard_image_4.png

 

 

 

How to work around?

 

Right, you still need the Application ID AND a secret to feed into the configuration of your bot app. Because your bot has to authenticate too, when it sends messages via the connector.

 

 

Solution number 1

 

Simply add a new secret that could be used on the bot app side, but watch it...

 

clipboard_image_5.png

 

Grab the newly created secret immediately after adding it in the App Registration entry. You won’t get another chance!

 

clipboard_image_6.png

 

Use the new secret in the configuration of your bot app, the messaging endpoint:

 

clipboard_image_7.png

 

 

 

Solution number 2

 

Pre-define an App Registration.

Create the app registration prior to provisioning the Bot Channel Registration, because once the bot connector entry is created, the App Registration cannot be changed into the said Bot Channel Registration. See details in my article at http://linqto.me/botappid.

Then use the App Registration ID and secret into the Bot Channel Registration creation wizard.

Of course, this means provisioning a new Bot, actually, from scratch. Depending on how much effort you put into configuring the initial bot, you might want to apply the first solution instead.

 

 

 

I hope it helps. Remember that song, “Don’t Worry, Be Happy”?

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.