> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/powershell-universal/security/enterprise-security/windows-sso.md). Agents can also search and read this documentation through its [MCP server](https://docs.devolutions.net/~gitbook/mcp).

# Windows SSO

Enable Windows single sign-on authentication in PowerShell Universal using Kerberos or NTLM, covering IIS and non-IIS hosting configurations.

Windows Authentication, also know as Negotiate authentication, uses Kerberos or NTLM to authenticate without prompting the user for a password. It is primarily supported on Windows domains but can be configured in Linux and Mac OS.

### appsettings.json

Windows Authentication provides single-sign on support for browsers and environments that support it. To enable Windows Authentication, set the `Authentication:Windows:Enabled` setting to `true` in `appsettings.json`. When it is enabled in `appsettings.json`, the Windows method is recreated at every start and is read-only in the admin console.

{% code collapsedlinecount="10" %}

```javascript
"Windows": {
  "Enabled": "true"
},
```

{% endcode %}

### Authentication.ps1

You can enable Windows authentication by adding a new authentication provider in Secure > Authentication. Select Windows and enable the authentication.

Once Windows set to authenticated, Windows authentication can now be used against Universal. You will have to log out in order to use Windows authentication.

When Windows authentication is enabled, users who are not signed in are redirected to `/api/v1/signin/windows` instead of the login page. If Windows authentication fails, the user is redirected to a login error page (`/login-error`) that displays the error.

The `-Configure` parameter of `Set-PSUAuthenticationMethod -Type Windows` accepts a script block that receives the ASP.NET Core `NegotiateOptions` object, to set options that are not exposed in the admin console. It is not used when PowerShell Universal is hosted in IIS.

### Windows Authentication in IIS

To enable Windows Authentication in IIS, ensure that you enable Windows Authentication and disable anonymous authentication.

In the web.config file that is included with PowerShell Universal, ensure that you have set the `forwardWindowsAuthToken` to `true`.

{% code collapsedlinecount="10" %}

```
<aspNetCore processPath="Universal.Server.exe" arguments="" forwardWindowsAuthToken="true" stdoutLogEnabled="true" stdoutLogFile=".\logs\log" hostingModel="OutOfProcess"/>
```

{% endcode %}

### Windows Authentication outside of IIS

Windows Authentication is supported outside of IIS but requires configuration of the account running the Universal service.

Outside of IIS, PowerShell Universal uses Negotiate authentication. Negotiate authentication is not registered when any of the following is true:

* PowerShell Universal runs in IIS or in Azure App Service.
* The `PSU_DISABLE_WIN_AUTH` environment variable is defined, with any value.
* The `DisableWindowsAuth` setting is `true` in `appsettings.json`.

#### Windows

On Windows, you should install PowerShell Universal as a [Windows Service](https://docs.devolutions.net/powershell-universal/getting-started.md#windows). Once the service is installed, you will need to create a [service account user](https://docs.devolutions.net/powershell-universal/config/running-as-a-service-account.md#application-service-account) and set the service to run with that user's account. The Windows authentication [setting ](https://docs.devolutions.net/powershell-universal/config/settings.md)needs to be set to true.

{% code collapsedlinecount="10" %}

```javascript
"Windows": {
  "Enabled": "true"
},
```

{% endcode %}

The service account needs to have a Service Principal Name (spn) configured for the computer account. You can do this using the `setspn` command. The computer name needs to be the full qualified name of the machine running Universal.

{% code collapsedlinecount="10" %}

```
setspn -S HTTP/myservername.mydomain.com myuser
```

{% endcode %}

For more information, you can follow the Microsoft documentation for configuring ASP.NET Core Windows Authentication: [Configuring a Windows machine for Windows Authentication](https://docs.microsoft.com/en-us/aspnet/core/security/authentication/windowsauth?view=aspnetcore-3.1\&tabs=visual-studio#windows-environment-configuration)

#### Linux

[Configuring a Linux or Mac OS machine for Windows Authentication](https://docs.microsoft.com/en-us/aspnet/core/security/authentication/windowsauth?view=aspnetcore-3.1\&tabs=visual-studio#linux-and-macos-environment-configuration)

### Cached Claims

PowerShell Universal will cache group membership claims when using Windows Authentication. Claims are cached for the configured session timeout value (default is 25 minutes). The session timeout is the `Authentication:SessionTimeout` setting of `appsettings.json`, in minutes. While claims are cached, changes to a user's group membership or to role mappings do not apply to that user until the cache expires or is cleared.

To clear the cache manually, navigate to Secure > Roles and click the Clear Cached Claims button.

## Browser Configuration

Depending on your local environment, you may need to configure your browser to properly pass credentials to PowerShell Universal.

* [Google Chrome](https://chromeenterprise.google/policies/#HTTPAuthentication)
* [Microsoft Edge](https://learn.microsoft.com/en-us/deployedge/microsoft-edge-policies#http-authentication-policies)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.devolutions.net/powershell-universal/security/enterprise-security/windows-sso.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
