Telegram bot Deployment on Azure - c#

I use ASP.NET Core
Actually I published my Bot to Created WebApp via Azure and took necessary things (URL, password etc).
Now I have no idea how to test it before registration.
Also will be glad to get more information about working principle of the deployed on Azure bot

Related

"There was an error sending this message to your bot: HTTP status code NotFound"

I created a bot with C# and deployed it and I keep getting error code NotFound or when tested in emulator 404.
The bot works perfectly fine locally when tested but when deployed it fails.
I've created a bot with composer and it does same thing, works locally, but then fails when deployed to Azure.
Bot config :
Bot working locally:
Bot failing remotely:
and
I have faced the same issue while creating "Web App Bot" with custom password option, sometimes this option will fail. So you can try with auto generated password option in "Web App BOT".
Please verify the following authentication details:
Microsoft AppId -> Should be use same App Id in both application & azure portal.
Microsoft Password -> Should be use same Password in both application & azure portal.
Directline Token -> Verify this token if you are connecting from front-end framework.
Messaging endpoint -> Verify this endpoint
Web App Bot is help to create all necessary service automatically for chatbot implementation and we can create the same process in another way. Please check the following steps.
Create an app service in azure ( host your chatbot application )
Create azure bot channel registration.
Link App service & bot channel registration using app service endpoint.
Validate all of the authentication details.
Note : You can test your app in azure bot emulator "Test in WebChat" section.
Reference :Azure Chatbot & Bot Framework Composer
What solved my problem was changing the Protocol Setting of the App Service. If you've deployed your bot using Bot Composer, in the resource group you will find 2 App Services - one with a 'qna' suffix and the other without. Choose the one without the 'qna' suffix.
Select the App Service --> TLS/SSL settings --> HTTPS Only --> On
ok so I found the solution:
Error (502) Bad Gateway: When trying to access chatbot deployed on Azure using WebChat channel
apparently if you deploy your bot to azure it doesn't work. But if you create a bot on azure, then deploy the bot you created to that appservice it works. The way the answer in the link describes is a little vague and not complete. To resolve my issue I created a bot in azure, and that automatically creates an app service with it. I then published the bot I created in visual studio by selecting the resource group and the appservice as my target of the bot I created in Azure. The bot I want to host then replaces the first bot, and somehow that magically fixes network issues. Apparently if you create bot in visual studio or composer and publish it as is just doesn't work, this is an issue they need microsoft needs to work on.

Automatic deployment of bot service on azure using C#

I need to be able to deploy bot framework solution fully automatically from a .net web app.
The resources I am able to create with ease (using Microsoft.Azure.Management.Fluent) are:
app service plan
Web App with bot backend
azure storage
The resources that I want (and can't) are:
"Wab App Bot"
"Cognitive Service" with LUIS (this one is optional for know, but it would be really great if I can also create this kind of resource from code)
I have configured service principal with necessary rights.
You can find the code samples to create Azure app bot and Cognitive Service under the SDKs.
Azure app bot https://github.com/Azure/azure-sdk-for-net/tree/psSdkJson6/src/SDKs/BotService
Azure Cognitive Service https://github.com/Azure/azure-sdk-for-net/tree/psSdkJson6/src/SDKs/CognitiveServices
My though on this to enable the continious deployment for the bt code using GitHub or AzureDevOps, following link will help you set up the CD for the bot
https://learn.microsoft.com/en-us/azure/bot-service/bot-service-build-continuous-deployment?view=azure-bot-service-4.0
As for the LUIS application, what I end up doing is to use PowerShell / C# app to deploy the LUIS app definition using the LUIS REST api https://westus.dev.cognitive.microsoft.com/docs/services/5890b47c39e2bb17b84a55ff/operations/5890b47c39e2bb052c5b9c2f

Azure AD authentication with Asp.net core without App registrations in Azure

I have been trying to do Azure AD authentication with ASP.Net Core application where I want to achieve this without doing the App Registrations, Reply URL settings in Azure.
The Reason being, I want our users from other domains to download our application from azure Marketplace and start logging into the application with AAD without doing the App Registrations step - Is it Possible ?
If not possible, Is there any programmatic approach to create App Registrations, Reply URL and give necessary permissions so as to simplify the process and to enhance user experience
Any Sample documentation/link/solution is highly appreciated.

Accessing bot in azure in android

I have deployed a bot in azure. Bot is written in C# using microsoft bot framework.
I am able to communicate with it using Microsoft Bot Framework Emulator after providing the azure URL, App Id and App Secret.
How to communicate with the bot from android?
Is there a URL to communicate with it like a REST Api?
If you use a bot registered to BotFramework, you can try to configure the Web Chat channel :
Log in to Bot Framework
Go to "your bots"
Click on the bot you've registered
Click on "Edit" next to “Web Chat” in the Channels
Generate your Web Chat Secrets (a blue button)
Tick "enable this bot on web chat"
Take note of the secret and embed tag
Then, take out the link from the iframe, (you'll get something like this : https://webchat.botframework.com/embed/YourBotID?s=YOUR_SECRET_HERE )
Replace YOUR_SECRET_HERE with the secret you previously took
Then, browse the final link from your phone / anywhere.
#SandeepMenon, There is a blog which introduces how to integate Azure Logic Apps with a Bot Web App using Bot Framework API hosted on Azure and supply the sample project on GitHub.
I think you can try to refer to the blog and use the Azure Logic App as callable endpoint, then to communicate with bot from android is only implementation for calling the http endpoints from android.

Azure Active Directory Authentication with Azure Mobile Services Failed

I followed this Microsoft Azure Mobile Service Authentication Tutorial, to try to add a server authentication function for my Windows Store C# app. However, after completing every step, when I run my app, it showed that the application cannot connect to the service.
I found this useful blog tallking about troubleshooting Azure Authentication issues in Azure Mobile Service. To troubleshoot, I type the link in the firefox web browser: myServiceUrl/login/aad, but I receive the error response:
Authorization has been denied for this request.
I also followed the same tutorial to test with Google Log in. It turns out to work properly. And when I type the link: myServiceUrl/login/google, the web browser directed me to the google log in page, unlike the Unauthorization error message when I type in myServiceUrl/login/aad.
Although google log in works out fine, but it is desired for us to use Azure Active Directory authentication. Could anyone tell us what could possibly be wrong? Any troubleshooting suggestions are also appreciated. Thank you.
The "Application cannot connect to the service" error comes from whenever the Web Authentication Broker in Windows receives an error response from the resource it is trying to reach. There are a couple of issues that can cause this, and I'll try and address the most common ones.
I noticed the tutorial you linked to is for the .NET backend. If you are using the Mobile Services .NET backend, there is an extra step required to configure the AAD server flow, and it's a common cause of the issue being described. In the tutorial, it's under the title "Configure your .NET mobile service for AAD login." On the backend project, you will need to install the Mobile Services .NET Backend Security Extension NuGet package. Then, in WebApiConfig.cs, you will need to include
options.LoginProviders.Remove(typeof(AzureActiveDirectoryLoginProvider));
options.LoginProviders.Add(typeof(AzureActiveDirectoryExtendedLoginProvider));
This allows the runtime to use the server flow in addition to the client flow (leveraging the Active Directory Authentication Library) which was first released with the .NET backend.
Pending that, or in the case of the Node runtime, the next thing to do is check the AAD configuration. In the AAD portal, make sure that your application registration uses your mobile service's /login/aad endpoint for the resource URI. It must match exactly the value provided in the Mobile Services portal. This should also be one of the redirect URIs if you are using the Node backend. For .NET, you would use the /signin-aad endpoint for the redirect URI instead.
You should also check that you have copied the Client ID from the AAD registration and pasted it into the Mobile Services portal's Identity Tab. For completeness, the "Allowed Tenants" field should also be filled out, but I don't believe it is the cause of this issue.
Lastly, if your AAD tenant is federated with ADFS, then there is a wide range of issues that could lead to this. The biggest case comes from the WAB needing to be configured for Enterprise Authentication. This typically only causes problems when the device is domain joined / on the corporate network. That behavior is a known bug for the Mobile Services Windows Store SDK, but there is a workaround available. Glad to provide that if needed.

Categories