Skip to content

Commit

Permalink
auth changes and assembly update (#428)
Browse files Browse the repository at this point in the history
* SkipDiscovery=False does not want to use adal for discovery and fails, thus will continue to require a credential when doing discovery or forcing an org disco.
* Fixed Workflowid issue and workflowname issue reported
* Assembly update
* Added several new params to connect-crmonline including a connectionstring debug process
semi-significant changes to connect-crmonline to take advantage of newer versions of ADAL capabilities. The module should now be capable of re-using cached tokens and signing in as the user who is signed into the PC.  All of this should be backwards compatible. 

Changes to connect-crmonline: 
* Force oAuth now can either use a credential provided which uses the username/pw in the connection string *or* it can be used without a credential and will natively use adal to get the username and password. 
* NOTE: the username parameter and no credential provided SSO auth flow are designed for desktop use (interactive). If you are using this in dev ops or in a scripted process you'll still want to use credentials (which will continue to function without updates/changes)
* To avoid confusion and a couple issues a new username parameter was added, username can be provided with no password and will guide adal on which identity to attempt authentication for. If you are signed in with your current identity which has access to a given tenant it should just 'work' with or without the username. 
* Default to oAuth if the UserName parameter is provided, even if you don't provided the forceoAuth switch, using a username parameter will assume you want to use modern auth 
* New switch parameter BypassTokenCache will null out the token cache path *if you're using azure dev ops this switch may be of importance to use to avoid token caching trying to access a path that doesn't exist on the sandboxed build host*
* New integer parameter ConnectionTimeoutInSeconds can now be used to set the connection when you first connect 
* New string parameter LogWriteDirectory can be used to force the module to write logs to a specific directory 
* NOTE: Force discovery will force you to provide a credential, not sure if this is a bug in the connector, but it appears a credential is required, that said, if you're using ForceDiscovery, I suggest dropping it as forcing a discovery upon connecting is redundant and shouldn't be required - if you have a scenario where discovery is required please let me know (i'm considering removing this). 
* Finally, I've added an experimental parameter set where you can provide a custom connection string.  Please don't use this unless your debugging, I might change it later and wouldn't want to break anyone. If you require the use of a connection string directly can you let me know why so I can better accommodate?  Thanks! 

Other changes: 
* Verbose parameter on connect-crmonline will output to a log file now in the local directory 
* changed the object template for crmserviceclient to include the last error - the template is applied to avoid showing the auth token by default and clean up the output when the connection object is returned.
  • Loading branch information
seanmcne authored Aug 24, 2020
1 parent dcc2d62 commit f8b8b27
Show file tree
Hide file tree
Showing 10 changed files with 804 additions and 177 deletions.
Binary file not shown.
196 changes: 172 additions & 24 deletions Microsoft.Xrm.Data.PowerShell/Microsoft.Xrm.Data.PowerShell.Help.pshproj

Large diffs are not rendered by default.

446 changes: 420 additions & 26 deletions Microsoft.Xrm.Data.PowerShell/Microsoft.Xrm.Data.PowerShell.Help.xml

Large diffs are not rendered by default.

17 changes: 12 additions & 5 deletions Microsoft.Xrm.Data.PowerShell/Microsoft.Xrm.Data.PowerShell.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,21 @@ PrivateData = @{

# ReleaseNotes of this module
ReleaseNotes = '
Lots of changes and enhancements to auth in this release:
- Updated to attempting SSO with oAuth by default
- Added an option for username to "hint" your username for SSO/browser based auth, if you get an immediate failure on connecting via oAuth (locally) try adding a username hint to help
- If you are logged into a managed pc by your org you should be able to use -forceoAuth and the serverurl without any other arguemnts to login and use your current users credentials
- Older auth methods continue to function as-is
- Removed requirement for redirecturi on clientsecret as it is not technically required
- redirected verbose connector output into a local file when -verbose is used with connect-crmonline
- Added option for debugging connections using a provided connectionstring - please only use this for debugging for now. NOTE: If you use this please let me know how you are using it.
- source for connector: https://www.powershellgallery.com/packages/Microsoft.Xrm.Tooling.CrmConnector.PowerShell/
Including newer xrm tooling which has the following improvements:
- 3.3.0.899 Added initial support for in memory log capture support.
- 3.3.0.897 Fixed an issue with sovereign cloud discovery reference data that would prevent a login control from picking the correct global discovery server when connecting.
- 3.3.0.891 Fixed an error where discovery would be used when using AD and IFD to connect to onpremise even if connection strings where used.
- 3.3.0.890 Fixed an error where timeout property was not properly assigned when using Non-oAuth types
- 3.3.0.890 Fixed an error with setting CallerId when ClientSecret Auth type is used.
Other Changes:
- Updated security role functions
- Added new formatting for the conn object to avoid showing the current auth token
- source for connector: https://www.powershellgallery.com/packages/Microsoft.Xrm.Tooling.CrmConnector.PowerShell/'
- 3.3.0.890 Fixed an error with setting CallerId when ClientSecret Auth type is used. '
# Prerelease = '-alpha'

} # End of PSData hashtable
Expand Down
Loading

0 comments on commit f8b8b27

Please sign in to comment.