Microsoft BotBuilder Azure OAuth Authentication ConnectionSettingName value - botframework

I am following microsoft's dotnet core sample, and under the try this sample section it says:
Update ConnectionSettingName in GraphAuthenticationBot.cs so the bot can perform OAuth calls through Azure Bot Service
What should the value of ConnectionSettingName be?

in GraphAuthenticationBot.cs file, you need update below string to the name you have given while creating a connection in Azure Portal.
private const string ConnectionSettingName = "";

Related

Teams Bot - get credentials from Key Vault

I have searched a bit but didn't found something which is helping me. I created a bot for teams and like described in all examples I am using the appsettings.json to store the ID and the password for the bot (MicrosoftAppId and MicrosoftAppPassword). These are both handled by the framework somehow. But now I want to use an Azure Key Vault to store the secret instead of having the appsettings file.
So I found some examples explaining how to do this in BotFramework V3 with BotAuthentication Attribute and even something for BotFramework V4 here (working link for the linked example here). But even that example is old and does not exist anymore like that.
How am I supposed to do this for a teams bot and c# dotnet 3.1?
You can use the following method to store the secret value
var storageSecretValue = keyVaultClient.GetSecretAsync($"{this.configuration.GetSection("KeyVault")["BaseURL"]}{this.configuration["KeyVaultStrings:StorageConnection"]}");
please refer the following sample document to more clarification:-
https://github.com/OfficeDev/microsoft-teams-apps-newemployeeonboarding/blob/main/Source/Microsoft.Teams.Apps.NewHireOnboarding/Startup.cs
https://learn.microsoft.com/en-us/samples/azure-samples/key-vault-dotnet-core-quickstart/get-started-keyvault-net/

Unable to set OAuthconnection seting

I create a microsoft teams app using App studio and added a bot to it. I am using the sample code provided for the bot here https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/python/46.teams-auth. However the sample required a ConnectionName setting in config.py. But I do not see a OAuthsetting section in the created bot. How can this config be set.
You can add the authentication setting in Azure portal Bot Channels Registration.
Setting -> Add Setting
You could follow this document for adding authentication to bot

Cannot Add authentication to your bot via Azure Bot Service

I want to try the demo on Add authentication to your bot via Azure Bot Service which based on the document https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-tutorial-authentication?view=azure-bot-service-3.0, what i am using is Demonstrates OAuthCard support in the v3 C# SDK, using AAD v2, but i always failed when i use bot emulator to connect the bot service.
i think i set the correct the settings in the webconfig.

use LUIS for conversational bot without Bot Framework

Is it possible to use LUIS API without MS BOT Framework?
It is ok if I need to reference MS BOT Framework libraries for parsing LUIS response, but incoming request text will be from web application and not from MS BOT Framework.
I am struggling to found recent proper nuget package, which will provide parsing capability and context management. So for example if bot asked for name and phone and user provided only name, bot will be able to ask for missing phone.
If you want to use LUIS easily in C#, without using it inside Bot Framework, you can use Microsoft.Cognitive.LUIS package available on Nuget (see here)
This package contains the methods to query LUIS.
Sample:
private async Task QueryLuis(string querySentence)
{
var client = new LuisClient("appId", "appKey", domain: "westeurope");
var luisResult = await client.Predict("Text sent to LUIS for prediction");
Console.WriteLine($"{luisResult.Intents.Select(i => $"Intent '{i.Name}' with score {i.Score}")}\r\n");
}
I guess in the future it may be included in a different package because as you can see in this psSdkJson6 branch of azure-sdk-for-net Github's project, there are also classes for LUIS Runtime available here

How to use Microsoft Dynamics CRM in soup UI

I am very new to Microsoft Dynamics CRM. I am trying to connect to my demo account through REST API using SOUP Ui. But every time I am getting authorization failed error( Error code 401). How should I pass my login credentials in HTTP Header. I am not using SDK, I am just making a rest API call. Please help me in this. If my question is too broad please let me know. I will update my question.
Regards
Not sure how Soup UI works but it sounds like you will need to provide login credentials.
The MSDN has a C# sharp example.
private HttpClient getNewHttpClient(string userName,string password,string domainName, string webAPIBaseAddress)
{
HttpClient client = new HttpClient(new HttpClientHandler() { Credentials = new NetworkCredential(userName, password, domainName) });
client.BaseAddress = new Uri(webAPIBaseAddress);
client.Timeout = new TimeSpan(0, 2, 0);
return client;
}
Can u tell me exactly what should I use for the argument domainName
This depends on exactly what type of CRM setup (online, on-premise, IFD) you are trying to connect to.
Have a look at this and this which demonstrates various connection string details. The samples are using a different connection mechanism to use the SOAP services, but I would expect the username, domain, to be the same with the REST endpoint.
Do u know which are all authentication types Microsoft Dynamics CRM
accepts like (Basic, NTLM, etc) ?
Authenticate users in Microsoft Dynamics CRM
Microsoft Dynamics CRM supports three security models for
authentication: claims-based authentication, Active Directory
authentication, and OAuth 2.0. The type of authentication used depends
on the type of deployment your application is accessing, Microsoft
Dynamics CRM Online or Microsoft Dynamics CRM 2016, and if your
application is using the Web API or the Organization Service.

Resources