編集

次の方法で共有


Configure OAuth settings to change the client session timeout

By default, the session lifetime is 24 hours for all Dynamics 365 Customer Engagement (on-premises) clients. You can change the session lifetime by setting the SessionSecurityTokenLifetimeInHours setting to a different value.

Requirements

Demonstrates

You can use the following script to increase the session lifetime timeout to 48 hours.

Example

$RemoveSnapInWhenDone = $False  
  
if (-not (Get-PSSnapin -Name Microsoft.Crm.PowerShell -ErrorAction SilentlyContinue))  
{  
    Add-PSSnapin Microsoft.Crm.PowerShell  
    $RemoveSnapInWhenDone = $True  
}  

$OathClaimsSettings = Get-CrmSetting -SettingType OAuthClaimsSettings

#display current setting
$OathClaimsSettings

$OathClaimsSettings.SessionSecurityTokenLifetimeInHours = 48
Set-CrmSetting $OathClaimsSettings

#display new setting
$OathClaimsSettings

if($RemoveSnapInWhenDone)  
{  
    Remove-PSSnapin Microsoft.Crm.PowerShell  
}  

Important

  • After you run the script run IISRESET on the Dynamics 365 Server running the Web Application server role. Additionally, clients must sign out and then sign in for the new setting to take effect.