When I invoke the LUIS model from by Bot with the subscription key generated from the portal it is returning me 401 (Access Denied) message. When I am running the bot code with the programmatic key in luis then my bot runs perfectly. Can someone help me know why such a behavior? I have earlier deployed bots with the subscription key and they would work fine. Am I missing something?


Thanks in advance.
@MadhuAcc12, When you use the endpoint key to hit the endpoint directly in the browser, are you receiving the same 401 message? Which endpoint region are you trying reach?

@stevengum97 When I try to hit this endpoint, I am able to get responses.
I have deployed the bot, luis model both on azure with location as West Central US location.
@MadhuAcc12, if you adjust your code to the following it should work:
[LuisModel("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX", "XXXXXXXXXXXXXXXXX", domain: "westcentralus.api.cognitive.microsoft.com")]
[Serializable]
The LuisModel defaults to the "westus" endpoint; using a different region requires developers to specify which one they're going to use.
If this doesn't work please let us know.
@stevengum97 Hey.. This worked... Thanks a lot... This solved my problem :)
@stevengum97 thanks dude...just killed about 2 hours on this :)
Most helpful comment
@MadhuAcc12, if you adjust your code to the following it should work:
The
LuisModeldefaults to the"westus"endpoint; using a different region requires developers to specify which one they're going to use.If this doesn't work please let us know.