Open majakubowski opened 5 years ago
@lykebank but the same goes for "standard" passwords :) Special characters are not a problem.. example:
var connectionString = "AuthType=s2s; ClientId=some-guid; ClientSecret=' {!\"$% &/ () =?`*''_:;}'; Url=https://orgxx.crm4.dynamics.com";
var parsedConnectionString = connectionString.ToDictionary();
Console.WriteLine("Parsed connection string:");
foreach (var pair in parsedConnectionString)
{
Console.WriteLine($"{pair.Key} = `{pair.Value}`");
}
returns:
Parsed connection string:
authtype = `s2s`
clientid = `some-guid`
clientsecret = ` {!"$% &/ () =?`*'_:;}`
url = `https://orgxx.crm4.dynamics.com`
ps: ToDictionary is not standard LINQ extenstion method.. but defined in Microsoft.Xrm.Tooling.Connector
OK works for me, then. I've just been in the bad habit of not enclosing password values in quote characters.
@WaelHamze What's your opinion on this? I'm in need of supporting client credentials in the MSCRM Build Tool Extension for Azure DevOps. I could help out adding it if you don't have any objections!
Hi @majakubowski @WaelHamze
Is there any plan to release these change and when?
Thanks Sanjay
@majakubowski @s-bauer @sanjay1913 thank for submitting this PR. I think this is a great idea. However MS recently added support for client secrets: https://www.nuget.org/packages/Microsoft.CrmSdk.XrmTooling.CoreAssembly/
I think this would meet your needs right?
@majakubowski great work but this is now OOB. Let me know if there is anything from this PR that you would still like to add.
I'm not sure if it's applicable, but I'm having an issue with a connectionstring that contains special characters in the password; attempting to run Select-WhoAmI -ConnectionString $connectionString from PS script; it works when the connection string uses a password without special characters.
I'm looking to leverage a S2S connection as well and you're a couple steps ahead of me. However, your method for parsing the ClientSecret from a custom connection string does not account for client secrets that may include special characters (e.g. ";" or "=").