Capgemini / msbuild-xrm-sourcecontrol

MSBuild Visual Studio Extensions to provide easy source control for Dynamics 365
https://www.nuget.org/packages/MsBuild.Xrm.SourceControl/
MIT License
11 stars 7 forks source link

support for Oauth authentication #15

Closed Dave-Robertson92 closed 3 years ago

Dave-Robertson92 commented 3 years ago

the current supported authentication method "Office365" is deprecated, I think we should support Oauth. This tool uses Microsoft.Xrm.Data.PowerShell which if updated supports this auth method. note after looking into it, it seems it does not support client/secret

ShwetaSalve commented 3 years ago

@Dave-Robertson92 we are using Capgemini.Crm.VisualStudioExtensions" version="2.0.6" in our project, since it's not supporting Oauth authentication ,we changed it to <package id="MsBuild.Xrm.SourceControl" version="3.0.0" targetFramework="net452" /> and changed the crmconfiguration.props file as follows,

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup> 
    <CrmSolutionName>Solutionname</CrmSolutionName> 
    **<EnvironmentVariableName>XRMExtract</EnvironmentVariableName>**
    <CrmConnectionString>Url=https://XXXXXX.crm4.dynamics.com; Username=XXXXXX.onmicrosoft.com; Password=XXXXX; AuthType=OAuth; AppId = XXX-XX-XXXX-XXX-XXXX; RedirectUri = app://XXX-XX-XXXX-XXX-XXXX; LoginPrompt=Auto;</CrmConnectionString>
      <ExportAutoNumberSettings>0</ExportAutoNumberSettings>
    <ExportCallendarSettings>0</ExportCallendarSettings>
      </PropertyGroup>
</Project>

However, with the new .prop file <EnvironmentVariableName> property got introduced and In the description of the nugget package here we don't find any information around this property.

Because of this property, we are not able to clean/ build our project and getting the error: Cannot bind argument to parameter 'environmentVariable' because it is an empty string.

Could you please help us with the missing property information, and what should we add here to make it work?

Dave-Robertson92 commented 3 years ago

@ShwetaSalve hello,

Apologies for the confusion, the environment variable should point to an environment variable where the value is your connection string. please see the instructions below on how to set up the environment variable. note once you set up the env variable a restart of Visual studio/your PC may be required. Please let me know if this resolves your issue

enhttps://www.architectryan.com/2018/08/31/how-to-change-environment-variables-on-windows-10/