Configure Workload Identity Federation with Active Directory
Stay organized with collections
Save and categorize content based on your preferences.
This guide describes how to use Workload Identity Federation to let workloads
use Active Directory credentials to authenticate to Google Cloud.
If you're running Windows Server workloads in an Active Directory environment,
then these workloads might have access to Active Directory credentials.
For example:
A Windows Service might be configured to log on as a domain user.
An IIS application might be configured to run as a group managed service
account (gMSA).
By using Workload Identity Federation in combination with Active Directory
Federation Services (AD FS), you can let these workloads exchange their Active
Directory Kerberos credentials for short-lived Google Cloud credentials.
Workloads can use these short-lived credentials to access Google Cloud
APIs.
Exchanging Active Directory credentials against short-lived Google Cloud
credentials works by chaining two token exchanges:
A workload uses OpenID Connect (OIDC), SAML-POST, or WS-Trust to request
an OIDC token or SAML assertion from AD FS. To authenticate to AD FS, the
workload uses integrated Windows authentication (IWA)
and its existing Active Directory credentials.
The workload then uses Workload Identity Federation to exchange the OIDC
token or SAML assertion against an Security Token Service token and, optionally, to
impersonate a Google Cloud service account.
This document shows you how you can automate this process in a way that doesn't
require changes to your application by using the Workload Authenticator for Windows.
Prepare AD FS
You only need to perform these steps once.
Select a protocol
The way to prepare AD FS depends on which protocol you want to use:
SAML: You can let workloads use SAML or WS-Trust to obtain SAML assertions.
To use SAML or WS-Trust, you create a relying party in AD FS and
configure a workload identity pool to trust assertions issued for this
relying party.
A workload can use its Active Directory user to authenticate to AD FS
either by using the SAML-POST binding or WS-Trust. AD FS then issues a SAML
assertion that contains information about the workload's Active Directory
user and additional information such as group memberships.
Using SAML or WS-Trust requires AD FS 3.0, AD FS for Windows Server 2016, or
a newer version of AD FS.
OIDC: You can let workloads use OIDC to obtain OIDC tokens.
To use OIDC, you create an OIDC client (native application) and an OIDC
resource (Web API) in AD FS. You then configure a workload identity pool
to trust access tokens issued for the Web API.
A workload can use its Active Directory user and the OAuth client_credentials
grant to authenticate to AD FS. AD FS then issues an access token, but no ID
token.
The access token contains information about the OIDC client application,
but doesn't include any information about the workload's Active Directory
user or its group memberships.
Because access tokens don't contain any information about the Active
Directory user, using OIDC can be less flexible than using SAML or WS-Trust.
Using OIDC requires AD FS for Windows Server 2016 or a newer
version of AD FS.
For sign-in, your IdP must provide signed authentication information: OIDC IdPs must provide a JWT,
and SAML IdP responses must be signed.
IWA prerequisites
This section describes IWA prerequisites that are required in order to use this
guide.
If you haven't used IWA with AD FS before, make sure that you meet the following
prerequisites:
You only need to perform these steps once for each Microsoft Active Directory
domain that you want to federate with. You can then use the same workload
identity pool and provider for multiple workloads and across multiple
Google Cloud projects.
To start configuring Workload Identity Federation, do the following:
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
Roles required to select or create a project
Select a project: Selecting a project doesn't require a specific
IAM role—you can select any project that you've been
granted a role on.
Create a project: To create a project, you need the Project Creator role
(roles/resourcemanager.projectCreator), which contains the
resourcemanager.projects.create permission. Learn how to grant
roles.
Enable the IAM, Resource Manager, Service Account Credentials, and Security Token Service APIs.
Roles required to enable APIs
To enable APIs, you need the serviceusage.services.enable permission. If you
created the project, then you likely already have this permission through the
Owner role (roles/owner). Otherwise, you can get this permission through the
Service Usage Admin role (roles/serviceusage.serviceUsageAdmin).
Learn how to grant roles.
The environment-specific credentials of your Active Directory workload contain
multiple attributes, and you must decide which attribute you want to use as
the subject identifier (google.subject) in Google Cloud.
Optionally, you can map additional attributes.
You can then refer to these additional attributes when granting access to
resources.
Optionally, define an attribute condition. Attribute conditions
are CEL expressions that can check assertion attributes and target attributes.
If the attribute condition evaluates to true for a given credential, the
credential is accepted. Otherwise, the credential is rejected.
To get the permissions that
you need to configure Workload Identity Federation,
ask your administrator to grant you the
following IAM roles on the project:
Alternatively, the IAM Owner (roles/owner) basic
role also includes permissions to configure identity federation.
You should not grant basic roles in a production environment, but you can grant them in a
development or test environment.
Console
In the Google Cloud console, go to the
New workload provider and pool page.
This section guides you through creating an asymmetric key pair that enables
workload identity federation to accept encrypted SAML assertions.
Google Cloud uses the private key to decrypt the SAML assertions that your
IdP issues. To create an asymmetric key pair for use with SAML encryption, run the following command. To learn more, see Supported SAML encryption algorithms.
WORKLOAD_PROVIDER_ID: the workforce identity pool provider ID
KEY_SPECIFICATION: the key specification, which can be one of rsa-2048, rsa-3072, and rsa-4096.
After the key pair is created, to download the public key into a certificate
file, execute the following command. Only workload identity federation has
access to the private key.
WS-Trust users: This feature is only available when you use SAML.
After you configure your IdP to encrypt SAML assertions, we recommend that you check to make sure that the assertions it generates are actually encrypted. Even with SAML assertion encryption configured, workload identity federation can still process plaintext assertions.
SAML assertions that are issued by AD FS are cryptographically signed
and exchanged over an encrypted TLS channel. However, the SAML
assertions themselves are not encrypted. By using SAML encryption, you can
configure AD FS to encrypt assertions so that they can only be decrypted
and read by your workload identity pool.
OIDC
This feature is only available when you use SAML.
SAML or WS-Trust
Create an encryption key for your workload identity pool provider:
The key pair is stored and managed by Workload Identity Federation. You
can export the public key, but only Workload Identity Federation can access
the private key.
Export a certificate that contains the public key:
Allow your external workload to access Google Cloud resources
To provide your workload with access to Google Cloud resources, we
recommend that you grant direct resource access to the principal. In this case,
the principal is the federated user. Some Google Cloud products have
Google Cloud API limitations.
If your workload calls an API endpoint that has a limitation, you can instead
use service account impersonation. In this case, the principal is the
Google Cloud service account, which acts as the identity. You grant access
to the service account on the resource.
Workload Authenticator for Windows is an open-source tool that acts as a plugin
for the Cloud Client Libraries and tools such as the gcloud CLI:
When the tool or library needs a new credential, it launches the Workload
Authenticator in the background.
The Workload Authenticator uses OIDC, SAML, or WS-Trust to obtain a new token
or SAML assertion from AD FS and passes it back to the tool or library.
The tool or library then uses exchanges the token or SAML assertion against
short-lived Google Cloud credentials by using
Workload Identity Federation.
To use the Workload Authenticator for Windows, you must create a credential
configuration file. This file defines the following:
Where to find the Workload Authenticator for Windows executable (wwauth.exe),
and which parameters to run it with
Which workload identity pool and provider to use
Which service account to impersonate
To create a credential configuration file, do the following on the Windows
Server that runs your workload:
Right-click the Start button (or press Win+X) and click Windows PowerShell.
If you create a credential configuration file by using the Workload
Authenticator for Windows, the file contains the path to its executable. If
you later delete or move the executable, workloads won't be able to find and
use the executable.
Launch wwauth.exe:
& ${env:ProgramData}\wwauth.exe
A configuration dialog opens:
Select the AD FS tab and enter the following settings:
Issuer URI of AD FS server: Public URI of your AD FS server or farm.
https://ADFS_DOMAIN/adfs/
Replace ADFS_DOMAIN with the public domain name
of your AD FS server or server farm.
The next settings depend on the protocol you want to use:
Select the Workload identity tab and enter the following settings:
Project number: Project number of the project
that contains the workload identity pool
Pool ID: ID of the workload identity pool
Provider ID: ID of the workload identity pool provider
Impersonate service account: enabled, if you use service account
impersonation
Email address: Email address of the service account, if you use
service account impersonation
Select the AD FS tab and verify that the Relying Party ID field
now contains the URL of your workload identity pool provider.
Click Apply and choose a file location to save the credential configuration
file to.
Unlike a service account key,
a credential configuration file doesn't contain any secrets and doesn't need
to be kept confidential. Details about the credential configuration file are
available at https://google.aip.dev/auth/4117.
You're now ready to test your configuration:
Select an Active Directory user to test with. This can be the Active
Directory user of the workload or the user you're currently logged in with.
To test the configuration with your current user, click Test.
To test with a different user, select Test > Test configuration as user
and enter the credentials for the user.
The tool now tries to authenticate to Google Cloud by performing
the following steps:
Acquire an OIDC token or SAML assertion from AD FS.
Obtain a Google Security Token Service token.
Impersonate the service account, if you use service account
impersonation.
If the authentication succeeds, you see the message
Test completed successfully:
Use the credential configuration to access Google Cloud
To let tools and client libraries use your credential configuration, do the
following on the Windows Server that runs your workload:
Right-click the Start button and click Run.
Enter sysdm.cpl and click OK.
On the Advanced tab, click Environment variables.
In the System variables section, add two new variables:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-07-21 UTC."],[],[]]