Samir Shaik
Samir Shaik

Reputation: 1095

Azure Bot-Builder : dispatch refresh fails with 401 error

We provisioned bot services using "msbot clone services ..." command. As part of this command a *.dispatch file is created with all the correct details.

The dispatch aggregates QnAMaker knowledge base and a LUIS app. We have verified the .dispatch file and also the .bot file to ensure correct keys are being used. The only change if any is we are not using starter_key in LUIS, rather we have generated a new key and this new key reflects in .dispatch and .bot file (when decrypted).

We have encrypted the .bot file correctly and tried following commands, and both fail with same error:

  1. dispatch refresh --bot mybot.bot --secret
  2. dispatch refresh --dispatch dispatch-file.dispatch

Error Exporting LUIS application...

ERROR

One or more errors occurred. (The remote server returned an error: (401) Access Denied.)

Request url: https://westus.api.cognitive.microsoft.com/luis/api/v2.0/apps/<LUIS-APP-ID>/versions/0.1/export
Response: { "statusCode": 401, "message": "Access denied due to invalid subscription key. Make sure to provide a valid key for an active subscription." }

Upvotes: 1

Views: 428

Answers (2)

Tien
Tien

Reputation: 36

There are two different keys being used to use Dispatch CLI tool. Authoring key and subscription key. Authoring key is the key from luis.ai portal and needed to export the LUIS sources for Dispatch and to upload the newly created Dispatch app to luis portal. Subscription key is optional and is used for hitting luis endpoint/prediction API. If subscription key (created from Azure portal for LUIS Cognitive Service) is put in place of authoring key, Dispatch CLI won't be able to create and upload/refresh Dispatch app into luis. This is the expected behavior at the moment.

Upvotes: 2

user11192103
user11192103

Reputation: 11

Having the exact same issue. With the starter key everything worked fine.

Edit: seems like an issue with Microsoft API. You can use the starter key to update the dispatch model even though the query limit is reached.

My workaround was:

  • replace the subscriptionkey with the original starter key (authoringkey in luis)
  • run dispatch refresh
  • switch the keys again to allow for queries

Upvotes: 1

Related Questions