Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for connection strings with client credentials #205

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open

support for connection strings with client credentials #205

wants to merge 27 commits into from

Conversation

majakubowski
Copy link
Contributor

No description provided.

majakubowski and others added 27 commits August 19, 2018 13:26
new commands: Remove-XrmOption, Set-XrmDashboardRole, Set-XrmWorkflowState
…OrganizationServiceProxy / OrganizationWebProxyClient)
@lykebank
Copy link

lykebank commented Apr 9, 2019

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 "=").

@majakubowski
Copy link
Contributor Author

@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`

reference: https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ms722656(v=vs.85)#setting-values-that-use-reserved-characters

ps: ToDictionary is not standard LINQ extenstion method.. but defined in Microsoft.Xrm.Tooling.Connector

@lykebank
Copy link

OK works for me, then. I've just been in the bad habit of not enclosing password values in quote characters.

@s-bauer
Copy link
Contributor

s-bauer commented May 21, 2019

@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!

@sanjay1913
Copy link

Hi @majakubowski @WaelHamze

Is there any plan to release these change and when?

Thanks
Sanjay

@WaelHamze
Copy link
Owner

@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?

@WaelHamze
Copy link
Owner

@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.

@alphonso77
Copy link

alphonso77 commented Jan 24, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants